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 @@
* 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>
......@@ -188,6 +188,7 @@ typedef struct vout_sys_s
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;
......@@ -599,10 +600,17 @@ static int vout_Manage( vout_thread_t *p_vout )
{
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:
......
......@@ -2,7 +2,7 @@
* 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>
......@@ -74,6 +74,7 @@ typedef struct vout_sys_s
boolean_t b_cursor;
boolean_t b_cursor_autohidden;
mtime_t i_lastmoved;
mtime_t i_lastpressed; /* to track dbl-clicks */
} vout_sys_t;
......@@ -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->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() );
......@@ -244,9 +241,9 @@ static int vout_Init( vout_thread_t *p_vout )
/* 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
{
......@@ -347,10 +344,10 @@ static int vout_Manage( vout_thread_t *p_vout )
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:
......@@ -383,10 +380,13 @@ static int vout_Manage( vout_thread_t *p_vout )
{
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:
......@@ -492,13 +492,31 @@ static int vout_Manage( vout_thread_t *p_vout )
{
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 */
......@@ -565,6 +583,12 @@ static int OpenDisplay( vout_thread_t *p_vout )
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;
......
......@@ -2,7 +2,7 @@
* 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>
......@@ -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 )
{
XEvent xevent; /* X11 event */
boolean_t b_resized; /* window has been resized */
char i_key; /* ISO Latin-1 key */
KeySym x_key_symbol;
......@@ -594,7 +593,6 @@ static int vout_Manage( vout_thread_t *p_vout )
* 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 |
......@@ -608,7 +606,6 @@ static int vout_Manage( vout_thread_t *p_vout )
|| (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;
......@@ -734,9 +731,7 @@ static int vout_Manage( vout_thread_t *p_vout )
/* 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;
......@@ -847,23 +842,9 @@ static int vout_Manage( vout_thread_t *p_vout )
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,
......@@ -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 );
}
#endif
......@@ -5,7 +5,7 @@
* 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>
*
......@@ -661,11 +661,39 @@ static void RunThread( vout_thread_t *p_vout)
*/
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 );
}
}
/*
......
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