]> git.sesse.net Git - vlc/commitdiff
Calculate position for videowindow to use current screen in xinerama-setup also.
authorIlkka Ollakka <ileoo@videolan.org>
Wed, 15 Oct 2008 17:56:56 +0000 (20:56 +0300)
committerIlkka Ollakka <ileoo@videolan.org>
Wed, 15 Oct 2008 18:22:04 +0000 (21:22 +0300)
Basicly same as mplayer/libvo/x11_common.c does.

modules/video_output/x11/glx.c
modules/video_output/x11/x11.c
modules/video_output/x11/xcommon.c
modules/video_output/x11/xvideo.c
modules/video_output/x11/xvmc.c

index f151a64b6e265aec4be1853875b1d35307f304bb..8e56c5473f97fc219cac893d52de1cc3f6bcc585 100644 (file)
@@ -130,7 +130,7 @@ vlc_module_begin();
     add_bool( "glx-shm", 1, NULL, SHM_TEXT, SHM_LONGTEXT, true );
 #endif
 #ifdef HAVE_XINERAMA
-    add_integer ( "glx-xineramascreen", 0, NULL, SCREEN_TEXT, SCREEN_LONGTEXT, true );
+    add_integer ( "glx-xineramascreen", -1, NULL, SCREEN_TEXT, SCREEN_LONGTEXT, true );
 #endif
 vlc_module_end();
 
index 9da6f1038a5ca4bfbae223f90953267fac70ce82..a67a26441e858e5026ed895a0517f11891e731ba 100644 (file)
@@ -76,7 +76,7 @@ vlc_module_begin();
     add_bool( "x11-shm", 1, NULL, SHM_TEXT, SHM_LONGTEXT, true );
 #endif
 #ifdef HAVE_XINERAMA
-    add_integer ( "x11-xineramascreen", 0, NULL, SCREEN_TEXT, SCREEN_LONGTEXT, true );
+    add_integer ( "x11-xineramascreen", -1, NULL, SCREEN_TEXT, SCREEN_LONGTEXT, true );
 #endif
     set_description( N_("X11 video output") );
     set_capability( "video output", 70 );
index 28f2ddcad4dfbd34ab26a712d560e5f31670068e..4f47435442578ed4fb7cd5c6f4883c6780e9f6a3 100644 (file)
@@ -2094,6 +2094,39 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
     {
         msg_Dbg( p_vout, "entering fullscreen mode" );
 
+        /* Getting current window position */
+        Window root_win;
+        Window* child_windows;
+        int num_child_windows;
+        Window parent_win;
+        Window child_win;
+        XWindowAttributes win_attr;
+        int screen_x,screen_y;
+
+        XGetWindowAttributes(
+                p_vout->p_sys->p_display,
+                p_vout->p_sys->p_win->video_window,
+                &win_attr);
+
+        XQueryTree(
+                p_vout->p_sys->p_display,
+                p_vout->p_sys->p_win->video_window,
+                &root_win,
+                &parent_win,
+                &child_windows,
+                &num_child_windows);
+        XFree(child_windows);
+
+        XTranslateCoordinates(
+                p_vout->p_sys->p_display,
+                parent_win, win_attr.root,
+                win_attr.x,win_attr.y,
+                &screen_x,&screen_y,
+                &child_win);
+
+        msg_Dbg( p_vout, "X %d/%d Y %d/%d", win_attr.x,screen_x,win_attr.y,screen_y);
+        /* screen_x and screen_y are current position */
+
         p_vout->p_sys->b_altfullscreen =
             config_GetInt( p_vout, MODULE_STRING "-altfullscreen" );
 
@@ -2190,11 +2223,26 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
             SCREEN = config_GetInt( p_vout,
                                         MODULE_STRING "-xineramascreen" );
 
-            /* just check that user has entered a good value */
+            /* just check that user has entered a good value,
+             * otherwise use that screen where window is */
             if( SCREEN >= i_num_screens || SCREEN < 0 )
             {
                 msg_Dbg( p_vout, "requested screen number invalid (%d/%d)", SCREEN, i_num_screens );
-                SCREEN = 0;
+#define left screens[SCREEN].x_org
+#define right left + screens[SCREEN].width
+#define top screens[SCREEN].y_org
+#define bottom top + screens[SCREEN].height
+
+                 for( SCREEN = i_num_screens-1; SCREEN > 0; SCREEN--)
+                 {
+                     if( left <= screen_x && screen_x <= right &&
+                             top <= screen_y && screen_y <= bottom )
+                         break;
+                 }
+#undef bottom
+#undef top
+#undef right
+#undef left
             }
 
             /* Get the X/Y upper left corner coordinate of the above screen */
index 787a9df4ed5f935f19a26f6f3e4e264531e96210..2b05b97dfb3e6ec0c1d2be059a503fec885d0232 100644 (file)
@@ -89,7 +89,7 @@ vlc_module_begin();
     add_bool( "xvideo-shm", 1, NULL, SHM_TEXT, SHM_LONGTEXT, true );
 #endif
 #ifdef HAVE_XINERAMA
-    add_integer ( "xvideo-xineramascreen", 0, NULL, SCREEN_TEXT, SCREEN_LONGTEXT, true );
+    add_integer ( "xvideo-xineramascreen", -1, NULL, SCREEN_TEXT, SCREEN_LONGTEXT, true );
 #endif
 
     set_description( N_("XVideo extension video output") );
index 03c0a49aa07973a06a954a57e0d9ef097e4c5e9f..166ef6e4011b6bce9f6f756f94ce701db5029e17 100644 (file)
@@ -143,7 +143,7 @@ vlc_module_begin();
     add_bool( "xvmc-shm", 1, NULL, SHM_TEXT, SHM_LONGTEXT, true );
 #endif
 #ifdef HAVE_XINERAMA
-    add_integer ( "xvmc-xineramascreen", 0, NULL, SCREEN_TEXT, SCREEN_LONGTEXT, true );
+    add_integer ( "xvmc-xineramascreen", -1, NULL, SCREEN_TEXT, SCREEN_LONGTEXT, true );
 #endif
     add_string( "xvmc-deinterlace-mode", "bob", NULL, MODE_TEXT, MODE_LONGTEXT, false );
     add_string( "xvmc-crop-style", "eq", NULL, CROP_TEXT, CROP_LONGTEXT, false );