SetRectEmpty( &p_sys->rect_parent );
vlc_mutex_init( &p_sys->lock );
- p_sys->b_cursor_hidden = 0;
- p_sys->i_lastmoved = mdate();
- p_sys->i_mouse_hide_timeout =
- var_GetInteger(p_vout, "mouse-hide-timeout") * 1000;
-
var_Create( p_vout, "video-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
/* Set main window's size */
/*
* Pointer change
*/
- if( p_vout->b_fullscreen && !p_vout->p_sys->b_cursor_hidden &&
- (mdate() - p_vout->p_sys->i_lastmoved) >
- p_vout->p_sys->i_mouse_hide_timeout )
- {
- POINT point;
- HWND hwnd;
-
- /* Hide the cursor only if it is inside our window */
- GetCursorPos( &point );
- hwnd = WindowFromPoint(point);
- if( hwnd == p_vout->p_sys->hwnd || hwnd == p_vout->p_sys->hvideownd )
- {
- PostMessage( p_vout->p_sys->hwnd, WM_VLC_HIDE_MOUSE, 0, 0 );
- }
- else
- {
- p_vout->p_sys->i_lastmoved = mdate();
- }
- }
+ EventThreadMouseAutoHide( p_vout->p_sys->p_event );
/*
* "Always on top" status change
/*
* Pointer change
*/
- if( p_vout->b_fullscreen && !p_vout->p_sys->b_cursor_hidden &&
- (mdate() - p_vout->p_sys->i_lastmoved) >
- p_vout->p_sys->i_mouse_hide_timeout )
- {
- POINT point;
- HWND hwnd;
-
- /* Hide the cursor only if it is inside our window */
- GetCursorPos( &point );
- hwnd = WindowFromPoint(point);
- if( hwnd == p_vout->p_sys->hwnd || hwnd == p_vout->p_sys->hvideownd )
- {
- PostMessage( p_vout->p_sys->hwnd, WM_VLC_HIDE_MOUSE, 0, 0 );
- }
- else
- {
- p_vout->p_sys->i_lastmoved = mdate();
- }
- }
+ EventThreadMouseAutoHide( p_vout->p_sys->p_event );
/*
* "Always on top" status change
(abs(mouse_pos.y - old_mouse_pos.y)) > 2 ) )
{
GetCursorPos( &old_mouse_pos );
- p_event->p_vout->p_sys->i_lastmoved = mdate();
+ p_event->i_lastmoved = mdate();
- if( p_event->p_vout->p_sys->b_cursor_hidden )
+ if( p_event->b_cursor_hidden )
{
- p_event->p_vout->p_sys->b_cursor_hidden = 0;
+ p_event->b_cursor_hidden = 0;
ShowCursor( TRUE );
}
}
break;
case WM_VLC_HIDE_MOUSE:
- if( p_event->p_vout->p_sys->b_cursor_hidden ) break;
- p_event->p_vout->p_sys->b_cursor_hidden = true;
+ if( p_event->b_cursor_hidden ) break;
+ p_event->b_cursor_hidden = true;
GetCursorPos( &old_mouse_pos );
ShowCursor( FALSE );
break;
case WM_VLC_SHOW_MOUSE:
- if( !p_event->p_vout->p_sys->b_cursor_hidden ) break;
- p_event->p_vout->p_sys->b_cursor_hidden = false;
+ if( !p_event->b_cursor_hidden ) break;
+ p_event->b_cursor_hidden = false;
GetCursorPos( &old_mouse_pos );
ShowCursor( TRUE );
break;
return 0;
}
+void EventThreadMouseAutoHide( event_thread_t *p_event )
+{
+ vout_thread_t *p_vout = p_event->p_vout;
+
+ if( p_vout->b_fullscreen &&
+ !p_event->b_cursor_hidden &&
+ (mdate() - p_event->i_lastmoved) > p_event->i_mouse_hide_timeout )
+ {
+ /* Hide the cursor only if it is inside our window */
+ POINT point;
+ GetCursorPos( &point );
+
+ HWND hwnd = WindowFromPoint(point);
+ if( hwnd == p_vout->p_sys->hwnd || hwnd == p_vout->p_sys->hvideownd )
+ {
+ PostMessage( p_vout->p_sys->hwnd, WM_VLC_HIDE_MOUSE, 0, 0 );
+ }
+ else
+ {
+ p_event->i_lastmoved = mdate();
+ }
+ }
+}
+
event_thread_t *EventThreadCreate( vout_thread_t *p_vout )
{
/* Create the Vout EventThread, this thread is created by us to isolate
p_event->p_vout = p_vout;
vlc_mutex_init( &p_event->lock );
vlc_cond_init( &p_event->wait );
+
+ p_event->b_cursor_hidden = false;
+ p_event->i_lastmoved = mdate();
+ p_event->i_mouse_hide_timeout =
+ var_GetInteger(p_vout, "mouse-hide-timeout") * 1000;
return p_event;
}
/*
* Pointer change
*/
- if( p_vout->b_fullscreen && !p_vout->p_sys->b_cursor_hidden &&
- (mdate() - p_vout->p_sys->i_lastmoved) >
- p_vout->p_sys->i_mouse_hide_timeout )
- {
- POINT point;
- HWND hwnd;
-
- /* Hide the cursor only if it is inside our window */
- GetCursorPos( &point );
- hwnd = WindowFromPoint(point);
- if( hwnd == p_vout->p_sys->hwnd || hwnd == p_vout->p_sys->hvideownd )
- {
- PostMessage( p_vout->p_sys->hwnd, WM_VLC_HIDE_MOUSE, 0, 0 );
- }
- else
- {
- p_vout->p_sys->i_lastmoved = mdate();
- }
- }
+ EventThreadMouseAutoHide( p_vout->p_sys->p_event );
/*
* "Always on top" status change
bool b_done;
bool b_error;
+ /* Mouse */
+ volatile bool b_cursor_hidden;
+ volatile mtime_t i_lastmoved;
+ mtime_t i_mouse_hide_timeout;
+
} event_thread_t;
#ifdef MODULE_NAME_IS_wingapi
volatile uint16_t i_changes; /* changes made to the video display */
- /* Mouse */
- volatile bool b_cursor_hidden;
- volatile mtime_t i_lastmoved;
- mtime_t i_mouse_hide_timeout;
-
/* Misc */
bool b_on_top_change;
int EventThreadStart( event_thread_t * );
void EventThreadStop( event_thread_t * );
+void EventThreadMouseAutoHide( event_thread_t * );
+
/*****************************************************************************
* Prototypes from common.c
*****************************************************************************/
/*
* Pointer change
*/
- if( p_vout->b_fullscreen && !p_vout->p_sys->b_cursor_hidden &&
- (mdate() - p_vout->p_sys->i_lastmoved) >
- p_vout->p_sys->i_mouse_hide_timeout )
- {
- POINT point;
- HWND hwnd;
-
- /* Hide the cursor only if it is inside our window */
- GetCursorPos( &point );
- hwnd = WindowFromPoint(point);
- if( hwnd == p_vout->p_sys->hwnd || hwnd == p_vout->p_sys->hvideownd )
- {
- PostMessage( p_vout->p_sys->hwnd, WM_VLC_HIDE_MOUSE, 0, 0 );
- }
- else
- {
- p_vout->p_sys->i_lastmoved = mdate();
- }
- }
+ EventThreadMouseAutoHide( p_vout->p_sys->p_event );
/*
* "Always on top" status change