[PATCH 1/14] winex11.drv: Make X11DRV_window_to_X_rect use hwnd instead of win_data

Pierre d'Herbemont pdherbemont at free.fr
Sun Jan 21 17:34:22 CST 2007


Hi,

This set of patches is an attempt to factorize CreateWindow from
graphics drivers to user32.

The first part of the set consists in making drivers' SetWindowPos to
performs most of its jobs on a hwnd, even if there is no associated
win_data (graphics drivers' CreateWindow hasn't been called yet).

Then we move each messages called from winex11.drv's CreateWindow into
user32.

We have to add new parameters to the graphics drivers' CreateWindow
because we need to init the win_data's sizes, as the size of the window
and its client area will be changed threw the messages sent by user32's
CreateWindow, and at that time the win_data associated to the hwnd won't
exists.

Pierre.
---
   dlls/winex11.drv/window.c |   10 +++++-----
   dlls/winex11.drv/winpos.c |    2 +-
   dlls/winex11.drv/x11drv.h |    2 +-
   3 files changed, 7 insertions(+), 7 deletions(-)

-------------- next part --------------
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index e9fc4f0..ff83be5 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -634,17 +634,17 @@ void X11DRV_set_iconic_state( HWND hwnd
  *
  * Convert a rect from client to X window coordinates
  */
-void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect )
+void X11DRV_window_to_X_rect( HWND hwnd, RECT *rect )
 {
     RECT rc;
 
-    if (!data->managed) return;
+    if (!is_window_managed(hwnd)) return;
     if (IsRectEmpty( rect )) return;
 
     rc.top = rc.bottom = rc.left = rc.right = 0;
 
-    AdjustWindowRectEx( &rc, GetWindowLongW( data->hwnd, GWL_STYLE ) & ~(WS_HSCROLL|WS_VSCROLL),
-                        FALSE, GetWindowLongW( data->hwnd, GWL_EXSTYLE ) );
+    AdjustWindowRectEx( &rc, GetWindowLongW( hwnd, GWL_STYLE ) & ~(WS_HSCROLL|WS_VSCROLL),
+                        FALSE, GetWindowLongW( hwnd, GWL_EXSTYLE ) );
 
     rect->left   -= rc.left;
     rect->right  -= rc.right;
@@ -756,7 +756,7 @@ static Window create_whole_window( Displ
     RECT rect;
 
     rect = data->window_rect;
-    X11DRV_window_to_X_rect( data, &rect );
+    X11DRV_window_to_X_rect( data->hwnd, &rect );
 
     if (!(cx = rect.right - rect.left)) cx = 1;
     if (!(cy = rect.bottom - rect.top)) cy = 1;
diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c
index 95afc40..2c28d36 100644
--- a/dlls/winex11.drv/winpos.c
+++ b/dlls/winex11.drv/winpos.c
@@ -254,7 +254,7 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWN
     if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
 
     new_whole_rect = *rectWindow;
-    X11DRV_window_to_X_rect( data, &new_whole_rect );
+    X11DRV_window_to_X_rect( hwnd, &new_whole_rect );
 
     old_client_rect = data->client_rect;
 
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index dc1d955..3aca542 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -679,7 +679,7 @@ typedef int (*x11drv_error_callback)( Di
 extern void X11DRV_expect_error( Display *display, x11drv_error_callback callback, void *arg );
 extern int X11DRV_check_error(void);
 extern void X11DRV_set_iconic_state( HWND hwnd );
-extern void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect );
+extern void X11DRV_window_to_X_rect( HWND hwnd, RECT *rect );
 extern void X11DRV_X_to_window_rect( struct x11drv_win_data *data, RECT *rect );
 extern void X11DRV_sync_window_style( Display *display, struct x11drv_win_data *data );
 extern void X11DRV_sync_window_position( Display *display, struct x11drv_win_data *data,


More information about the wine-patches mailing list