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.
* xmga.c : X11 MGA plugin for vlc
*****************************************************************************
* 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>
* Samuel Hocevar <sam@zoy.org>
boolean_t b_mouse_pointer_visible;
mtime_t i_time_mouse_last_moved; /* used to auto-hide pointer*/
Cursor blank_cursor; /* the hidden cursor */
+ mtime_t i_time_button_last_pressed; /* to track dbl-clicks */
Pixmap cursor_pixmap;
} vout_sys_t;
{
case Button1:
/* In this part we will eventually manage
- * clicks for DVD navigation for instance. For the
- * moment just pause the stream. */
- input_SetStatus( p_input_bank->pp_input[0],
- INPUT_STATUS_PAUSE );
+ * clicks for DVD navigation for instance. */
+
+ /* detect double-clicks */
+ 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;
case Button4:
* vout_sdl.c: SDL video output display method
*****************************************************************************
* 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>
* Pierre Baillet <oct@zoy.org>
boolean_t b_cursor;
boolean_t b_cursor_autohidden;
mtime_t i_lastmoved;
+ mtime_t i_lastpressed; /* to track dbl-clicks */
} vout_sys_t;
p_vout->p_sys->b_cursor_autohidden = 0;
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 ) )
{
intf_ErrMsg( "vout error: can't set up SDL (%s)", SDL_GetError() );
/* 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_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
- / p_vout->p_sys->i_height;
+ / p_vout->output.i_height;
}
else
{
switch( event.type )
{
case SDL_VIDEORESIZE: /* Resizing of window */
- p_vout->p_sys->i_width = event.resize.w;
- p_vout->p_sys->i_height = event.resize.h;
- CloseDisplay( p_vout );
- OpenDisplay( p_vout );
+ /* Update dimensions */
+ p_vout->i_changes |= VOUT_SIZE_CHANGE;
+ p_vout->i_window_width = p_vout->p_sys->i_width = event.resize.w;
+ p_vout->i_window_height = p_vout->p_sys->i_height = event.resize.h;
break;
case SDL_MOUSEMOTION:
{
case SDL_BUTTON_LEFT:
/* In this part we will eventually manage
- * clicks for DVD navigation for instance. For the
- * moment just pause the stream. */
- input_SetStatus( p_input_bank->pp_input[0],
- INPUT_STATUS_PAUSE );
+ * clicks for DVD navigation for instance. */
+
+ /* detect double-clicks */
+ if( ( mdate() - p_vout->p_sys->i_lastpressed ) < 300000 )
+ p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
+
+ p_vout->p_sys->i_lastpressed = mdate();
break;
case 4:
{
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;
SDL_ShowCursor( p_vout->p_sys->b_cursor &&
! p_vout->p_sys->b_cursor_autohidden );
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 */
Uint32 i_flags;
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 */
i_flags = SDL_ANYFORMAT | SDL_HWPALETTE | SDL_HWSURFACE | SDL_DOUBLEBUF;
i_flags |= p_vout->b_fullscreen ? SDL_FULLSCREEN : SDL_RESIZABLE;
* xcommon.c: Functions common to the X11 and XVideo plugins
*****************************************************************************
* 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>
* Samuel Hocevar <sam@zoy.org>
static int vout_Manage( vout_thread_t *p_vout )
{
XEvent xevent; /* X11 event */
- boolean_t b_resized; /* window has been resized */
char i_key; /* ISO Latin-1 key */
KeySym x_key_symbol;
* window is mapped (and if the display is useful), and ClientMessages
* to intercept window destruction requests */
- b_resized = 0;
while( XCheckWindowEvent( p_vout->p_sys->p_display, p_vout->p_sys->window,
StructureNotifyMask | KeyPressMask |
ButtonPressMask | ButtonReleaseMask |
|| (xevent.xconfigure.height != p_vout->p_sys->i_height) )
{
/* Update dimensions */
- b_resized = 1;
p_vout->i_changes |= VOUT_SIZE_CHANGE;
p_vout->p_sys->i_width = xevent.xconfigure.width;
p_vout->p_sys->i_height = xevent.xconfigure.height;
/* detect double-clicks */
if( ( ((XButtonEvent *)&xevent)->time -
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 =
((XButtonEvent *)&xevent)->time;
p_vout->p_sys->i_height );
#ifdef MODULE_NAME_IS_x11
-
- /* Destroy XImages to change their size */
- vout_End( p_vout );
- 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 );
-
+ /* We need to signal the vout thread about the size change because it
+ * is doing the rescaling */
+ p_vout->i_changes |= VOUT_SIZE_CHANGE;
#endif
vout_PlacePicture( p_vout, p_vout->p_sys->i_width,
p_vout->p_sys->colormap, p_colors, 255 );
}
#endif
-
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* 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>
*
*/
if( p_vout->pf_manage( p_vout ) )
{
- /* A fatal error occured, and the thread must terminate immediately,
- * without displaying anything - setting b_error to 1 causes the
- * immediate end of the main while() loop. */
+ /* A fatal error occured, and the thread must terminate
+ * immediately, without displaying anything - setting b_error to 1
+ * causes the immediate end of the main while() loop. */
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 );
+ }
+
}
/*