Commit a7018fc3 authored by Pierre Lamot's avatar Pierre Lamot Committed by Jean-Baptiste Kempf

qt: fix setScreen might crash on wayland when entering fullscreen

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
(cherry picked from commit 24b436c8)
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent d19cf4d5
......@@ -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 ) )
......
......@@ -318,6 +318,10 @@ private:
bool isWideFSC;
int i_sensitivity;
#ifdef QT5_HAS_WAYLAND
bool b_hasWayland;
#endif
};
#endif
......@@ -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 );
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment