diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 9710d86b67..1180bd8c05 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -15,7 +15,7 @@ #include "GPU/GPUInterface.h" #include "UI/GamepadEmu.h" -MainWindow::MainWindow(QWidget *parent) : +MainWindow::MainWindow(QWidget *parent, bool fullscreen) : QMainWindow(parent), currentLanguage("en"), nextState(CORE_POWERDOWN), @@ -25,10 +25,12 @@ MainWindow::MainWindow(QWidget *parent) : memoryTexWindow(0), displaylistWindow(0) { - // Allow creation on custom screen + QDesktopWidget *desktop = QApplication::desktop(); int screenNum = QProcessEnvironment::systemEnvironment().value("SDL_VIDEO_FULLSCREEN_HEAD", "0").toInt(); + // Move window to top left coordinate of selected screen - move(qApp->desktop()->screen(screenNum)->pos()); + QRect rect = desktop->screenGeometry(screenNum); + move(rect.topLeft()); SetGameTitle(""); emugl = new MainUI(this); @@ -38,6 +40,9 @@ MainWindow::MainWindow(QWidget *parent) : updateMenus(); SetZoom(g_Config.iInternalResolution); + + if(fullscreen) + fullscrAct(); QObject::connect(emugl, SIGNAL(doubleClick()), this, SLOT(fullscrAct())); QObject::connect(emugl, SIGNAL(newFrame()), this, SLOT(newFrame())); @@ -334,6 +339,15 @@ void MainWindow::stretchAct() gpu->Resized(); } +void MainWindow::raiseTopMost() +{ + + setWindowState( (windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); + raise(); + activateWindow(); + +} + void MainWindow::fullscrAct() { if(isFullScreen()) { @@ -364,6 +378,8 @@ void MainWindow::fullscrAct() QApplication::setOverrideCursor(QCursor(Qt::BlankCursor)); } + + QTimer::singleShot(1000, this, SLOT(raiseTopMost())); } void MainWindow::websiteAct() diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index 397f6eac1c..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; } @@ -109,6 +109,7 @@ private slots: void audioAct() { g_Config.bEnableSound = !g_Config.bEnableSound; } void fullscrAct(); + void raiseTopMost(); void statsAct() { g_Config.bShowDebugStats = !g_Config.bShowDebugStats; } void showFPSAct() { g_Config.iShowFPSCounter = !g_Config.iShowFPSCounter; } diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 3729b86b78..7d7db1317a 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -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