Merge pull request #6481 from spycrab/qt_fix_fs

Qt: Fix fullscreen
This commit is contained in:
Anthony 2018-03-21 16:44:54 -07:00 committed by GitHub
commit 30ccaa3fd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 11 deletions

View File

@ -247,6 +247,9 @@ void CodeWidget::Update()
void CodeWidget::UpdateCallstack() void CodeWidget::UpdateCallstack()
{ {
if (Core::GetState() == Core::State::Starting)
return;
m_callstack_list->clear(); m_callstack_list->clear();
std::vector<Dolphin_Debugger::CallstackEntry> stack; std::vector<Dolphin_Debugger::CallstackEntry> stack;

View File

@ -566,7 +566,7 @@ void MainWindow::FullScreen()
// settings. If it's set to be fullscreen then it just remakes the window, // settings. If it's set to be fullscreen then it just remakes the window,
// which probably isn't ideal. // which probably isn't ideal.
bool was_fullscreen = m_render_widget->isFullScreen(); bool was_fullscreen = m_render_widget->isFullScreen();
HideRenderWidget(); HideRenderWidget(false);
if (was_fullscreen) if (was_fullscreen)
ShowRenderWidget(); ShowRenderWidget();
else else
@ -630,7 +630,7 @@ void MainWindow::ShowRenderWidget()
{ {
// Otherwise, just show it. // Otherwise, just show it.
m_rendering_to_main = false; m_rendering_to_main = false;
if (SConfig::GetInstance().bFullscreen) if (SConfig::GetInstance().bFullscreen && !m_render_widget->isFullScreen())
{ {
m_render_widget->showFullScreen(); m_render_widget->showFullScreen();
} }
@ -642,7 +642,7 @@ void MainWindow::ShowRenderWidget()
} }
} }
void MainWindow::HideRenderWidget() void MainWindow::HideRenderWidget(bool reinit)
{ {
if (m_rendering_to_main) if (m_rendering_to_main)
{ {
@ -655,19 +655,23 @@ void MainWindow::HideRenderWidget()
setWindowTitle(QString::fromStdString(Common::scm_rev_str)); setWindowTitle(QString::fromStdString(Common::scm_rev_str));
} }
m_render_widget->hide();
// The following code works around a driver bug that would lead to Dolphin crashing when changing // The following code works around a driver bug that would lead to Dolphin crashing when changing
// graphics backends (e.g. OpenGL to Vulkan). To avoid this the render widget is (safely) // graphics backends (e.g. OpenGL to Vulkan). To avoid this the render widget is (safely)
// recreated // recreated
disconnect(m_render_widget, &RenderWidget::Closed, this, &MainWindow::ForceStop); if (reinit)
{
disconnect(m_render_widget, &RenderWidget::Closed, this, &MainWindow::ForceStop);
m_render_widget->hide(); m_render_widget->removeEventFilter(this);
m_render_widget->removeEventFilter(this); m_render_widget->deleteLater();
m_render_widget->deleteLater();
m_render_widget = new RenderWidget; m_render_widget = new RenderWidget;
m_render_widget->installEventFilter(this); m_render_widget->installEventFilter(this);
connect(m_render_widget, &RenderWidget::Closed, this, &MainWindow::ForceStop); connect(m_render_widget, &RenderWidget::Closed, this, &MainWindow::ForceStop);
}
} }
void MainWindow::ShowControllersWindow() void MainWindow::ShowControllersWindow()

View File

@ -100,7 +100,7 @@ private:
void StartGame(const std::string& path, const std::optional<std::string>& savestate_path = {}); void StartGame(const std::string& path, const std::optional<std::string>& savestate_path = {});
void StartGame(std::unique_ptr<BootParameters>&& parameters); void StartGame(std::unique_ptr<BootParameters>&& parameters);
void ShowRenderWidget(); void ShowRenderWidget();
void HideRenderWidget(); void HideRenderWidget(bool reinit = true);
void ShowSettingsWindow(); void ShowSettingsWindow();
void ShowGeneralWindow(); void ShowGeneralWindow();

View File

@ -49,6 +49,12 @@ void RenderWidget::HandleCursorTimer()
setCursor(Qt::BlankCursor); setCursor(Qt::BlankCursor);
} }
void RenderWidget::showFullScreen()
{
QWidget::showFullScreen();
emit SizeChanged(width(), height());
}
bool RenderWidget::event(QEvent* event) bool RenderWidget::event(QEvent* event)
{ {
switch (event->type()) switch (event->type())

View File

@ -17,6 +17,7 @@ public:
explicit RenderWidget(QWidget* parent = nullptr); explicit RenderWidget(QWidget* parent = nullptr);
bool event(QEvent* event) override; bool event(QEvent* event) override;
void showFullScreen();
signals: signals:
void EscapePressed(); void EscapePressed();