vlc/vlc-3.0 | branch: master | Pierre Lamot <[email protected]> | Mon Dec 18 10:22:10 2017 +0100| [a7018fc36800b0a3560a4c072c8ec2c3b15776c2] | committer: Jean-Baptiste Kempf
qt: fix setScreen might crash on wayland when entering fullscreen Signed-off-by: Jean-Baptiste Kempf <[email protected]> (cherry picked from commit 24b436c88a986fcf2cddb3c52e5a067565fc537e) Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=a7018fc36800b0a3560a4c072c8ec2c3b15776c2 --- modules/gui/qt/components/controller.cpp | 9 +++++++++ modules/gui/qt/components/controller.hpp | 4 ++++ modules/gui/qt/main_interface.cpp | 17 ++++++++++++++++- modules/gui/qt/main_interface.hpp | 4 +++- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/modules/gui/qt/components/controller.cpp b/modules/gui/qt/components/controller.cpp index 428aa216a1..1b91019729 100644 --- a/modules/gui/qt/components/controller.cpp +++ b/modules/gui/qt/components/controller.cpp @@ -800,6 +800,10 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWi b_fullscreen = false; i_hide_timeout = 1; i_screennumber = -1; +#ifdef QT5_HAS_WAYLAND + b_hasWayland = QGuiApplication::platformName() + .startsWith(QLatin1String("wayland"), Qt::CaseInsensitive); +#endif vout.clear(); @@ -873,7 +877,12 @@ void FullscreenControllerWidget::restoreFSC() return; QRect currentRes = QApplication::desktop()->screenGeometry( targetScreen() ); +#ifdef QT5_HAS_WAYLAND + if ( !b_hasWayland ) + windowHandle()->setScreen(QGuiApplication::screens()[targetScreen()]); +#else windowHandle()->setScreen(QGuiApplication::screens()[targetScreen()]); +#endif if( currentRes == screenRes && QApplication::desktop()->screen()->geometry().contains( previousPosition, true ) ) diff --git a/modules/gui/qt/components/controller.hpp b/modules/gui/qt/components/controller.hpp index 8bfe8e259c..25d4f4b00c 100644 --- a/modules/gui/qt/components/controller.hpp +++ b/modules/gui/qt/components/controller.hpp @@ -318,6 +318,10 @@ private: bool isWideFSC; int i_sensitivity; + +#ifdef QT5_HAS_WAYLAND + bool b_hasWayland; +#endif }; #endif diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp index 3889dedc0e..af624580e2 100644 --- a/modules/gui/qt/main_interface.cpp +++ b/modules/gui/qt/main_interface.cpp @@ -152,6 +152,11 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) /* Should the UI stays on top of other windows */ b_interfaceOnTop = var_InheritBool( p_intf, "video-on-top" ); +#ifdef QT5_HAS_WAYLAND + b_hasWayland = QGuiApplication::platformName() + .startsWith(QLatin1String("wayland"), Qt::CaseInsensitive); +#endif + /************************** * UI and Widgets design **************************/ @@ -872,7 +877,12 @@ void MainInterface::setVideoFullScreen( bool fs ) QRect screenres = QApplication::desktop()->screenGeometry( numscreen ); lastWinScreen = windowHandle()->screen(); +#ifdef QT5_HAS_WAYLAND + if( !b_hasWayland ) + windowHandle()->setScreen(QGuiApplication::screens()[numscreen]); +#else windowHandle()->setScreen(QGuiApplication::screens()[numscreen]); +#endif /* To be sure window is on proper-screen in xinerama */ if( !screenres.contains( pos() ) ) @@ -898,8 +908,13 @@ void MainInterface::setVideoFullScreen( bool fs ) { setMinimalView( b_minimalView ); setInterfaceFullScreen( b_interfaceFullScreen ); - if (lastWinScreen != NULL) +#ifdef QT5_HAS_WAYLAND + if( lastWinScreen != NULL && !b_hasWayland ) windowHandle()->setScreen(lastWinScreen); +#else + if( lastWinScreen != NULL ) + windowHandle()->setScreen(lastWinScreen); +#endif if( lastWinPosition.isNull() == false ) { move( lastWinPosition ); diff --git a/modules/gui/qt/main_interface.hpp b/modules/gui/qt/main_interface.hpp index 79abd52894..d6ba7463e7 100644 --- a/modules/gui/qt/main_interface.hpp +++ b/modules/gui/qt/main_interface.hpp @@ -184,7 +184,9 @@ protected: bool b_pauseOnMinimize; bool b_maximizedView; bool b_isWindowTiled; - +#ifdef QT5_HAS_WAYLAND + bool b_hasWayland; +#endif /* States */ bool playlistVisible; ///< Is the playlist visible ? // bool videoIsActive; ///< Having a video now / THEMIM->hasV _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
