Commit 58330471 authored by gbazin's avatar gbazin
Browse files

* modules/video_output/x11/*:

   - fixed exit in embedded mode when fullscreen.
   - re-use the current video sub-window when switching to fullscreen (to have opengl working in fullscreen mode as well).
   - add options to the opengl plugin.
parent b3e49f8d
......@@ -84,10 +84,41 @@ static void SwitchContext( vout_thread_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#define ADAPTOR_TEXT N_("XVideo adaptor number")
#define ADAPTOR_LONGTEXT N_( \
"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 N_("Alternate fullscreen method")
#define ALT_FS_LONGTEXT N_( \
"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) Completely bypass the window manager, but then nothing will be able " \
"to show on top of the video.")
#define DISPLAY_TEXT N_("X11 display name")
#define DISPLAY_LONGTEXT N_( \
"Specify the X11 hardware display you want to use. By default VLC will " \
"use the value of the DISPLAY environment variable.")
#define SCREEN_TEXT N_("Screen to be used for fullscreen mode.")
#define SCREEN_LONGTEXT N_( \
"Choose the screen you want to use in fullscreen mode. For instance " \
"set it to 0 for first screen, 1 for the second.")
vlc_module_begin();
set_description( _("X11 OpenGL provider") );
set_capability( "opengl provider", 50 );
set_callbacks( CreateOpenGL, DestroyOpenGL );
add_string( "glx-display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT, VLC_TRUE );
add_integer( "glx-adaptor", -1, NULL, ADAPTOR_TEXT, ADAPTOR_LONGTEXT, VLC_TRUE );
add_bool( "glx-altfullscreen", 0, NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT, VLC_TRUE );
#ifdef HAVE_XINERAMA
add_integer ( "glx-xineramascreen", 0, NULL, SCREEN_TEXT, SCREEN_LONGTEXT, VLC_TRUE );
#endif
vlc_module_end();
/*****************************************************************************
......
......@@ -974,6 +974,8 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
XStoreName( p_vout->p_sys->p_display, p_win->base_window,
#ifdef MODULE_NAME_IS_x11
VOUT_TITLE " (X11 output)"
#elif defined(MODULE_NAME_IS_glx)
VOUT_TITLE " (GLX output)"
#else
VOUT_TITLE " (XVideo output)"
#endif
......@@ -1127,7 +1129,9 @@ static void DestroyWindow( vout_thread_t *p_vout, x11_window_t *p_win )
/* Do NOT use XFlush here ! */
XSync( p_vout->p_sys->p_display, False );
XDestroyWindow( p_vout->p_sys->p_display, p_win->video_window );
if( p_win->video_window != None )
XDestroyWindow( p_vout->p_sys->p_display, p_win->video_window );
XFreeGC( p_vout->p_sys->p_display, p_win->gc );
XUnmapWindow( p_vout->p_sys->p_display, p_win->base_window );
......@@ -1332,11 +1336,18 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
config_GetInt( p_vout, MODULE_STRING "-altfullscreen" );
XUnmapWindow( p_vout->p_sys->p_display,
p_vout->p_sys->p_win->base_window);
p_vout->p_sys->p_win->base_window );
p_vout->p_sys->p_win = &p_vout->p_sys->fullscreen_window;
CreateWindow( p_vout, p_vout->p_sys->p_win );
XDestroyWindow( p_vout->p_sys->p_display,
p_vout->p_sys->fullscreen_window.video_window );
XReparentWindow( p_vout->p_sys->p_display,
p_vout->p_sys->original_window.video_window,
p_vout->p_sys->fullscreen_window.base_window, 0, 0 );
p_vout->p_sys->fullscreen_window.video_window =
p_vout->p_sys->original_window.video_window;
/* To my knowledge there are two ways to create a borderless window.
* There's the generic way which is to tell x to bypass the window
......@@ -1450,11 +1461,17 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
else
{
msg_Dbg( p_vout, "leaving fullscreen mode" );
XReparentWindow( p_vout->p_sys->p_display,
p_vout->p_sys->original_window.video_window,
p_vout->p_sys->original_window.base_window, 0, 0 );
p_vout->p_sys->fullscreen_window.video_window = None;
DestroyWindow( p_vout, &p_vout->p_sys->fullscreen_window );
p_vout->p_sys->p_win = &p_vout->p_sys->original_window;
XMapWindow( p_vout->p_sys->p_display,
p_vout->p_sys->p_win->base_window);
p_vout->p_sys->p_win->base_window );
}
/* Unfortunately, using XSync() here is not enough to ensure the
......@@ -2132,18 +2149,18 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
case VOUT_CLOSE:
vlc_mutex_lock( &p_vout->p_sys->lock );
XUnmapWindow( p_vout->p_sys->p_display,
p_vout->p_sys->p_win->base_window );
p_vout->p_sys->original_window.base_window );
vlc_mutex_unlock( &p_vout->p_sys->lock );
/* Fall through */
case VOUT_REPARENT:
vlc_mutex_lock( &p_vout->p_sys->lock );
XReparentWindow( p_vout->p_sys->p_display,
p_vout->p_sys->p_win->base_window,
p_vout->p_sys->original_window.base_window,
DefaultRootWindow( p_vout->p_sys->p_display ),
0, 0 );
XSync( p_vout->p_sys->p_display, False );
p_vout->p_sys->p_win->owner_window = 0;
p_vout->p_sys->original_window.owner_window = 0;
vlc_mutex_unlock( &p_vout->p_sys->lock );
return vout_vaControlDefault( p_vout, i_query, args );
......
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