[vlc-commits] Qt: fix the qt-fullscreen-screennumber option
Adrien Maglo
git at videolan.org
Tue Nov 21 16:48:45 CET 2017
vlc | branch: master | Adrien Maglo <magsoft at videolan.org> | Tue Nov 21 14:02:37 2017 +0100| [ff4b90c15a9ea6c4f33362b152c289fc528f3609] | committer: Jean-Baptiste Kempf
Qt: fix the qt-fullscreen-screennumber option
numScreens() is deprecated.
To set the window fullscreen on the defined monitor, a call to setScreen()
is needed.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ff4b90c15a9ea6c4f33362b152c289fc528f3609
---
modules/gui/qt/components/controller.cpp | 4 +++-
modules/gui/qt/main_interface.cpp | 9 ++++++++-
modules/gui/qt/main_interface.hpp | 2 ++
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/modules/gui/qt/components/controller.cpp b/modules/gui/qt/components/controller.cpp
index 1f9de2386d..08a08d2212 100644
--- a/modules/gui/qt/components/controller.cpp
+++ b/modules/gui/qt/components/controller.cpp
@@ -50,6 +50,7 @@
#include <QSignalMapper>
#include <QTimer>
#include <QApplication>
+#include <QWindow>
#include <QScreen>
//#define DEBUG_LAYOUT 1
@@ -869,6 +870,7 @@ void FullscreenControllerWidget::restoreFSC()
adjustSize();
QRect currentRes = QApplication::desktop()->screenGeometry( targetScreen() );
+ windowHandle()->setScreen(QGuiApplication::screens()[targetScreen()]);
if( currentRes == screenRes &&
QApplication::desktop()->screen()->geometry().contains( previousPosition, true ) )
@@ -984,7 +986,7 @@ void FullscreenControllerWidget::toggleFullwidth()
int FullscreenControllerWidget::targetScreen()
{
- if( i_screennumber < 0 || i_screennumber > QApplication::desktop()->numScreens() )
+ if( i_screennumber < 0 || i_screennumber > QApplication::desktop()->screenCount() )
return QApplication::desktop()->screenNumber( p_intf->p_sys->p_mi );
return i_screennumber;
}
diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp
index b5bbeaf710..787abbf81f 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -54,11 +54,13 @@
#include <QDate>
#include <QMimeData>
+#include <QWindow>
#include <QMenu>
#include <QMenuBar>
#include <QStatusBar>
#include <QLabel>
#include <QStackedWidget>
+#include <QScreen>
#ifdef _WIN32
#include <QFileInfo>
#endif
@@ -96,6 +98,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
videoWidget = NULL;
playlistWidget = NULL;
stackCentralOldWidget= NULL;
+ lastWinScreen = NULL;
sysTray = NULL;
fullscreenControls = NULL;
cryptedLabel = NULL;
@@ -857,10 +860,12 @@ void MainInterface::setVideoFullScreen( bool fs )
* than current number of screens, take screennumber where current interface
* is
*/
- if( numscreen == -1 || numscreen > QApplication::desktop()->numScreens() )
+ if( numscreen == -1 || numscreen > QApplication::desktop()->screenCount() )
numscreen = QApplication::desktop()->screenNumber( p_intf->p_sys->p_mi );
QRect screenres = QApplication::desktop()->screenGeometry( numscreen );
+ lastWinScreen = windowHandle()->screen();
+ windowHandle()->setScreen(QGuiApplication::screens()[numscreen]);
/* To be sure window is on proper-screen in xinerama */
if( !screenres.contains( pos() ) )
@@ -885,6 +890,8 @@ void MainInterface::setVideoFullScreen( bool fs )
{
setMinimalView( b_minimalView );
setInterfaceFullScreen( b_interfaceFullScreen );
+ if (lastWinScreen != NULL)
+ windowHandle()->setScreen(lastWinScreen);
if( lastWinPosition.isNull() == false )
{
move( lastWinPosition );
diff --git a/modules/gui/qt/main_interface.hpp b/modules/gui/qt/main_interface.hpp
index fe8a4b61f0..8977bd4007 100644
--- a/modules/gui/qt/main_interface.hpp
+++ b/modules/gui/qt/main_interface.hpp
@@ -51,6 +51,7 @@ class FullscreenControllerWidget;
class QVBoxLayout;
class QMenu;
class QSize;
+class QScreen;
class QTimer;
class StandardPLPanel;
struct vout_window_t;
@@ -166,6 +167,7 @@ protected:
QWidget *stackCentralOldWidget;
QPoint lastWinPosition;
QSize lastWinSize; /// To restore the same window size when leaving fullscreen
+ QScreen *lastWinScreen;
QMap<QWidget *, QSize> stackWidgetsSizes;
More information about the vlc-commits
mailing list