Commit 279de2ef authored by Gildas Bazin's avatar Gildas Bazin

* added an alternate fullscreen method. With this method, _nothing_ is allowed
to be displayed on top of the video (especially not taskbars, etc...).
Of course this can also be annoying sometimes, this is why it's an option.

PS: does anybody know how not to propagate the Ctrl-Alt-Tab key event to the
window manager. I tryed XChangeWindowAttributes with do_not_propagate_mask but
it doesn't seem to work.
parent 031f01c7
...@@ -2,10 +2,11 @@ ...@@ -2,10 +2,11 @@
* 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.7 2002/03/11 07:23:09 gbazin Exp $ * $Id: xmga.c,v 1.8 2002/03/17 13:53:21 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>
* Gildas Bazin <gbazin@netcourrier.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -91,7 +92,19 @@ static void ToggleCursor ( vout_thread_t * ); ...@@ -91,7 +92,19 @@ static void ToggleCursor ( vout_thread_t * );
/***************************************************************************** /*****************************************************************************
* Building configuration tree * Building configuration tree
*****************************************************************************/ *****************************************************************************/
#define ALT_FS_TEXT "Alternate fullscreen method"
#define ALT_FS_LONGTEXT "There are two ways to make a fullscreen window, " \
"unfortunately each one has its drawbacks.\n" \
"1) Let the window manager handle your fullscreen " \
"window (default). But things like taskbars will " \
"likely show on top of the video\n" \
"2) Completly bypass the window manager, but then " \
"nothing will be able to show on top of the video"
MODULE_CONFIG_START MODULE_CONFIG_START
ADD_CATEGORY_HINT( "Miscellaneous", NULL )
ADD_BOOL ( "xmga_altfullscreen", NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT )
MODULE_CONFIG_STOP MODULE_CONFIG_STOP
MODULE_INIT_START MODULE_INIT_START
...@@ -146,6 +159,7 @@ typedef struct vout_sys_s ...@@ -146,6 +159,7 @@ typedef struct vout_sys_s
int i_width; /* width of main window */ int i_width; /* width of main window */
int i_height; /* height of main window */ int i_height; /* height of main window */
boolean_t b_altfullscreen; /* which fullscreen method */
/* Backup of window position and size before fullscreen switch */ /* Backup of window position and size before fullscreen switch */
int i_width_backup; int i_width_backup;
...@@ -299,9 +313,12 @@ static int vout_Create( vout_thread_t *p_vout ) ...@@ -299,9 +313,12 @@ static int vout_Create( vout_thread_t *p_vout )
return( 1 ); return( 1 );
} }
/* Disable screen saver and return */ /* Disable screen saver */
DisableXScreenSaver( p_vout ); DisableXScreenSaver( p_vout );
/* Misc init */
p_vout->p_sys->b_altfullscreen = 0;
return( 0 ); return( 0 );
} }
...@@ -920,9 +937,7 @@ static void ToggleFullScreen ( vout_thread_t *p_vout ) ...@@ -920,9 +937,7 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
mwmhints_t mwmhints; mwmhints_t mwmhints;
int i_xpos, i_ypos, i_width, i_height; int i_xpos, i_ypos, i_width, i_height;
XEvent xevent; XEvent xevent;
#ifdef ALTERNATE_FULLSCREEN
XSetWindowAttributes attributes; XSetWindowAttributes attributes;
#endif
p_vout->b_fullscreen = !p_vout->b_fullscreen; p_vout->b_fullscreen = !p_vout->b_fullscreen;
...@@ -933,6 +948,12 @@ static void ToggleFullScreen ( vout_thread_t *p_vout ) ...@@ -933,6 +948,12 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
intf_WarnMsg( 3, "vout: entering fullscreen mode" ); intf_WarnMsg( 3, "vout: entering fullscreen mode" );
/* Only check the fullscreen method when we actually go fullscreen,
* because to go back to window mode we need to know in which
* fullscreen mode we where */
p_vout->p_sys->b_altfullscreen =
config_GetIntVariable( "xmga_altfullscreen" );
/* Save current window coordinates so they can be restored when /* Save current window coordinates so they can be restored when
* we exit from fullscreen mode. This is the tricky part because * we exit from fullscreen mode. This is the tricky part because
* this heavily depends on the behaviour of the window manager. * this heavily depends on the behaviour of the window manager.
...@@ -1002,13 +1023,6 @@ static void ToggleFullScreen ( vout_thread_t *p_vout ) ...@@ -1002,13 +1023,6 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
i_height = DisplayHeight( p_vout->p_sys->p_display, i_height = DisplayHeight( p_vout->p_sys->p_display,
p_vout->p_sys->i_screen ); p_vout->p_sys->i_screen );
#if 0
/* Being a transient window allows us to really be fullscreen (display
* over the taskbar for instance) but then we end-up with the same
* result as with the brute force method */
XSetTransientForHint( p_vout->p_sys->p_display,
p_vout->p_sys->window, None );
#endif
} }
else else
{ {
...@@ -1026,25 +1040,27 @@ static void ToggleFullScreen ( vout_thread_t *p_vout ) ...@@ -1026,25 +1040,27 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
* The other way is to use the motif property "_MOTIF_WM_HINTS" which * The other way is to use the motif property "_MOTIF_WM_HINTS" which
* luckily seems to be supported by most window managers. * luckily seems to be supported by most window managers.
*/ */
#ifndef ALTERNATE_FULLSCREEN if( !p_vout->p_sys->b_altfullscreen )
mwmhints.flags = MWM_HINTS_DECORATIONS; {
mwmhints.decorations = !p_vout->b_fullscreen; mwmhints.flags = MWM_HINTS_DECORATIONS;
mwmhints.decorations = !p_vout->b_fullscreen;
prop = XInternAtom( p_vout->p_sys->p_display, "_MOTIF_WM_HINTS",
False ); prop = XInternAtom( p_vout->p_sys->p_display, "_MOTIF_WM_HINTS",
XChangeProperty( p_vout->p_sys->p_display, p_vout->p_sys->window, False );
prop, prop, 32, PropModeReplace, XChangeProperty( p_vout->p_sys->p_display, p_vout->p_sys->window,
(unsigned char *)&mwmhints, prop, prop, 32, PropModeReplace,
PROP_MWM_HINTS_ELEMENTS ); (unsigned char *)&mwmhints,
PROP_MWM_HINTS_ELEMENTS );
#else }
/* brute force way to remove decorations */ else
attributes.override_redirect = p_vout->b_fullscreen; {
XChangeWindowAttributes( p_vout->p_sys->p_display, /* brute force way to remove decorations */
p_vout->p_sys->window, attributes.override_redirect = p_vout->b_fullscreen;
CWOverrideRedirect, XChangeWindowAttributes( p_vout->p_sys->p_display,
&attributes); p_vout->p_sys->window,
#endif CWOverrideRedirect,
&attributes);
}
/* We need to unmap and remap the window if we want the window /* We need to unmap and remap the window if we want the window
* manager to take our changes into effect */ * manager to take our changes into effect */
...@@ -1148,12 +1164,11 @@ static void ToggleFullScreen ( vout_thread_t *p_vout ) ...@@ -1148,12 +1164,11 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
} }
} }
#ifdef ALTERNATE_FULLSCREEN if( p_vout->p_sys->b_altfullscreen )
XSetInputFocus(p_vout->p_sys->p_display, XSetInputFocus(p_vout->p_sys->p_display,
p_vout->p_sys->window, p_vout->p_sys->window,
RevertToParent, RevertToParent,
CurrentTime); CurrentTime);
#endif
/* signal that the size needs to be updated */ /* signal that the size needs to be updated */
p_vout->p_sys->i_width = i_width; p_vout->p_sys->i_width = i_width;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11.c : X11 plugin for vlc * x11.c : X11 plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: x11.c,v 1.12 2002/02/24 20:51:10 gbazin Exp $ * $Id: x11.c,v 1.13 2002/03/17 13:53:21 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>
...@@ -36,7 +36,19 @@ ...@@ -36,7 +36,19 @@
/***************************************************************************** /*****************************************************************************
* Building configuration tree * Building configuration tree
*****************************************************************************/ *****************************************************************************/
#define ALT_FS_TEXT "Alternate fullscreen method"
#define ALT_FS_LONGTEXT "There are two ways to make a fullscreen window, " \
"unfortunately each one has its drawbacks.\n" \
"1) Let the window manager handle your fullscreen " \
"window (default). But things like taskbars will " \
"likely show on top of the video\n" \
"2) Completly bypass the window manager, but then " \
"nothing will be able to show on top of the video"
MODULE_CONFIG_START MODULE_CONFIG_START
ADD_CATEGORY_HINT( "Miscellaneous", NULL )
ADD_BOOL ( "x11_altfullscreen", NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT )
MODULE_CONFIG_STOP MODULE_CONFIG_STOP
MODULE_INIT_START MODULE_INIT_START
......
...@@ -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.22 2002/03/16 23:03:19 sam Exp $ * $Id: xcommon.c,v 1.23 2002/03/17 13:53:21 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>
...@@ -163,6 +163,7 @@ typedef struct vout_sys_s ...@@ -163,6 +163,7 @@ typedef struct vout_sys_s
int i_width; /* width of main window */ int i_width; /* width of main window */
int i_height; /* height of main window */ int i_height; /* height of main window */
boolean_t b_altfullscreen; /* which fullscreen method */
/* Backup of window position and size before fullscreen switch */ /* Backup of window position and size before fullscreen switch */
int i_width_backup; int i_width_backup;
...@@ -367,9 +368,12 @@ static int vout_Create( vout_thread_t *p_vout ) ...@@ -367,9 +368,12 @@ static int vout_Create( vout_thread_t *p_vout )
return( 1 ); return( 1 );
} }
/* Disable screen saver and return */ /* Disable screen saver */
DisableXScreenSaver( p_vout ); DisableXScreenSaver( p_vout );
/* Misc init */
p_vout->p_sys->b_altfullscreen = 0;
return( 0 ); return( 0 );
} }
...@@ -1413,9 +1417,7 @@ static void ToggleFullScreen ( vout_thread_t *p_vout ) ...@@ -1413,9 +1417,7 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
mwmhints_t mwmhints; mwmhints_t mwmhints;
int i_xpos, i_ypos, i_width, i_height; int i_xpos, i_ypos, i_width, i_height;
XEvent xevent; XEvent xevent;
#ifdef ALTERNATE_FULLSCREEN
XSetWindowAttributes attributes; XSetWindowAttributes attributes;
#endif
p_vout->b_fullscreen = !p_vout->b_fullscreen; p_vout->b_fullscreen = !p_vout->b_fullscreen;
...@@ -1426,6 +1428,16 @@ static void ToggleFullScreen ( vout_thread_t *p_vout ) ...@@ -1426,6 +1428,16 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
intf_WarnMsg( 3, "vout: entering fullscreen mode" ); intf_WarnMsg( 3, "vout: entering fullscreen mode" );
/* Only check the fullscreen method when we actually go fullscreen,
* because to go back to window mode we need to know in which
* fullscreen mode we where */
p_vout->p_sys->b_altfullscreen =
#ifdef MODULE_NAME_IS_xvideo
config_GetIntVariable( "xvideo_altfullscreen" );
#else
config_GetIntVariable( "x11_altfullscreen" );
#endif
/* Save current window coordinates so they can be restored when /* Save current window coordinates so they can be restored when
* we exit from fullscreen mode. This is the tricky part because * we exit from fullscreen mode. This is the tricky part because
* this heavily depends on the behaviour of the window manager. * this heavily depends on the behaviour of the window manager.
...@@ -1495,13 +1507,6 @@ static void ToggleFullScreen ( vout_thread_t *p_vout ) ...@@ -1495,13 +1507,6 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
i_height = DisplayHeight( p_vout->p_sys->p_display, i_height = DisplayHeight( p_vout->p_sys->p_display,
p_vout->p_sys->i_screen ); p_vout->p_sys->i_screen );
#if 0
/* Being a transient window allows us to really be fullscreen (display
* over the taskbar for instance) but then we end-up with the same
* result as with the brute force method */
XSetTransientForHint( p_vout->p_sys->p_display,
p_vout->p_sys->window, None );
#endif
} }
else else
{ {
...@@ -1519,25 +1524,27 @@ static void ToggleFullScreen ( vout_thread_t *p_vout ) ...@@ -1519,25 +1524,27 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
* The other way is to use the motif property "_MOTIF_WM_HINTS" which * The other way is to use the motif property "_MOTIF_WM_HINTS" which
* luckily seems to be supported by most window managers. * luckily seems to be supported by most window managers.
*/ */
#ifndef ALTERNATE_FULLSCREEN if( !p_vout->p_sys->b_altfullscreen )
mwmhints.flags = MWM_HINTS_DECORATIONS; {
mwmhints.decorations = !p_vout->b_fullscreen; mwmhints.flags = MWM_HINTS_DECORATIONS;
mwmhints.decorations = !p_vout->b_fullscreen;
prop = XInternAtom( p_vout->p_sys->p_display, "_MOTIF_WM_HINTS",
False ); prop = XInternAtom( p_vout->p_sys->p_display, "_MOTIF_WM_HINTS",
XChangeProperty( p_vout->p_sys->p_display, p_vout->p_sys->window, False );
prop, prop, 32, PropModeReplace, XChangeProperty( p_vout->p_sys->p_display, p_vout->p_sys->window,
(unsigned char *)&mwmhints, prop, prop, 32, PropModeReplace,
PROP_MWM_HINTS_ELEMENTS ); (unsigned char *)&mwmhints,
PROP_MWM_HINTS_ELEMENTS );
#else }
/* brute force way to remove decorations */ else
attributes.override_redirect = p_vout->b_fullscreen; {
XChangeWindowAttributes( p_vout->p_sys->p_display, /* brute force way to remove decorations */
p_vout->p_sys->window, attributes.override_redirect = p_vout->b_fullscreen;
CWOverrideRedirect, XChangeWindowAttributes( p_vout->p_sys->p_display,
&attributes); p_vout->p_sys->window,
#endif CWOverrideRedirect,
&attributes);
}
/* We need to unmap and remap the window if we want the window /* We need to unmap and remap the window if we want the window
* manager to take our changes into effect */ * manager to take our changes into effect */
...@@ -1595,7 +1602,7 @@ static void ToggleFullScreen ( vout_thread_t *p_vout ) ...@@ -1595,7 +1602,7 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
p_vout->p_sys->window, p_vout->p_sys->window,
p_vout->p_sys->i_xpos_backup_2, p_vout->p_sys->i_xpos_backup_2,
p_vout->p_sys->i_ypos_backup_2 ); p_vout->p_sys->i_ypos_backup_2 );
/* Purge all ConfigureNotify events, this is needed to fix a bug /* Purge all ConfigureNotify events, this is needed to fix a bug
* where we would lose the original size of the window */ * where we would lose the original size of the window */
XWindowEvent( p_vout->p_sys->p_display, p_vout->p_sys->window, XWindowEvent( p_vout->p_sys->p_display, p_vout->p_sys->window,
...@@ -1627,7 +1634,7 @@ static void ToggleFullScreen ( vout_thread_t *p_vout ) ...@@ -1627,7 +1634,7 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
p_vout->p_sys->window, p_vout->p_sys->window,
p_vout->p_sys->i_width_backup_2, p_vout->p_sys->i_width_backup_2,
p_vout->p_sys->i_height_backup_2 ); p_vout->p_sys->i_height_backup_2 );
/* Purge all ConfigureNotify events, this is needed to fix a bug /* Purge all ConfigureNotify events, this is needed to fix a bug
* where we would lose the original size of the window */ * where we would lose the original size of the window */
XWindowEvent( p_vout->p_sys->p_display, p_vout->p_sys->window, XWindowEvent( p_vout->p_sys->p_display, p_vout->p_sys->window,
...@@ -1641,12 +1648,11 @@ static void ToggleFullScreen ( vout_thread_t *p_vout ) ...@@ -1641,12 +1648,11 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
} }
} }
#ifdef ALTERNATE_FULLSCREEN if( p_vout->p_sys->b_altfullscreen )
XSetInputFocus(p_vout->p_sys->p_display, XSetInputFocus(p_vout->p_sys->p_display,
p_vout->p_sys->window, p_vout->p_sys->window,
RevertToParent, RevertToParent,
CurrentTime); CurrentTime);
#endif
/* signal that the size needs to be updated */ /* signal that the size needs to be updated */
p_vout->p_sys->i_width = i_width; p_vout->p_sys->i_width = i_width;
...@@ -1830,7 +1836,7 @@ static int XVideoGetPort( Display *dpy, u32 i_chroma, u32 *pi_newchroma ) ...@@ -1830,7 +1836,7 @@ static int XVideoGetPort( Display *dpy, u32 i_chroma, u32 *pi_newchroma )
} }
i_selected_port = -1; i_selected_port = -1;
i_requested_adaptor = config_GetIntVariable( XVADAPTOR_VAR ); i_requested_adaptor = config_GetIntVariable( "xvideo_adaptor" );
for( i_adaptor = 0; i_adaptor < i_num_adaptors; ++i_adaptor ) for( i_adaptor = 0; i_adaptor < i_num_adaptors; ++i_adaptor )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* xcommon.h: Common X11 and Xvideo video output display method * xcommon.h: Common X11 and Xvideo video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: xcommon.h,v 1.2 2002/02/24 20:51:10 gbazin Exp $ * $Id: xcommon.h,v 1.3 2002/03/17 13:53:21 gbazin Exp $
* *
* Authors: Shane Harper <shanegh@optusnet.com.au> * Authors: Shane Harper <shanegh@optusnet.com.au>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -24,11 +24,6 @@ ...@@ -24,11 +24,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
/*****************************************************************************
* Common macros
*****************************************************************************/
#define XVADAPTOR_VAR "xvideo_adaptor"
/***************************************************************************** /*****************************************************************************
* Common prototypes * Common prototypes
*****************************************************************************/ *****************************************************************************/
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* xvideo.c : Xvideo plugin for vlc * xvideo.c : Xvideo plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: xvideo.c,v 1.7 2002/02/24 20:51:10 gbazin Exp $ * $Id: xvideo.c,v 1.8 2002/03/17 13:53:21 gbazin Exp $
* *
* Authors: Shane Harper <shanegh@optusnet.com.au> * Authors: Shane Harper <shanegh@optusnet.com.au>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -37,9 +37,24 @@ ...@@ -37,9 +37,24 @@
/***************************************************************************** /*****************************************************************************
* Building configuration tree * Building configuration tree
*****************************************************************************/ *****************************************************************************/
#define ADAPTOR_TEXT "XVideo adaptor number"
#define ADAPTOR_LONGTEXT "If you graphics card provides several adaptors, " \
"this option allows you to choose which one will " \
"be used (you shouldn't have to change this)"
#define ALT_FS_TEXT "Alternate fullscreen method"
#define ALT_FS_LONGTEXT "There are two ways to make a fullscreen window, " \
"unfortunately each one has its drawbacks.\n" \
"1) Let the window manager handle your fullscreen " \
"window (default). But things like taskbars will " \
"likely show on top of the video\n" \
"2) Completly bypass the window manager, but then " \
"nothing will be able to show on top of the video"
MODULE_CONFIG_START MODULE_CONFIG_START
ADD_CATEGORY_HINT( "Misc Options", NULL ) ADD_CATEGORY_HINT( "Miscellaneous", NULL )
ADD_INTEGER ( XVADAPTOR_VAR, -1, NULL, "XVideo adaptor number", NULL ) ADD_INTEGER ( "xvideo_adaptor", -1, NULL, ADAPTOR_TEXT, ADAPTOR_LONGTEXT )
ADD_BOOL ( "xvideo_altfullscreen", NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT )
MODULE_CONFIG_STOP MODULE_CONFIG_STOP
MODULE_INIT_START MODULE_INIT_START
......
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