+ planHideFSC();
+
+ b_mouse_over = false;
+}
+
+/**
+ * When you get pressed key, send it to video output
+ * FIXME: clearing focus by clearFocus() to not getting
+ * key press events didnt work
+ */
+void FullscreenControllerWidget::keyPressEvent( QKeyEvent *event )
+{
+ int i_vlck = qtEventToVLCKey( event );
+ if( i_vlck > 0 )
+ {
+ var_SetInteger( p_intf->p_libvlc, "key-pressed", i_vlck );
+ event->accept();
+ }
+ else
+ event->ignore();
+}
+
+/* */
+static int FullscreenControllerWidgetFullscreenChanged( vlc_object_t *vlc_object, const char *variable,
+ vlc_value_t old_val, vlc_value_t new_val,
+ void *data )
+{
+ vout_thread_t *p_vout = (vout_thread_t *) vlc_object;
+ FullscreenControllerWidget *p_fs = (FullscreenControllerWidget *)data;
+
+ p_fs->fullscreenChanged( p_vout, new_val.b_bool, var_GetInteger( p_vout, "mouse-hide-timeout" ) );
+
+ return VLC_SUCCESS;
+}
+/* */
+static int FullscreenControllerWidgetMouseMoved( vlc_object_t *vlc_object, const char *variable,
+ vlc_value_t old_val, vlc_value_t new_val,
+ void *data )
+{
+ FullscreenControllerWidget *p_fs = (FullscreenControllerWidget *)data;
+
+ /* Show event */
+ IMEvent *eShow = new IMEvent( FullscreenControlShow_Type, 0 );
+ QApplication::postEvent( p_fs, static_cast<QEvent *>(eShow) );
+
+ /* Plan hide event */
+ IMEvent *eHide = new IMEvent( FullscreenControlPlanHide_Type, 0 );
+ QApplication::postEvent( p_fs, static_cast<QEvent *>(eHide) );
+
+ return VLC_SUCCESS;
+}
+
+
+/**
+ * It is called when video start
+ */
+void FullscreenControllerWidget::attachVout( vout_thread_t *p_vout )
+{
+ assert( p_vout );
+
+ vlc_mutex_lock( &lock );
+ var_AddCallback( p_vout, "fullscreen", FullscreenControllerWidgetFullscreenChanged, this ); /* I miss a add and fire */
+ fullscreenChanged( p_vout, var_GetBool( p_vout, "fullscreen" ), var_GetInteger( p_vout, "mouse-hide-timeout" ) );
+ vlc_mutex_unlock( &lock );
+}
+/**
+ * It is called after turn off video.
+ */
+void FullscreenControllerWidget::detachVout( vout_thread_t *p_vout )
+{
+ assert( p_vout );
+
+ var_DelCallback( p_vout, "fullscreen", FullscreenControllerWidgetFullscreenChanged, this );
+ vlc_mutex_lock( &lock );
+ fullscreenChanged( p_vout, false, 0 );
+ vlc_mutex_unlock( &lock );
+}
+
+/**
+ * Register and unregister callback for mouse moving
+ */
+void FullscreenControllerWidget::fullscreenChanged( vout_thread_t *p_vout, bool b_fs, int i_timeout )
+{
+ vlc_mutex_lock( &lock );
+ if( b_fs && !b_fullscreen )
+ {
+ b_fullscreen = true;
+ i_hide_timeout = i_timeout;
+ var_AddCallback( p_vout, "mouse-moved", FullscreenControllerWidgetMouseMoved, this );
+ }
+ else if( !b_fs && b_fullscreen )
+ {
+ b_fullscreen = false;
+ i_hide_timeout = i_timeout;
+ var_DelCallback( p_vout, "mouse-moved", FullscreenControllerWidgetMouseMoved, this );
+
+ /* Force fs hidding */
+ IMEvent *eHide = new IMEvent( FullscreenControlHide_Type, 0 );
+ QApplication::postEvent( this, static_cast<QEvent *>(eHide) );
+ }
+ vlc_mutex_unlock( &lock );