Commit 86614936 authored by Gildas Bazin's avatar Gildas Bazin

* video plugins that don't handle rescaling themselves have to let the
  video_output thread know about resizing events (with VOUT_SIZE_CHANGE event).
  (this part needs some clean-up but it is basically working for the X11 and
   SDL plugins).

* fixed fullscreen for the SDL plugin.

* xmga and sdl now switch to fullscreen on double-click.
parent be95ddf5
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* xmga.c : X11 MGA plugin for vlc * xmga.c : X11 MGA plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: xmga.c,v 1.12 2002/04/19 13:56:11 sam Exp $ * $Id: xmga.c,v 1.13 2002/05/06 21:05:26 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -188,6 +188,7 @@ typedef struct vout_sys_s ...@@ -188,6 +188,7 @@ typedef struct vout_sys_s
boolean_t b_mouse_pointer_visible; boolean_t b_mouse_pointer_visible;
mtime_t i_time_mouse_last_moved; /* used to auto-hide pointer*/ mtime_t i_time_mouse_last_moved; /* used to auto-hide pointer*/
Cursor blank_cursor; /* the hidden cursor */ Cursor blank_cursor; /* the hidden cursor */
mtime_t i_time_button_last_pressed; /* to track dbl-clicks */
Pixmap cursor_pixmap; Pixmap cursor_pixmap;
} vout_sys_t; } vout_sys_t;
...@@ -599,10 +600,17 @@ static int vout_Manage( vout_thread_t *p_vout ) ...@@ -599,10 +600,17 @@ static int vout_Manage( vout_thread_t *p_vout )
{ {
case Button1: case Button1:
/* In this part we will eventually manage /* In this part we will eventually manage
* clicks for DVD navigation for instance. For the * clicks for DVD navigation for instance. */
* moment just pause the stream. */
input_SetStatus( p_input_bank->pp_input[0], /* detect double-clicks */
INPUT_STATUS_PAUSE ); if( ( ((XButtonEvent *)&xevent)->time -
p_vout->p_sys->i_time_button_last_pressed ) < 300 )
{
p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
}
p_vout->p_sys->i_time_button_last_pressed =
((XButtonEvent *)&xevent)->time;
break; break;
case Button4: case Button4:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_sdl.c: SDL video output display method * vout_sdl.c: SDL video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: vout_sdl.c,v 1.88 2002/04/28 11:56:13 sam Exp $ * $Id: vout_sdl.c,v 1.89 2002/05/06 21:05:26 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Pierre Baillet <oct@zoy.org> * Pierre Baillet <oct@zoy.org>
...@@ -74,6 +74,7 @@ typedef struct vout_sys_s ...@@ -74,6 +74,7 @@ typedef struct vout_sys_s
boolean_t b_cursor; boolean_t b_cursor;
boolean_t b_cursor_autohidden; boolean_t b_cursor_autohidden;
mtime_t i_lastmoved; mtime_t i_lastmoved;
mtime_t i_lastpressed; /* to track dbl-clicks */
} vout_sys_t; } vout_sys_t;
...@@ -209,10 +210,6 @@ static int vout_Create( vout_thread_t *p_vout ) ...@@ -209,10 +210,6 @@ static int vout_Create( vout_thread_t *p_vout )
p_vout->p_sys->b_cursor_autohidden = 0; p_vout->p_sys->b_cursor_autohidden = 0;
p_vout->p_sys->i_lastmoved = mdate(); p_vout->p_sys->i_lastmoved = mdate();
/* Set main window's size */
p_vout->p_sys->i_width = p_vout->i_window_width;
p_vout->p_sys->i_height = p_vout->i_window_height;
if( OpenDisplay( p_vout ) ) if( OpenDisplay( p_vout ) )
{ {
intf_ErrMsg( "vout error: can't set up SDL (%s)", SDL_GetError() ); intf_ErrMsg( "vout error: can't set up SDL (%s)", SDL_GetError() );
...@@ -244,9 +241,9 @@ static int vout_Init( vout_thread_t *p_vout ) ...@@ -244,9 +241,9 @@ static int vout_Init( vout_thread_t *p_vout )
/* All we have is an RGB image with square pixels */ /* All we have is an RGB image with square pixels */
p_vout->output.i_width = p_vout->p_sys->i_width; p_vout->output.i_width = p_vout->p_sys->i_width;
p_vout->output.i_height = p_vout->p_sys->i_height; p_vout->output.i_height = p_vout->p_sys->i_height;
p_vout->output.i_aspect = p_vout->p_sys->i_width p_vout->output.i_aspect = p_vout->output.i_width
* VOUT_ASPECT_FACTOR * VOUT_ASPECT_FACTOR
/ p_vout->p_sys->i_height; / p_vout->output.i_height;
} }
else else
{ {
...@@ -347,10 +344,10 @@ static int vout_Manage( vout_thread_t *p_vout ) ...@@ -347,10 +344,10 @@ static int vout_Manage( vout_thread_t *p_vout )
switch( event.type ) switch( event.type )
{ {
case SDL_VIDEORESIZE: /* Resizing of window */ case SDL_VIDEORESIZE: /* Resizing of window */
p_vout->p_sys->i_width = event.resize.w; /* Update dimensions */
p_vout->p_sys->i_height = event.resize.h; p_vout->i_changes |= VOUT_SIZE_CHANGE;
CloseDisplay( p_vout ); p_vout->i_window_width = p_vout->p_sys->i_width = event.resize.w;
OpenDisplay( p_vout ); p_vout->i_window_height = p_vout->p_sys->i_height = event.resize.h;
break; break;
case SDL_MOUSEMOTION: case SDL_MOUSEMOTION:
...@@ -383,10 +380,13 @@ static int vout_Manage( vout_thread_t *p_vout ) ...@@ -383,10 +380,13 @@ static int vout_Manage( vout_thread_t *p_vout )
{ {
case SDL_BUTTON_LEFT: case SDL_BUTTON_LEFT:
/* In this part we will eventually manage /* In this part we will eventually manage
* clicks for DVD navigation for instance. For the * clicks for DVD navigation for instance. */
* moment just pause the stream. */
input_SetStatus( p_input_bank->pp_input[0], /* detect double-clicks */
INPUT_STATUS_PAUSE ); if( ( mdate() - p_vout->p_sys->i_lastpressed ) < 300000 )
p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
p_vout->p_sys->i_lastpressed = mdate();
break; break;
case 4: case 4:
...@@ -492,13 +492,31 @@ static int vout_Manage( vout_thread_t *p_vout ) ...@@ -492,13 +492,31 @@ static int vout_Manage( vout_thread_t *p_vout )
{ {
p_vout->b_fullscreen = ! p_vout->b_fullscreen; p_vout->b_fullscreen = ! p_vout->b_fullscreen;
SDL_WM_ToggleFullScreen(p_vout->p_sys->p_display);
p_vout->p_sys->b_cursor_autohidden = 0; p_vout->p_sys->b_cursor_autohidden = 0;
SDL_ShowCursor( p_vout->p_sys->b_cursor && SDL_ShowCursor( p_vout->p_sys->b_cursor &&
! p_vout->p_sys->b_cursor_autohidden ); ! p_vout->p_sys->b_cursor_autohidden );
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE; p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
p_vout->i_changes |= VOUT_SIZE_CHANGE;
}
/*
* Size change
*/
if( p_vout->i_changes & VOUT_SIZE_CHANGE )
{
intf_WarnMsg( 3, "vout: video display resized (%dx%d)",
p_vout->p_sys->i_width,
p_vout->p_sys->i_height );
CloseDisplay( p_vout );
OpenDisplay( p_vout );
/* We don't need to signal the vout thread about the size change if
* we can handle rescaling ourselves */
if( p_vout->p_sys->p_overlay != NULL )
p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
} }
/* Pointer change */ /* Pointer change */
...@@ -565,6 +583,12 @@ static int OpenDisplay( vout_thread_t *p_vout ) ...@@ -565,6 +583,12 @@ static int OpenDisplay( vout_thread_t *p_vout )
Uint32 i_flags; Uint32 i_flags;
int i_bpp; int i_bpp;
/* Set main window's size */
p_vout->p_sys->i_width = p_vout->b_fullscreen ? p_vout->render.i_width :
p_vout->i_window_width;
p_vout->p_sys->i_height = p_vout->b_fullscreen ? p_vout->render.i_height :
p_vout->i_window_height;
/* Initialize flags and cursor */ /* Initialize flags and cursor */
i_flags = SDL_ANYFORMAT | SDL_HWPALETTE | SDL_HWSURFACE | SDL_DOUBLEBUF; i_flags = SDL_ANYFORMAT | SDL_HWPALETTE | SDL_HWSURFACE | SDL_DOUBLEBUF;
i_flags |= p_vout->b_fullscreen ? SDL_FULLSCREEN : SDL_RESIZABLE; i_flags |= p_vout->b_fullscreen ? SDL_FULLSCREEN : SDL_RESIZABLE;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* xcommon.c: Functions common to the X11 and XVideo plugins * xcommon.c: Functions common to the X11 and XVideo plugins
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: xcommon.c,v 1.30 2002/05/05 08:25:15 gbazin Exp $ * $Id: xcommon.c,v 1.31 2002/05/06 21:05:26 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -585,7 +585,6 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -585,7 +585,6 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
static int vout_Manage( vout_thread_t *p_vout ) static int vout_Manage( vout_thread_t *p_vout )
{ {
XEvent xevent; /* X11 event */ XEvent xevent; /* X11 event */
boolean_t b_resized; /* window has been resized */
char i_key; /* ISO Latin-1 key */ char i_key; /* ISO Latin-1 key */
KeySym x_key_symbol; KeySym x_key_symbol;
...@@ -594,7 +593,6 @@ static int vout_Manage( vout_thread_t *p_vout ) ...@@ -594,7 +593,6 @@ static int vout_Manage( vout_thread_t *p_vout )
* window is mapped (and if the display is useful), and ClientMessages * window is mapped (and if the display is useful), and ClientMessages
* to intercept window destruction requests */ * to intercept window destruction requests */
b_resized = 0;
while( XCheckWindowEvent( p_vout->p_sys->p_display, p_vout->p_sys->window, while( XCheckWindowEvent( p_vout->p_sys->p_display, p_vout->p_sys->window,
StructureNotifyMask | KeyPressMask | StructureNotifyMask | KeyPressMask |
ButtonPressMask | ButtonReleaseMask | ButtonPressMask | ButtonReleaseMask |
...@@ -608,7 +606,6 @@ static int vout_Manage( vout_thread_t *p_vout ) ...@@ -608,7 +606,6 @@ static int vout_Manage( vout_thread_t *p_vout )
|| (xevent.xconfigure.height != p_vout->p_sys->i_height) ) || (xevent.xconfigure.height != p_vout->p_sys->i_height) )
{ {
/* Update dimensions */ /* Update dimensions */
b_resized = 1;
p_vout->i_changes |= VOUT_SIZE_CHANGE; p_vout->i_changes |= VOUT_SIZE_CHANGE;
p_vout->p_sys->i_width = xevent.xconfigure.width; p_vout->p_sys->i_width = xevent.xconfigure.width;
p_vout->p_sys->i_height = xevent.xconfigure.height; p_vout->p_sys->i_height = xevent.xconfigure.height;
...@@ -734,9 +731,7 @@ static int vout_Manage( vout_thread_t *p_vout ) ...@@ -734,9 +731,7 @@ static int vout_Manage( vout_thread_t *p_vout )
/* detect double-clicks */ /* detect double-clicks */
if( ( ((XButtonEvent *)&xevent)->time - if( ( ((XButtonEvent *)&xevent)->time -
p_vout->p_sys->i_time_button_last_pressed ) < 300 ) p_vout->p_sys->i_time_button_last_pressed ) < 300 )
{ p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
}
p_vout->p_sys->i_time_button_last_pressed = p_vout->p_sys->i_time_button_last_pressed =
((XButtonEvent *)&xevent)->time; ((XButtonEvent *)&xevent)->time;
...@@ -847,23 +842,9 @@ static int vout_Manage( vout_thread_t *p_vout ) ...@@ -847,23 +842,9 @@ static int vout_Manage( vout_thread_t *p_vout )
p_vout->p_sys->i_height ); p_vout->p_sys->i_height );
#ifdef MODULE_NAME_IS_x11 #ifdef MODULE_NAME_IS_x11
/* We need to signal the vout thread about the size change because it
/* Destroy XImages to change their size */ * is doing the rescaling */
vout_End( p_vout ); p_vout->i_changes |= VOUT_SIZE_CHANGE;
for( i_x = 0; i_x < I_OUTPUTPICTURES; i_x++ )
p_vout->p_picture[ i_x ].i_status = FREE_PICTURE;
/* Recreate XImages. If SysInit failed, the thread can't go on. */
if( vout_Init( p_vout ) )
{
intf_ErrMsg( "vout error: cannot resize display" );
return( 1 );
}
/* Need to reinitialise the chroma plugin */
p_vout->chroma.pf_end( p_vout );
p_vout->chroma.pf_init( p_vout );
#endif #endif
vout_PlacePicture( p_vout, p_vout->p_sys->i_width, vout_PlacePicture( p_vout, p_vout->p_sys->i_width,
...@@ -2255,4 +2236,3 @@ static void SetPalette( vout_thread_t *p_vout, u16 *red, u16 *green, u16 *blue ) ...@@ -2255,4 +2236,3 @@ static void SetPalette( vout_thread_t *p_vout, u16 *red, u16 *green, u16 *blue )
p_vout->p_sys->colormap, p_colors, 255 ); p_vout->p_sys->colormap, p_colors, 255 );
} }
#endif #endif
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread. * thread, and destroy a previously oppened video output thread.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.174 2002/05/05 08:25:15 gbazin Exp $ * $Id: video_output.c,v 1.175 2002/05/06 21:05:26 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -661,11 +661,39 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -661,11 +661,39 @@ static void RunThread( vout_thread_t *p_vout)
*/ */
if( p_vout->pf_manage( p_vout ) ) if( p_vout->pf_manage( p_vout ) )
{ {
/* A fatal error occured, and the thread must terminate immediately, /* A fatal error occured, and the thread must terminate
* without displaying anything - setting b_error to 1 causes the * immediately, without displaying anything - setting b_error to 1
* immediate end of the main while() loop. */ * causes the immediate end of the main while() loop. */
p_vout->b_error = 1; p_vout->b_error = 1;
} }
if( p_vout->i_changes & VOUT_SIZE_CHANGE )
{
/* this must only happen when the vout plugin is incapable of
* rescaling the picture itself. In this case we need to destroy
* the current picture buffers and recreate new ones with the right
* dimensions */
int i;
p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
p_vout->pf_end( p_vout );
for( i = 0; i < I_OUTPUTPICTURES; i++ )
p_vout->p_picture[ i ].i_status = FREE_PICTURE;
I_OUTPUTPICTURES = 0;
if( p_vout->pf_init( p_vout ) )
{
intf_ErrMsg( "vout error: cannot resize display" );
/* FixMe: p_vout->pf_end will be called again in EndThread() */
p_vout->b_error = 1;
}
/* Need to reinitialise the chroma plugin */
p_vout->chroma.pf_end( p_vout );
p_vout->chroma.pf_init( p_vout );
}
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment