From 0ed995e6a970e59622eb9695ccce2d438593a941 Mon Sep 17 00:00:00 2001 From: Tats Date: Sat, 26 Mar 2016 12:58:19 -0400 Subject: [PATCH] Fixed: It should be possible to have an output window when using a single screen (closes #209). --- MainWindow.cpp | 11 ++++++----- OutputGLWindow.cpp | 42 +++++++++++++++--------------------------- 2 files changed, 21 insertions(+), 32 deletions(-) diff --git a/MainWindow.cpp b/MainWindow.cpp index fa9e2b2..c0bbb0e 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -1625,7 +1625,6 @@ void MainWindow::createActions() outputFullScreenAction->setCheckable(true); // Don't be displayed by default outputFullScreenAction->setChecked(false); - outputFullScreenAction->setEnabled(QApplication::desktop()->screenCount() > 1); outputFullScreenAction->setShortcutContext(Qt::ApplicationShortcut); addAction(outputFullScreenAction); // Manage fullscreen/modal show of GL output window. @@ -2910,10 +2909,12 @@ void MainWindow::pollOscInterface() void MainWindow::updateOutputAction(int screen) { - if (screen > 1) - outputFullScreenAction->setEnabled(true); - else - outputFullScreenAction->setEnabled(false); + // Change window (untested). + if (outputWindow->isFullScreen()) + { + outputWindow->setFullScreen(false); + outputWindow->setFullScreen(true); + } } // void MainWindow::applyOscCommand(const QVariantList& command) diff --git a/OutputGLWindow.cpp b/OutputGLWindow.cpp index c99eeb8..05cf0bc 100644 --- a/OutputGLWindow.cpp +++ b/OutputGLWindow.cpp @@ -89,44 +89,32 @@ void OutputGLWindow::setFullScreen(bool fullscreen) if (fullscreen) { // Check if user is on multiple screen - if (QApplication::desktop()->screenCount() > 1) - { - // Hide cursor - setCursorVisible(!fullscreen); - // Activate crosshair in fullscreen mode. - // should be only drawn if the controls should be shown - canvas->setDisplayCrosshair(fullscreen && canvas->getMainWindow()->displayControls()); - //Move window to second screen before fullscreening it. - setGeometry(QApplication::desktop()->screenGeometry(1)); - //The problem related to the full screen on linux seems to be resolved - // with Qt 5.5 at least on Debian but define macro anyway + int screen = (QApplication::desktop()->screenCount() > 1 ? 1 : 0); + // Hide cursor + setCursorVisible(!fullscreen); + // Activate crosshair in fullscreen mode. + // should be only drawn if the controls should be shown + canvas->setDisplayCrosshair(fullscreen && canvas->getMainWindow()->displayControls()); + //Move window to second screen before fullscreening it. + setGeometry(QApplication::desktop()->screenGeometry(screen)); + //The problem related to the full screen on linux seems to be resolved + // with Qt 5.5 at least on Debian but define macro anyway #ifdef Q_OS_LINUX - setWindowFlags(Qt::Window); - setVisible(true); - setWindowState( windowState() ^ Qt::WindowFullScreen ); - show(); + setWindowFlags(Qt::Window); + setVisible(true); + setWindowState( windowState() ^ Qt::WindowFullScreen ); + show(); #else showFullScreen(); #endif - } - else - { - show(); - } } else { - if (QApplication::desktop()->screenCount() > 1) { #ifdef Q_OS_LINUX - setWindowFlags( windowFlags() & ~Qt::Window ); + setWindowFlags( windowFlags() & ~Qt::Window ); #else showNormal(); #endif - } - else - { - hide(); - } } }