]> git.sesse.net Git - vlc/blobdiff - modules/video_output/x11/glx.c
* picture.c : slightly cleaner picture_t freeing
[vlc] / modules / video_output / x11 / glx.c
index 918306eb23aa5bf9a75982d9443c4bed633037ce..f4a84cec881afeabe2591e99dd092f1ada1bda10 100644 (file)
@@ -84,10 +84,44 @@ 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_shortname( N_("OpenGL") );
+    set_category( CAT_VIDEO );
+    set_subcategory( SUBCAT_VIDEO_VOUT );
     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();
 
 /*****************************************************************************
@@ -145,16 +179,15 @@ static void DestroyOpenGL( vlc_object_t *p_this )
  *****************************************************************************/
 static int CheckGLX( vlc_object_t *p_this, vlc_bool_t *b_glx13 )
 {
-    Display *p_display;
-    int i_opcode, i_evt, i_err;
-    int i_maj, i_min;
+    Display *p_display = NULL;
+    int i_opcode, i_evt, i_err = 0;
+    int i_maj, i_min = 0;
 
     /* Open the display */
     p_display = XOpenDisplay( NULL );
-    if( !p_display )
+    if( p_display == NULL )
     {
         msg_Err( p_this, "Cannot open display" );
-        XCloseDisplay( p_display );
         return VLC_EGENERIC;
     }
 
@@ -306,6 +339,13 @@ int InitGLX13( vout_thread_t *p_vout )
 static void SwapBuffers( vout_thread_t *p_vout )
 {
     vout_sys_t *p_sys = p_vout->p_sys;
+    int i_width, i_height, i_x, i_y;
+
+    vout_PlacePicture( p_vout, p_vout->p_sys->p_win->i_width,
+                       p_vout->p_sys->p_win->i_height,
+                       &i_x, &i_y, &i_width, &i_height );
+
+    glViewport( 0, 0, (GLint)i_width, (GLint)i_height );
 
     if( p_sys->b_glx13 )
     {