Alexandre Julliard : winex11: Don' t create a win_data structure for the root window in non-desktop mode.

Alexandre Julliard julliard at winehq.org
Thu Jan 24 07:20:56 CST 2008


Module: wine
Branch: master
Commit: b6cc7f9bccb77eae43a598c67ba7fd67e251081d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b6cc7f9bccb77eae43a598c67ba7fd67e251081d

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Jan 24 10:20:11 2008 +0100

winex11: Don't create a win_data structure for the root window in non-desktop mode.

---

 dlls/winex11.drv/window.c |   71 ++++++++++++++++++++------------------------
 dlls/winex11.drv/winpos.c |   11 +------
 2 files changed, 34 insertions(+), 48 deletions(-)

diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index da6efab..73f9659 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -875,7 +875,6 @@ void X11DRV_set_wm_hints( Display *display, struct x11drv_win_data *data )
 
     if (data->hwnd == GetDesktopWindow())
     {
-        if (data->whole_window == DefaultRootWindow(display)) return;
         /* force some styles for the desktop to get the correct decorations */
         style |= WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
         owner = 0;
@@ -947,7 +946,7 @@ void X11DRV_set_iconic_state( HWND hwnd )
     BOOL iconic = (style & WS_MINIMIZE) != 0;
 
     if (!(data = X11DRV_get_win_data( hwnd ))) return;
-    if (!data->whole_window || data->whole_window == DefaultRootWindow(display)) return;
+    if (!data->whole_window) return;
 
     GetWindowRect( hwnd, &rect );
 
@@ -1155,8 +1154,7 @@ static void destroy_whole_window( Display *display, struct x11drv_win_data *data
     if (thread_data->cursor_window == data->whole_window) thread_data->cursor_window = None;
     wine_tsx11_lock();
     XDeleteContext( display, data->whole_window, winContext );
-    if (data->whole_window != DefaultRootWindow(display))
-        XDestroyWindow( display, data->whole_window );
+    XDestroyWindow( display, data->whole_window );
     data->whole_window = 0;
     if (data->xic)
     {
@@ -1242,22 +1240,22 @@ static struct x11drv_win_data *alloc_win_data( Display *display, HWND hwnd )
 
 
 /* initialize the desktop window id in the desktop manager process */
-static void get_desktop_xwin( Display *display, struct x11drv_win_data *data )
+static struct x11drv_win_data *create_desktop_win_data( Display *display, HWND hwnd )
 {
-    data->whole_window = root_window;
-    if (root_window != DefaultRootWindow( display ))
-    {
-        VisualID visualid;
+    struct x11drv_win_data *data;
+    VisualID visualid;
 
-        wine_tsx11_lock();
-        visualid = XVisualIDFromVisual(visual);
-        wine_tsx11_unlock();
-        data->managed = TRUE;
-        SetPropA( data->hwnd, managed_prop, (HANDLE)1 );
-        SetPropA( data->hwnd, whole_window_prop, (HANDLE)root_window );
-        SetPropA( data->hwnd, visual_id_prop, (HANDLE)visualid );
-        set_initial_wm_hints( display, data );
-    }
+    if (!(data = alloc_win_data( display, hwnd ))) return NULL;
+    wine_tsx11_lock();
+    visualid = XVisualIDFromVisual(visual);
+    wine_tsx11_unlock();
+    data->whole_window = root_window;
+    data->managed = TRUE;
+    SetPropA( data->hwnd, managed_prop, (HANDLE)1 );
+    SetPropA( data->hwnd, whole_window_prop, (HANDLE)root_window );
+    SetPropA( data->hwnd, visual_id_prop, (HANDLE)visualid );
+    set_initial_wm_hints( display, data );
+    return data;
 }
 
 /**********************************************************************
@@ -1309,7 +1307,6 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
 {
     Display *display = thread_display();
     WND *wndPtr;
-    struct x11drv_win_data *data;
     HWND insert_after;
     RECT rect;
     DWORD style;
@@ -1318,21 +1315,28 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
     BOOL ret = FALSE;
     INT cx = cs->cx, cy = cs->cy;
 
-    if (!(data = alloc_win_data( display, hwnd ))) return FALSE;
-
-    if (hwnd == GetDesktopWindow()) get_desktop_xwin( display, data );
+    if (hwnd == GetDesktopWindow())
+    {
+        if (root_window != DefaultRootWindow( display ))
+        {
+            if (!create_desktop_win_data( display, hwnd )) return FALSE;
+        }
+    }
     else
     {
+        struct x11drv_win_data *data;
+
+        if (!(data = alloc_win_data( display, hwnd ))) return FALSE;
+
         /* create an X window if it's a top level window */
         if (GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow())
         {
             if (!create_whole_window( display, data )) goto failed;
         }
+        /* get class or window DC if needed */
+        alloc_window_dce( data );
     }
 
-    /* get class or window DC if needed */
-    alloc_window_dce( data );
-
     /* Call the WH_CBT hook */
 
     /* the window style passed to the hook must be the real window style,
@@ -1379,11 +1383,11 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
     }
 
     /* make sure the window is still valid */
-    if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
-    if (data->whole_window) X11DRV_sync_window_style( display, data );
+    if (!(wndPtr = WIN_GetPtr(hwnd))) return FALSE;
 
     /* send WM_NCCALCSIZE */
-    rect = data->window_rect;
+    rect = wndPtr->rectWindow;
+    WIN_ReleasePtr( wndPtr );
     SendMessageW( hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rect );
 
     if (!(wndPtr = WIN_GetPtr(hwnd))) return FALSE;
@@ -1393,17 +1397,6 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
 
     X11DRV_SetWindowPos( hwnd, insert_after, &wndPtr->rectWindow, &rect, SWP_NOACTIVATE, NULL );
 
-    TRACE( "win %p window %d,%d,%d,%d client %d,%d,%d,%d whole %d,%d,%d,%d X client %d,%d,%d,%d xwin %x\n",
-           hwnd, wndPtr->rectWindow.left, wndPtr->rectWindow.top,
-           wndPtr->rectWindow.right, wndPtr->rectWindow.bottom,
-           wndPtr->rectClient.left, wndPtr->rectClient.top,
-           wndPtr->rectClient.right, wndPtr->rectClient.bottom,
-           data->whole_rect.left, data->whole_rect.top,
-           data->whole_rect.right, data->whole_rect.bottom,
-           data->client_rect.left, data->client_rect.top,
-           data->client_rect.right, data->client_rect.bottom,
-           (unsigned int)data->whole_window );
-
     WIN_ReleasePtr( wndPtr );
 
     if (unicode)
diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c
index 08baa65..1489ebe 100644
--- a/dlls/winex11.drv/winpos.c
+++ b/dlls/winex11.drv/winpos.c
@@ -353,17 +353,11 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
     RECT old_window_rect, old_whole_rect, old_client_rect, visible_rect;
     DWORD new_style;
 
-    if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
-
     if (!set_server_window_pos( hwnd, insert_after, rectWindow, rectClient, swp_flags,
                                 valid_rects, &visible_rect ))
         return FALSE;
 
-    if (data->whole_window == DefaultRootWindow(gdi_display))
-    {
-        data->whole_rect = data->client_rect = data->window_rect = *rectWindow;
-        return TRUE;
-    }
+    if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
 
     /* check if we need to switch the window to managed */
     if (!data->managed && data->whole_window && managed_mode &&
@@ -933,7 +927,6 @@ static BOOL CALLBACK update_windows_on_desktop_resize( HWND hwnd, LPARAM lparam
 void X11DRV_resize_desktop( unsigned int width, unsigned int height )
 {
     HWND hwnd = GetDesktopWindow();
-    struct x11drv_win_data *data;
     struct desktop_resize_data resize_data;
 
     SetRect( &resize_data.old_screen_rect, 0, 0, screen_width, screen_height );
@@ -941,7 +934,7 @@ void X11DRV_resize_desktop( unsigned int width, unsigned int height )
 
     xinerama_init( width, height );
 
-    if (!(data = X11DRV_get_win_data( hwnd )))
+    if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId())
     {
         SendMessageW( hwnd, WM_X11DRV_RESIZE_DESKTOP, 0, MAKELPARAM( width, height ) );
     }




More information about the wine-cvs mailing list