[vlc-commits] [Git][videolan/vlc][3.0.x] [3.0] Fix the playback bar is shown when the player window is inactive on Linux

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Dec 3 18:22:16 UTC 2022



Jean-Baptiste Kempf pushed to branch 3.0.x at VideoLAN / VLC


Commits:
60771fe7 by Eugene Popov at 2022-12-03T18:22:11+00:00
[3.0] Fix the playback bar is shown when the player window is inactive on Linux

- - - - -


2 changed files:

- modules/gui/qt/components/controller.cpp
- modules/gui/qt/components/controller.hpp


Changes:

=====================================
modules/gui/qt/components/controller.cpp
=====================================
@@ -858,10 +858,17 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWi
     isWideFSC = getSettings()->value( "FullScreen/wide" ).toBool();
 
     CONNECT( this, fullscreenChanged( bool ), THEMIM, changeFullscreen( bool ) );
+
+    Q_ASSERT( _parent );
+    _parent->installEventFilter( this );
 }
 
 FullscreenControllerWidget::~FullscreenControllerWidget()
 {
+    QWidget *wParent = parentWidget();
+    Q_ASSERT( wParent );
+    wParent->removeEventFilter( this );
+
     getSettings()->setValue( "FullScreen/pos", previousPosition );
     getSettings()->setValue( "FullScreen/screen", screenRes );
     getSettings()->setValue( "FullScreen/wide", isWideFSC );
@@ -1074,6 +1081,21 @@ void FullscreenControllerWidget::customEvent( QEvent *event )
     }
 }
 
+bool FullscreenControllerWidget::eventFilter( QObject *watched, QEvent *event )
+{
+    const QWidget *wParent = parentWidget();
+    Q_ASSERT( wParent );
+
+    if ( watched == wParent && event->type() == QEvent::ActivationChange )
+    {
+        /* Hide if not active */
+        if ( !wParent->isActiveWindow() )
+            hideFSC();
+    }
+
+    return AbstractController::eventFilter( watched, event );
+}
+
 /**
  * On mouse move
  * moving with FSC
@@ -1281,6 +1303,12 @@ void FullscreenControllerWidget::fullscreenChanged( vout_thread_t *p_vout,
  */
 void FullscreenControllerWidget::mouseChanged( vout_thread_t *, int i_mousex, int i_mousey )
 {
+    const QWidget *wParent = parentWidget();
+    Q_ASSERT( wParent );
+
+    /* Ignore mouse events if not active */
+    if ( !wParent->isActiveWindow() ) return;
+
     bool b_toShow;
 
     /* FIXME - multiple vout (ie multiple mouse position ?) and thread safety if multiple vout ? */


=====================================
modules/gui/qt/components/controller.hpp
=====================================
@@ -283,6 +283,8 @@ protected:
 
     void customEvent( QEvent *event ) Q_DECL_OVERRIDE;
 
+    bool eventFilter( QObject *watched, QEvent *event ) Q_DECL_OVERRIDE;
+
 private slots:
     void showFSC();
     void planHideFSC();



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/60771fe71284849d5be58b782ff11733176c6746

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/60771fe71284849d5be58b782ff11733176c6746
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list