diff libvo/vo_gl.c @ 23655:00aa61cde84a

Make X11 window creation and (with -fixed-vo) management simpler and more consistent by introducing a new function that handles most of the ugly things. Changes of behaviour with some vos is unavoidable, bug reports welcome.
author reimar
date Wed, 27 Jun 2007 10:26:13 +0000
parents 96e93cd1ac9e
children e64c59f73527
line wrap: on
line diff
--- a/libvo/vo_gl.c	Wed Jun 27 10:08:21 2007 +0000
+++ b/libvo/vo_gl.c	Wed Jun 27 10:26:13 2007 +0000
@@ -470,65 +470,18 @@
              ButtonPressMask | ButtonReleaseMask | ExposureMask);
     goto glconfig;
   }
-  if ( vo_window == None ) {
-    unsigned int fg, bg;
-    XSizeHints hint;
-    XVisualInfo *vinfo;
-    XEvent xev;
-
-    vo_fs = VO_FALSE;
-
-    hint.x = vo_dx;
-    hint.y = vo_dy;
-    hint.width = d_width;
-    hint.height = d_height;
-    hint.flags = PPosition | PSize;
-
-    /* Get some colors */
-    bg = WhitePixel(mDisplay, mScreen);
-    fg = BlackPixel(mDisplay, mScreen);
-
-    /* Make the window */
-    vinfo=glXChooseVisual( mDisplay,mScreen,wsGLXAttrib );
+  {
+    XVisualInfo *vinfo=glXChooseVisual( mDisplay,mScreen,wsGLXAttrib );
     if (vinfo == NULL)
     {
       mp_msg(MSGT_VO, MSGL_ERR, "[gl] no GLX support present\n");
       return -1;
     }
 
-    vo_window = vo_x11_create_smooth_window(mDisplay, mRootWin, vinfo->visual,
-                  hint.x, hint.y, hint.width, hint.height, vinfo->depth,
-                  XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocNone));
-
-    vo_x11_classhint( mDisplay,vo_window,"gl" );
-    vo_hidecursor(mDisplay,vo_window);
-
-    XSelectInput(mDisplay, vo_window, StructureNotifyMask);
-    /* Tell other applications about this window */
-    XSetStandardProperties(mDisplay, vo_window, title, title, None, NULL, 0, &hint);
-    /* Set the size hints. */
-    vo_x11_sizehint(hint.x, hint.y, hint.width, hint.height, 0);
-    /* Map window. */
-    XMapWindow(mDisplay, vo_window);
-
-    /* Wait for map. */
-    do {
-      XNextEvent(mDisplay, &xev);
-    } while (xev.type != MapNotify || xev.xmap.event != vo_window);
-
-    XSelectInput(mDisplay, vo_window, NoEventMask);
-
-    XSync(mDisplay, False);
-
-    vo_x11_selectinput_witherr(mDisplay, vo_window,
-        StructureNotifyMask | KeyPressMask | PointerMotionMask |
-        ButtonPressMask | ButtonReleaseMask | ExposureMask);
+    vo_x11_create_vo_window(vinfo, vo_dx, vo_dy, d_width, d_height, flags,
+            XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocNone),
+            "gl", title);
   }
-  if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
-
-  vo_x11_nofs_sizepos(vo_dx, vo_dy, d_width, d_height);
-  if (vo_fs ^ (flags & VOFLAG_FULLSCREEN))
-    vo_x11_fullscreen();
 #endif
 
 glconfig: