From 670fc6fbd2d2e62586430c477e2c3e650daed95e Mon Sep 17 00:00:00 2001
From: =?utf-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
Date: Thu, 9 Apr 2009 17:57:01 +0300
Subject: [PATCH] X11: partially remove built-in window support DO NOT APPLY

---
 modules/video_output/x11/xcommon.c |   89 ++++++++++--------------------------
 1 files changed, 25 insertions(+), 64 deletions(-)

diff --git a/modules/video_output/x11/xcommon.c b/modules/video_output/x11/xcommon.c
index 4b9835e..5a62e13 100644
--- a/modules/video_output/x11/xcommon.c
+++ b/modules/video_output/x11/xcommon.c
@@ -1631,6 +1631,31 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
             xsize_hints.y = p_win->i_y;
             xsize_hints.flags |= PPosition;
         }
+
+        /* Select events we are interested in. */
+        XSelectInput( p_vout->p_sys->p_display,
+                      p_win->owner_window->handle.xid, StructureNotifyMask );
+
+        /* Get the parent window's geometry information */
+        XGetGeometry( p_vout->p_sys->p_display,
+                      p_win->owner_window->handle.xid,
+                      &(Window){ 0 }, &(int){ 0 }, &(int){ 0 },
+                      &p_win->i_width,
+                      &p_win->i_height,
+                      &(unsigned){ 0 }, &(unsigned){ 0 });
+
+        /* From man XSelectInput: only one client at a time can select a
+         * ButtonPress event, so we need to open a new window anyway. */
+        p_win->base_window =
+            XCreateWindow( p_vout->p_sys->p_display,
+                           p_win->owner_window->handle.xid,
+                           0, 0,
+                           p_win->i_width, p_win->i_height,
+                           0,
+                           0, CopyFromParent, 0,
+                           CWBackingStore | CWBackPixel | CWEventMask,
+                           &xwindow_attributes );
+
     }
     else
     {
@@ -1641,14 +1666,10 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
             DisplayWidth( p_vout->p_sys->p_display, p_vout->p_sys->i_screen );
         p_win->i_height =
             DisplayHeight( p_vout->p_sys->p_display, p_vout->p_sys->i_screen );
-    }
 
-    if( !p_win->owner_window )
-    {
         /* Create the window and set hints - the window must receive
          * ConfigureNotify events, and until it is displayed, Expose and
          * MapNotify events. */
-
         p_win->base_window =
             XCreateWindow( p_vout->p_sys->p_display,
                            DefaultRootWindow( p_vout->p_sys->p_display ),
@@ -1678,66 +1699,6 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
                         p_win->base_window, val.psz_string );
         }
         free( val.psz_string );
-
-        if( !p_vout->b_fullscreen )
-        {
-            const char *argv[] = { "vlc", NULL };
-
-            /* Set window manager hints and properties: size hints, command,
-             * window's name, and accepted protocols */
-            XSetWMNormalHints( p_vout->p_sys->p_display,
-                               p_win->base_window, &xsize_hints );
-            XSetCommand( p_vout->p_sys->p_display, p_win->base_window,
-                         (char**)argv, 1 );
-
-            if( !var_GetBool( p_vout, "video-deco") )
-            {
-                Atom prop;
-                mwmhints_t mwmhints;
-
-                mwmhints.flags = MWM_HINTS_DECORATIONS;
-                mwmhints.decorations = False;
-
-                prop = XInternAtom( p_vout->p_sys->p_display, "_MOTIF_WM_HINTS",
-                                    False );
-
-                XChangeProperty( p_vout->p_sys->p_display,
-                                 p_win->base_window,
-                                 prop, prop, 32, PropModeReplace,
-                                 (unsigned char *)&mwmhints,
-                                 PROP_MWM_HINTS_ELEMENTS );
-            }
-        }
-    }
-    else
-    {
-        Window dummy1;
-        int dummy2, dummy3;
-        unsigned int dummy4, dummy5;
-
-        /* Select events we are interested in. */
-        XSelectInput( p_vout->p_sys->p_display,
-                      p_win->owner_window->handle.xid, StructureNotifyMask );
-
-        /* Get the parent window's geometry information */
-        XGetGeometry( p_vout->p_sys->p_display,
-                      p_win->owner_window->handle.xid,
-                      &dummy1, &dummy2, &dummy3,
-                      &p_win->i_width,
-                      &p_win->i_height,
-                      &dummy4, &dummy5 );
-
-        /* From man XSelectInput: only one client at a time can select a
-         * ButtonPress event, so we need to open a new window anyway. */
-        p_win->base_window =
-            XCreateWindow( p_vout->p_sys->p_display,
-                           p_win->owner_window->handle.xid,
-                           0, 0,
-                           p_win->i_width, p_win->i_height,
-                           0,
-                           0, CopyFromParent, 0,
-                           CWBackingStore | CWBackPixel | CWEventMask,
-                           &xwindow_attributes );
     }
 
     if( (p_win->wm_protocols == None)        /* use WM_DELETE_WINDOW */
-- 
1.5.6.5

