Commit 37fef4bd authored by Ludovic Fauvet's avatar Ludovic Fauvet Committed by Jean-Baptiste Kempf

Qt: fix multi-screens weirdness caused by the dockable FSC

Close #5668
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent dbd65161
...@@ -723,8 +723,8 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWi ...@@ -723,8 +723,8 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWi
vout.clear(); vout.clear();
setWindowFlags( Qt::ToolTip ); setWindowFlags( Qt::ToolTip );
setMinimumWidth( 800 ); setMinimumWidth( FSC_WIDTH );
setMinimumHeight( 72 ); setMinimumHeight( FSC_HEIGHT );
isWideFSC = false; isWideFSC = false;
setFrameShape( QFrame::StyledPanel ); setFrameShape( QFrame::StyledPanel );
...@@ -771,14 +771,12 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWi ...@@ -771,14 +771,12 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWi
if( rect == rect1 && rect.contains( pos1, true ) ) if( rect == rect1 && rect.contains( pos1, true ) )
{ {
move( pos1 ); move( pos1 );
i_screennumber = number;
screenRes = QApplication::desktop()->screenGeometry(number); screenRes = QApplication::desktop()->screenGeometry(number);
} }
else else
{ {
centerFSC( number ); centerFSC( number );
} }
} }
FullscreenControllerWidget::~FullscreenControllerWidget() FullscreenControllerWidget::~FullscreenControllerWidget()
...@@ -800,8 +798,6 @@ void FullscreenControllerWidget::centerFSC( int number ) ...@@ -800,8 +798,6 @@ void FullscreenControllerWidget::centerFSC( int number )
QPoint pos = QPoint( screenRes.x() + (screenRes.width() / 2) - (sizeHint().width() / 2), QPoint pos = QPoint( screenRes.x() + (screenRes.width() / 2) - (sizeHint().width() / 2),
screenRes.y() + screenRes.height() - sizeHint().height()); screenRes.y() + screenRes.height() - sizeHint().height());
move( pos ); move( pos );
i_screennumber = number;
} }
/** /**
...@@ -809,17 +805,25 @@ void FullscreenControllerWidget::centerFSC( int number ) ...@@ -809,17 +805,25 @@ void FullscreenControllerWidget::centerFSC( int number )
*/ */
void FullscreenControllerWidget::showFSC() void FullscreenControllerWidget::showFSC()
{ {
adjustSize();
int number = QApplication::desktop()->screenNumber( p_intf->p_sys->p_mi ); int number = QApplication::desktop()->screenNumber( p_intf->p_sys->p_mi );
if( number != i_screennumber || if( number != i_screennumber ||
screenRes != QApplication::desktop()->screenGeometry(number) ) screenRes != QApplication::desktop()->screenGeometry(number) )
{ {
centerFSC( number ); i_screennumber = number;
msg_Dbg( p_intf, "Recentering the Fullscreen Controller" ); if( !isWideFSC )
{
centerFSC( number );
msg_Dbg( p_intf, "Recentering the Fullscreen Controller" );
}
else
{
updateFullwidthGeometry( number );
}
} }
adjustSize();
#if HAVE_TRANSPARENCY #if HAVE_TRANSPARENCY
setWindowOpacity( f_opacity ); setWindowOpacity( f_opacity );
#endif #endif
...@@ -882,19 +886,30 @@ void FullscreenControllerWidget::slowHideFSC() ...@@ -882,19 +886,30 @@ void FullscreenControllerWidget::slowHideFSC()
#endif #endif
} }
void FullscreenControllerWidget::updateFullwidthGeometry( int number )
{
QRect screenGeometry = QApplication::desktop()->screenGeometry( i_screennumber );
setMinimumWidth( screenGeometry.width() );
setGeometry( screenGeometry.x(), screenGeometry.y() + screenGeometry.height() - FSC_HEIGHT, screenGeometry.width(), FSC_HEIGHT );
}
void FullscreenControllerWidget::toggleFullwidth() { void FullscreenControllerWidget::toggleFullwidth() {
int fswidth = QApplication::desktop()->screenGeometry( var_InheritInteger( p_intf, "qt-fullscreen-screennumber" ) ).width();
int fsheight = QApplication::desktop()->screenGeometry( var_InheritInteger( p_intf, "qt-fullscreen-screennumber" ) ).height();
if( !isWideFSC ) { if( !isWideFSC ) {
/* Dock at the bottom of the screen */ /* Dock at the bottom of the screen */
setMinimumWidth( fswidth ); updateFullwidthGeometry( i_screennumber );
setGeometry(0, fsheight-72, fswidth, 72);
} else { } else {
/* Restore half-bar and re-centre */ /* Restore half-bar and re-centre */
setMinimumWidth( 600 ); setMinimumWidth( FSC_WIDTH );
setGeometry(fswidth/2 - 300, fsheight-72, 600, 72); centerFSC( i_screennumber );
} }
adjustSize();
#ifdef Q_WS_X11
// Update the mask to reflect the geometry change
setMask( QRegion( 0, 0, width(), height() ) );
#endif
/* Toggle isWideFSC switch */ /* Toggle isWideFSC switch */
isWideFSC = !isWideFSC; isWideFSC = !isWideFSC;
} }
......
...@@ -241,6 +241,11 @@ signals: ...@@ -241,6 +241,11 @@ signals:
/* Default value of opacity for FS controller */ /* Default value of opacity for FS controller */
#define DEFAULT_OPACITY 0.70 #define DEFAULT_OPACITY 0.70
/* Used to restore the minimum width after a full-width switch */
#define FSC_WIDTH 800
#define FSC_HEIGHT 72
/*********************************** /***********************************
* Fullscreen controller * Fullscreen controller
***********************************/ ***********************************/
...@@ -255,6 +260,7 @@ public: ...@@ -255,6 +260,7 @@ public:
void fullscreenChanged( vout_thread_t *, bool b_fs, int i_timeout ); void fullscreenChanged( vout_thread_t *, bool b_fs, int i_timeout );
void mouseChanged( vout_thread_t *, int i_mousex, int i_mousey ); void mouseChanged( vout_thread_t *, int i_mousex, int i_mousey );
void toggleFullwidth(); void toggleFullwidth();
void updateFullwidthGeometry( int number );
signals: signals:
void keyPressed( QKeyEvent * ); void keyPressed( QKeyEvent * );
......
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