Alexandre Julliard : winex11: Create the whole window at window creation time.

Alexandre Julliard julliard at winehq.org
Tue Sep 4 12:38:36 CDT 2012


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Sep  4 13:34:15 2012 +0200

winex11: Create the whole window at window creation time.

---

 dlls/winex11.drv/opengl.c  |    3 +--
 dlls/winex11.drv/systray.c |    5 +----
 dlls/winex11.drv/window.c  |   29 ++++++++---------------------
 dlls/winex11.drv/x11drv.h  |    1 -
 4 files changed, 10 insertions(+), 28 deletions(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index a2d88a0..b23ec98 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1176,8 +1176,7 @@ BOOL set_win_format( HWND hwnd, XID fbconfig_id )
 
     if (!(format = pixelformat_from_fbconfig_id( fbconfig_id ))) return FALSE;
 
-    if (!(data = X11DRV_get_win_data(hwnd)) &&
-        !(data = X11DRV_create_win_data(hwnd))) return FALSE;
+    if (!(data = X11DRV_get_win_data(hwnd))) return FALSE;
 
     gl = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*gl) );
     gl->pixel_format = format;
diff --git a/dlls/winex11.drv/systray.c b/dlls/winex11.drv/systray.c
index 7efc63d..f46ea29 100644
--- a/dlls/winex11.drv/systray.c
+++ b/dlls/winex11.drv/systray.c
@@ -517,10 +517,7 @@ static void dock_systray_icon( Display *display, struct tray_icon *icon, Window
     icon->window = CreateWindowW( icon_classname, NULL, WS_CLIPSIBLINGS | WS_POPUP,
                                   CW_USEDEFAULT, CW_USEDEFAULT, icon_cx, icon_cy,
                                   NULL, NULL, NULL, icon );
-    if (!icon->window) return;
-
-    if (!(data = X11DRV_get_win_data( icon->window )) &&
-        !(data = X11DRV_create_win_data( icon->window ))) return;
+    if (!(data = X11DRV_get_win_data( icon->window ))) return;
 
     TRACE( "icon window %p/%lx managed %u\n", data->hwnd, data->whole_window, data->managed );
 
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 7d2d1e2..e5b731c 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -911,12 +911,9 @@ static Window get_owner_whole_window( HWND owner, BOOL force_managed )
 
     if (!owner) return 0;
 
-    if (!(data = X11DRV_get_win_data( owner )))
-    {
-        if (!(data = X11DRV_create_win_data( owner )))
-            return (Window)GetPropA( owner, whole_window_prop );
-    }
-    else if (!data->managed && force_managed)  /* make it managed */
+    if (!(data = X11DRV_get_win_data( owner ))) return (Window)GetPropA( owner, whole_window_prop );
+
+    if (!data->managed && force_managed)  /* make it managed */
     {
         SetWindowPos( owner, 0, 0, 0, 0, 0,
                       SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE |
@@ -1722,7 +1719,8 @@ struct x11drv_win_data *X11DRV_get_win_data( HWND hwnd )
  *
  * Create an X11 data window structure for an existing window.
  */
-struct x11drv_win_data *X11DRV_create_win_data( HWND hwnd )
+static struct x11drv_win_data *X11DRV_create_win_data( HWND hwnd, const RECT *window_rect,
+                                                       const RECT *client_rect )
 {
     Display *display;
     struct x11drv_win_data *data;
@@ -1733,16 +1731,11 @@ struct x11drv_win_data *X11DRV_create_win_data( HWND hwnd )
     /* don't create win data for HWND_MESSAGE windows */
     if (parent != GetDesktopWindow() && !GetAncestor( parent, GA_PARENT )) return NULL;
 
-    if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId()) return NULL;
-
     display = thread_init_display();
     if (!(data = alloc_win_data( display, hwnd ))) return NULL;
 
-    GetWindowRect( hwnd, &data->window_rect );
-    MapWindowPoints( 0, parent, (POINT *)&data->window_rect, 2 );
-    data->whole_rect = data->window_rect;
-    GetClientRect( hwnd, &data->client_rect );
-    MapWindowPoints( hwnd, parent, (POINT *)&data->client_rect, 2 );
+    data->whole_rect = data->window_rect = *window_rect;
+    data->client_rect = *client_rect;
 
     if (parent == GetDesktopWindow())
     {
@@ -2076,14 +2069,8 @@ void CDECL X11DRV_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flag
                                      const RECT *window_rect, const RECT *client_rect, RECT *visible_rect )
 {
     struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
-    DWORD style = GetWindowLongW( hwnd, GWL_STYLE );
 
-    if (!data)
-    {
-        /* create the win data if the window is being made visible */
-        if (!(style & WS_VISIBLE) && !(swp_flags & SWP_SHOWWINDOW)) return;
-        if (!(data = X11DRV_create_win_data( hwnd ))) return;
-    }
+    if (!data && !(data = X11DRV_create_win_data( hwnd, window_rect, client_rect ))) return;
 
     /* check if we need to switch the window to managed */
     if (!data->managed && data->whole_window && is_window_managed( hwnd, swp_flags, window_rect ))
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index d1db819..eae047a 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -551,7 +551,6 @@ struct x11drv_win_data
 };
 
 extern struct x11drv_win_data *X11DRV_get_win_data( HWND hwnd ) DECLSPEC_HIDDEN;
-extern struct x11drv_win_data *X11DRV_create_win_data( HWND hwnd ) DECLSPEC_HIDDEN;
 extern Window X11DRV_get_whole_window( HWND hwnd ) DECLSPEC_HIDDEN;
 extern XIC X11DRV_get_ic( HWND hwnd ) DECLSPEC_HIDDEN;
 




More information about the wine-cvs mailing list