From fadedee75f019e1b6491c38bd4c5d5af8b1906bd Mon Sep 17 00:00:00 2001 From: beaumanvienna Date: Wed, 24 Sep 2014 23:24:23 +0200 Subject: [PATCH] amendments for: global variable 'fullscreenCLI'/move on top timer/Qt fullscreen code --- Qt/mainwindow.cpp | 46 +++++++--------------------------------------- Qt/mainwindow.h | 3 +-- UI/NativeApp.cpp | 4 ++-- 3 files changed, 10 insertions(+), 43 deletions(-) diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 6ca2286479..03a327466b 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -18,38 +18,7 @@ // "--fullscreen" from command line interface extern bool fullscreenCLI; -//Dual Head Support -int getNumVideoDisplays(void) -{ - - QDesktopWidget *desktop = QApplication::desktop(); - return desktop->screenCount(); - -} - -//Dual Head Support -int getDisplayNumber(void) -{ - - int tempValue, displayNumber; - - //get environment - tempValue = QProcessEnvironment::systemEnvironment().value("SDL_VIDEO_FULLSCREEN_HEAD", "0").toInt(); - - // setup default: primary display - displayNumber = 0; - - //check if larger equal 0 and less then display numbers - if ((tempValue >=0) && (tempValue < getNumVideoDisplays())) - { - // check passed - displayNumber = tempValue; - } - - return displayNumber; -} - -MainWindow::MainWindow(QWidget *parent) : +MainWindow::MainWindow(QWidget *parent, bool fullscreen) : QMainWindow(parent), currentLanguage("en"), nextState(CORE_POWERDOWN), @@ -59,10 +28,11 @@ MainWindow::MainWindow(QWidget *parent) : memoryTexWindow(0), displaylistWindow(0) { - // timer needed to bring window on top - timer = new QTimer(this); QDesktopWidget *desktop = QApplication::desktop(); - QRect rect = desktop->screenGeometry(getDisplayNumber()); + int screenNum = QProcessEnvironment::systemEnvironment().value("SDL_VIDEO_FULLSCREEN_HEAD", "0").toInt(); + + // Move window to top left coordinate of selected screen + QRect rect = desktop->screenGeometry(screenNum); move(rect.topLeft()); SetGameTitle(""); @@ -74,7 +44,7 @@ MainWindow::MainWindow(QWidget *parent) : SetZoom(g_Config.iInternalResolution); - if(fullscreenCLI) + if(fullscreen) fullscrAct(); QObject::connect(emugl, SIGNAL(doubleClick()), this, SLOT(fullscrAct())); @@ -378,7 +348,6 @@ void MainWindow::raiseTopMost() setWindowState( (windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); raise(); activateWindow(); - timer->stop(); } @@ -413,8 +382,7 @@ void MainWindow::fullscrAct() } - connect(timer, SIGNAL(timeout()), this, SLOT(raiseTopMost())); - timer->start(1000); + QTimer::singleShot(1000, this, SLOT(raiseTopMost())); } void MainWindow::websiteAct() diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index 357a15ddbb..8e500e5d4f 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -26,7 +26,7 @@ class MainWindow : public QMainWindow Q_OBJECT public: - explicit MainWindow(QWidget *parent = 0); + explicit MainWindow(QWidget *parent = 0, bool fullscreen=false); ~MainWindow() { }; Debugger_Disasm* GetDialogDisasm() { return dialogDisasm; } @@ -144,7 +144,6 @@ private: QTranslator translator; QString currentLanguage; - QTimer *timer; CoreState nextState; InputState input_state; diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 3efbdbaf52..bea9da5e52 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -246,7 +246,7 @@ void NativeGetAppInfo(std::string *app_dir_name, std::string *app_nice_name, boo } void NativeInit(int argc, const char *argv[], - const char *savegame_directory, const char *external_directory, const char *installID) { + const char *savegame_directory, const char *external_directory, const char *installID, bool fs) { #ifdef ANDROID_NDK_PROFILER setenv("CPUPROFILE_FREQUENCY", "500", 1); setenv("CPUPROFILE", "/sdcard/gmon.out", 1); @@ -454,7 +454,7 @@ void NativeInit(int argc, const char *argv[], isOuya = KeyMap::IsOuya(sysName); #if !defined(MOBILE_DEVICE) && defined(USING_QT_UI) - MainWindow* mainWindow = new MainWindow(0); + MainWindow* mainWindow = new MainWindow(0,fs); mainWindow->show(); host = new QtHost(mainWindow); #endif