From c76bbd5328bac525dddb05242fa1f32ebbf202cc Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Sat, 15 Nov 2014 12:28:45 -0600 Subject: [PATCH] Fix for fullscreen bug in upgrade to Qt 5. --- src/gui/app.cpp | 2 +- src/gui/mainwin.cpp | 17 ++++++----------- src/gui/profile.cpp | 1 + src/gui/profile.h | 1 - virtualjaguar.pro | 3 +-- 5 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/gui/app.cpp b/src/gui/app.cpp index e0b942b..9414dd4 100644 --- a/src/gui/app.cpp +++ b/src/gui/app.cpp @@ -7,7 +7,7 @@ // JLH = James Hammons // // Who When What -// --- ---------- ------------------------------------------------------------- +// --- ---------- ----------------------------------------------------------- // JLH 12/23/2009 Created this file // JLH 01/21/2011 Added SDL initialization // JLH 06/26/2011 Added fix to keep SDL from hijacking main() on win32 diff --git a/src/gui/mainwin.cpp b/src/gui/mainwin.cpp index 2936305..f2c45ab 100644 --- a/src/gui/mainwin.cpp +++ b/src/gui/mainwin.cpp @@ -1016,11 +1016,9 @@ void MainWin::SetFullScreen(bool state/*= true*/) if (debugbar) debugbar->hide(); - showFullScreen(); // This is needed because the fullscreen may happen on a different // screen than screen 0: int screenNum = QApplication::desktop()->screenNumber(videoWidget); -// QRect r = QApplication::desktop()->availableGeometry(screenNum); QRect r = QApplication::desktop()->screenGeometry(screenNum); double targetWidth = (double)VIRTUAL_SCREEN_WIDTH, targetHeight = (double)(vjs.hardwareTypeNTSC ? VIRTUAL_SCREEN_HEIGHT_NTSC : VIRTUAL_SCREEN_HEIGHT_PAL); @@ -1036,6 +1034,11 @@ void MainWin::SetFullScreen(bool state/*= true*/) } else { + // Seems Qt is fussy about this: showNormal() has to go first, or it + // will keep the window stuck in a psuedo-fullscreen mode with no way + // to get out of it (except closing the app). + showNormal(); + // Reset the video widget to windowed mode videoWidget->offset = 0; videoWidget->fullscreen = false; @@ -1046,7 +1049,6 @@ void MainWin::SetFullScreen(bool state/*= true*/) if (debugbar) debugbar->show(); - showNormal(); ResizeMainWindow(); move(mainWinPosition); } @@ -1112,14 +1114,7 @@ void MainWin::ResizeMainWindow(void) } } - show(); - - for(int i=0; i<2; i++) - { - resize(0, 0); - usleep(2000); - QApplication::processEvents(); - } + adjustSize(); } diff --git a/src/gui/profile.cpp b/src/gui/profile.cpp index 484d4b4..a1bb926 100644 --- a/src/gui/profile.cpp +++ b/src/gui/profile.cpp @@ -30,6 +30,7 @@ // #include "profile.h" +#include #include "gamepad.h" #include "log.h" #include "settings.h" diff --git a/src/gui/profile.h b/src/gui/profile.h index 6c5a96f..211a8a5 100644 --- a/src/gui/profile.h +++ b/src/gui/profile.h @@ -1,7 +1,6 @@ #ifndef __PROFILE_H__ #define __PROFILE_H__ -#include #include class QComboBox; diff --git a/virtualjaguar.pro b/virtualjaguar.pro index 6976d85..9c3706f 100644 --- a/virtualjaguar.pro +++ b/virtualjaguar.pro @@ -18,8 +18,7 @@ CONFIG += qt warn_on release # debug RESOURCES += src/gui/virtualjaguar.qrc LIBS += -Lobj -Lsrc/m68000/obj -ljaguarcore -lz -lm68k -QT += opengl -QT += widgets +QT += opengl widgets # We stuff all the intermediate crap into obj/ so it won't confuse us mere # mortals ;-) -- 2.37.2