b_slow_hide_begin(false), i_slow_hide_timeout(1),
b_fullscreen( false ), i_hide_timeout( 1 ), p_vout(NULL)
{
+ i_mouse_last_move_x = -1;
+ i_mouse_last_move_y = -1;
+
setWindowFlags( Qt::ToolTip );
setFrameShape( QFrame::StyledPanel );
{
adjustSize();
#ifdef WIN32TRICK
- msg_Dbg( p_intf, "showFSC() was called" );
// after quiting and going to fs, we need to call show()
if( isHidden() )
show();
void FullscreenControllerWidget::hideFSC()
{
#ifdef WIN32TRICK
- msg_Dbg( p_intf, "hideFSC() was called" );
b_fscHidden = true;
setWindowOpacity( 0.0 ); // simulate hidding
#else
else
{
#ifdef WIN32TRICK
- msg_Dbg( p_intf, "slowHideFSC() was called" );
if ( windowOpacity() > 0.0 && !b_fscHidden )
#else
if ( windowOpacity() > 0.0 )
{
bool b_fs;
-#ifndef NDEBUG
- msg_Dbg( p_intf, "New FSC event: %i", event->type() );
-#endif
-
switch( event->type() )
{
case FullscreenControlToggle_Type:
b_fs = b_fullscreen;
vlc_mutex_unlock( &lock );
- if( b_fs ) // FIXME I am not sure about that one
+#ifdef WIN32TRICK
+ if( b_fs && b_fscHidden ) // FIXME I am not sure about that one
+#else
+ if( b_fs && !isVisible() ) // FIXME I am not sure about that one
+#endif
showFSC();
break;
case FullscreenControlHide_Type:
}
/* */
-static int FullscreenControllerWidgetFullscreenChanged( vlc_object_t *vlc_object, const char *variable,
- vlc_value_t old_val, vlc_value_t new_val,
- void *data )
+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;
+ msg_Dbg( p_vout, "Qt4: Fullscreen state changed" );
FullscreenControllerWidget *p_fs = (FullscreenControllerWidget *)data;
- p_fs->fullscreenChanged( p_vout, new_val.b_bool, var_GetInteger( p_vout, "mouse-hide-timeout" ) );
+ p_fs->fullscreenChanged( p_vout, new_val.b_bool,
+ var_GetInteger( p_vout, "mouse-hide-timeout" ) );
return VLC_SUCCESS;
}
{
FullscreenControllerWidget *p_fs = (FullscreenControllerWidget *)data;
- /* Show event */
- IMEvent *eShow = new IMEvent( FullscreenControlShow_Type, 0 );
- QApplication::postEvent( p_fs, static_cast<QEvent *>(eShow) );
+ int i_mousex, i_mousey;
+ bool b_toShow = false;
- /* Plan hide event */
- IMEvent *eHide = new IMEvent( FullscreenControlPlanHide_Type, 0 );
- QApplication::postEvent( p_fs, static_cast<QEvent *>(eHide) );
+ /* Get the value from the Vout - Trust the vout more than Qt */
+ i_mousex = var_GetInteger( p_fs->p_vout, "mouse-x" );
+ i_mousey = var_GetInteger( p_fs->p_vout, "mouse-y" );
+
+ /* First time */
+ if( p_fs->i_mouse_last_move_x == -1 || p_fs->i_mouse_last_move_y == -1 )
+ {
+ p_fs->i_mouse_last_move_x = i_mousex;
+ p_fs->i_mouse_last_move_y = i_mousey;
+ b_toShow = true;
+ }
+ /* All other times */
+ else
+ {
+ /* Trigger only if move > 3 px dans une direction */
+ if( abs( p_fs->i_mouse_last_move_x - i_mousex ) > 2 ||
+ abs( p_fs->i_mouse_last_move_y - i_mousey ) > 2 )
+ {
+ b_toShow = true;
+ p_fs->i_mouse_last_move_x = i_mousex;
+ p_fs->i_mouse_last_move_y = i_mousey;
+ }
+ }
+
+ if( b_toShow )
+ {
+ /* 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;
}
p_vout = p_nvout;
+ msg_Dbg( p_vout, "Qt FS: Attaching 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" ) );
+
+ 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 );
}
/**
{
if( p_vout )
{
- var_DelCallback( p_vout, "fullscreen", FullscreenControllerWidgetFullscreenChanged, this );
+ msg_Dbg( p_vout, "Qt FS: Detaching 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 )
+void FullscreenControllerWidget::fullscreenChanged( vout_thread_t *p_vout,
+ bool b_fs, int i_timeout )
{
+ msg_Dbg( p_vout, "Qt: Entering Fullscreen" );
+
vlc_mutex_lock( &lock );
+ /* Entering fullscreen, register callback */
if( b_fs && !b_fullscreen )
{
b_fullscreen = true;
i_hide_timeout = i_timeout;
- var_AddCallback( p_vout, "mouse-moved", FullscreenControllerWidgetMouseMoved, this );
+ var_AddCallback( p_vout, "mouse-moved",
+ FullscreenControllerWidgetMouseMoved, this );
}
+ /* Quitting fullscreen, unregistering callback */
else if( !b_fs && b_fullscreen )
{
b_fullscreen = false;
i_hide_timeout = i_timeout;
- var_DelCallback( p_vout, "mouse-moved", FullscreenControllerWidgetMouseMoved, this );
+ var_DelCallback( p_vout, "mouse-moved",
+ FullscreenControllerWidgetMouseMoved, this );
/* Force fs hidding */
IMEvent *eHide = new IMEvent( FullscreenControlHide_Type, 0 );