diff --git a/modules/gui/qt/components/controller.cpp b/modules/gui/qt/components/controller.cpp index 0bbb07942ae6b3f0c8491ce1fd807e3ebf5d3db5..382be37dccd0fc9dcf9b395b906676657b58e28e 100644 --- a/modules/gui/qt/components/controller.cpp +++ b/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 ? */ diff --git a/modules/gui/qt/components/controller.hpp b/modules/gui/qt/components/controller.hpp index dc8bacce688ba82f47448f6e2892d0c701b726f1..ab7b29f194a52ae7369eba02801f7be020c17ec4 100644 --- a/modules/gui/qt/components/controller.hpp +++ b/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();