Shane, I removed the static variables from your code because static
is not thread-safe, and one can imagine having several video output
windows launched at the same time. Also, I made your feature work
in windowed mode as well, because people kept asking how to hide the
mouse pointer.
Also, if you want to work on the XVideo extension, you are welcome ;
most of us are quite busy at the moment. Damien Lucas <nitrox@via.ecp.fr>
had offered to work on it, but he seems to be a bit lost, so you may
want to take over his job.
As for the "zoom" feature, I suggest you wait until version 4 of the
video output is done, it'll be easier to do then.
Regards,
E: jeanphi@via.ecp.fr
D: Bug fixes
E: jeanphi@via.ecp.fr
D: Bug fixes
+N: Shane Harper
+E: shanegh@optusnet.com.au
+D: SDL plugin fixes and enhancements
+
N: Gaël Hendryckx
E: jimmy@via.ecp.fr
D: IDCT and YUV transformations
N: Gaël Hendryckx
E: jimmy@via.ecp.fr
D: IDCT and YUV transformations
{
int i_width;
int i_height;
{
int i_width;
int i_height;
SDL_Surface * p_display; /* display device */
SDL_Overlay * p_overlay; /* overlay device */
SDL_Surface * p_display; /* display device */
SDL_Overlay * p_overlay; /* overlay device */
boolean_t b_fullscreen;
boolean_t b_overlay;
boolean_t b_cursor;
boolean_t b_reopen_display;
boolean_t b_fullscreen;
boolean_t b_overlay;
boolean_t b_cursor;
boolean_t b_reopen_display;
+
+ boolean_t b_cursor_autohidden;
+ mtime_t i_lastmoved;
+
Uint8 * p_sdl_buf[2]; /* Buffer information */
Uint8 * p_sdl_buf[2]; /* Buffer information */
} vout_sys_t;
/*****************************************************************************
} vout_sys_t;
/*****************************************************************************
}
p_vout->p_sys->b_cursor = 1; /* TODO should be done with a main_GetInt.. */
}
p_vout->p_sys->b_cursor = 1; /* TODO should be done with a main_GetInt.. */
+
+ p_vout->p_sys->b_cursor_autohidden = 0;
+ p_vout->p_sys->i_lastmoved = mdate();
+
p_vout->p_sys->b_fullscreen = main_GetIntVariable( VOUT_FULLSCREEN_VAR,
VOUT_FULLSCREEN_DEFAULT );
p_vout->p_sys->b_overlay = main_GetIntVariable( VOUT_OVERLAY_VAR,
p_vout->p_sys->b_fullscreen = main_GetIntVariable( VOUT_FULLSCREEN_VAR,
VOUT_FULLSCREEN_DEFAULT );
p_vout->p_sys->b_overlay = main_GetIntVariable( VOUT_OVERLAY_VAR,
static int vout_Manage( vout_thread_t *p_vout )
{
SDL_Event event; /* SDL event */
static int vout_Manage( vout_thread_t *p_vout )
{
SDL_Event event; /* SDL event */
/* Process events */
while( SDL_PollEvent(&event) )
/* Process events */
while( SDL_PollEvent(&event) )
p_vout->i_changes |= VOUT_SIZE_CHANGE;
break;
p_vout->i_changes |= VOUT_SIZE_CHANGE;
break;
+ case SDL_MOUSEMOTION:
+ if( p_vout->p_sys->b_cursor &&
+ (abs(event.motion.xrel) > 2 || abs(event.motion.yrel) > 2) )
+ {
+ if( p_vout->p_sys->b_cursor_autohidden )
+ {
+ p_vout->p_sys->b_cursor_autohidden = 0;
+ SDL_ShowCursor( 1 );
+ }
+ else
+ {
+ p_vout->p_sys->i_lastmoved = mdate();
+ }
+ }
+ break;
+
case SDL_MOUSEBUTTONUP:
switch( event.button.button )
{
case SDL_MOUSEBUTTONUP:
switch( event.button.button )
{
{
p_vout->p_sys->b_fullscreen = ! p_vout->p_sys->b_fullscreen;
{
p_vout->p_sys->b_fullscreen = ! p_vout->p_sys->b_fullscreen;
- if( p_vout->p_sys->b_fullscreen )
- {
- p_vout->p_sys->b_fullscreen = 0;
- p_vout->p_sys->b_cursor = 1;
- SDL_ShowCursor( 1 );
- }
- else
- {
- p_vout->p_sys->b_fullscreen = 1;
- p_vout->p_sys->b_cursor = 0;
- SDL_ShowCursor( 0 );
- }
-
SDL_WM_ToggleFullScreen(p_vout->p_sys->p_display);
SDL_WM_ToggleFullScreen(p_vout->p_sys->p_display);
+ p_vout->p_sys->b_cursor_autohidden = 0;
+ SDL_ShowCursor( p_vout->p_sys->b_cursor &&
+ ! p_vout->p_sys->b_cursor_autohidden );
+
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
}
/*
* Pointer change
*/
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
}
/*
* Pointer change
*/
+ if( ! p_vout->p_sys->b_cursor_autohidden &&
+ ( mdate() - p_vout->p_sys->i_lastmoved > 2000000 ) )
+ {
+ /* Hide the mouse automatically */
+ p_vout->p_sys->b_cursor_autohidden = 1;
+ SDL_ShowCursor( 0 );
+ }
+
if( p_vout->i_changes & VOUT_CURSOR_CHANGE )
{
if( p_vout->i_changes & VOUT_CURSOR_CHANGE )
{
- if( p_vout->p_sys->b_cursor )
- {
- SDL_ShowCursor( 0 );
- p_vout->p_sys->b_cursor = 0;
- }
- else
- {
- SDL_ShowCursor( 1 );
- p_vout->p_sys->b_cursor = 1;
- }
+ p_vout->p_sys->b_cursor = ! p_vout->p_sys->b_cursor;
+
+ SDL_ShowCursor( p_vout->p_sys->b_cursor &&
+ ! p_vout->p_sys->b_cursor_autohidden );
+
p_vout->i_changes &= ~VOUT_CURSOR_CHANGE;
}
p_vout->i_changes &= ~VOUT_CURSOR_CHANGE;
}
flags = SDL_ANYFORMAT | SDL_HWPALETTE;
if( p_vout->p_sys->b_fullscreen )
flags = SDL_ANYFORMAT | SDL_HWPALETTE;
if( p_vout->p_sys->b_fullscreen )
if( p_vout->b_need_render )
if( p_vout->b_need_render )
flags |= SDL_HWSURFACE | SDL_DOUBLEBUF;
flags |= SDL_HWSURFACE | SDL_DOUBLEBUF;
flags |= SDL_SWSURFACE; /* save video memory */
flags |= SDL_SWSURFACE; /* save video memory */
bpp = SDL_VideoModeOK( p_vout->p_sys->i_width,
p_vout->p_sys->i_height,
p_vout->i_screen_depth, flags );
bpp = SDL_VideoModeOK( p_vout->p_sys->i_width,
p_vout->p_sys->i_height,
p_vout->i_screen_depth, flags );
{
intf_ErrMsg( "vout error: no video mode available" );
return( 1 );
{
intf_ErrMsg( "vout error: no video mode available" );
return( 1 );
- SDL_LockSurface(p_vout->p_sys->p_display);
-
- if( p_vout->p_sys->b_fullscreen )
- SDL_ShowCursor( 0 );
- else
- SDL_ShowCursor( 1 );
+ SDL_LockSurface( p_vout->p_sys->p_display );
SDL_WM_SetCaption( VOUT_TITLE " (SDL output)",
VOUT_TITLE " (SDL output)" );
SDL_WM_SetCaption( VOUT_TITLE " (SDL output)",
VOUT_TITLE " (SDL output)" );