Alexandre Julliard : winex11.drv: Update the X11 window position when the primary monitor origin changes.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Nov 14 05:14:12 CST 2006


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Nov 14 10:40:49 2006 +0100

winex11.drv: Update the X11 window position when the primary monitor origin changes.

---

 dlls/winex11.drv/winpos.c |   39 ++++++++++++++++++++++++++++-----------
 1 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c
index b3e70f5..552622e 100644
--- a/dlls/winex11.drv/winpos.c
+++ b/dlls/winex11.drv/winpos.c
@@ -1224,17 +1224,36 @@ void X11DRV_UnmapNotify( HWND hwnd, XEve
     else WIN_ReleasePtr( win );
 }
 
+struct desktop_resize_data
+{
+    RECT  old_screen_rect;
+    RECT  old_virtual_rect;
+};
 
-static BOOL CALLBACK update_windows_fullscreen_state( HWND hwnd, LPARAM lparam )
+static BOOL CALLBACK update_windows_on_desktop_resize( HWND hwnd, LPARAM lparam )
 {
     struct x11drv_win_data *data;
     Display *display = thread_display();
-    RECT *old_screen_rect = (RECT *)lparam;
+    struct desktop_resize_data *resize_data = (struct desktop_resize_data *)lparam;
+    int mask = 0;
+
+    if (!(data = X11DRV_get_win_data( hwnd ))) return TRUE;
+
+    if (GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)
+        update_fullscreen_state( display, data, &data->client_rect, &resize_data->old_screen_rect );
 
-    if ((data = X11DRV_get_win_data( hwnd )) &&
-        (GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
+    if (resize_data->old_virtual_rect.left != virtual_screen_rect.left) mask |= CWX;
+    if (resize_data->old_virtual_rect.top != virtual_screen_rect.top) mask |= CWY;
+    if (mask && data->whole_window)
     {
-        update_fullscreen_state( display, data, &data->client_rect, old_screen_rect );
+        XWindowChanges changes;
+
+        wine_tsx11_lock();
+        changes.x = data->whole_rect.left - virtual_screen_rect.left;
+        changes.y = data->whole_rect.top - virtual_screen_rect.top;
+        XReconfigureWMWindow( display, data->whole_window,
+                              DefaultScreen(display), mask, &changes );
+        wine_tsx11_unlock();
     }
     return TRUE;
 }
@@ -1245,15 +1264,14 @@ static BOOL CALLBACK update_windows_full
  */
 void X11DRV_handle_desktop_resize( unsigned int width, unsigned int height )
 {
-    unsigned int old_screen_width, old_screen_height;
-    RECT rect;
     HWND hwnd = GetDesktopWindow();
     struct x11drv_win_data *data;
+    struct desktop_resize_data resize_data;
 
     if (!(data = X11DRV_get_win_data( hwnd ))) return;
 
-    old_screen_width = screen_width;
-    old_screen_height = screen_height;
+    SetRect( &resize_data.old_screen_rect, 0, 0, screen_width, screen_height );
+    resize_data.old_virtual_rect = virtual_screen_rect;
 
     screen_width  = width;
     screen_height = height;
@@ -1266,8 +1284,7 @@ void X11DRV_handle_desktop_resize( unsig
     SendMessageTimeoutW( HWND_BROADCAST, WM_DISPLAYCHANGE, screen_depth,
                          MAKELPARAM( width, height ), SMTO_ABORTIFHUNG, 2000, NULL );
 
-    SetRect( &rect, 0, 0, old_screen_width, old_screen_height );
-    EnumWindows( update_windows_fullscreen_state, (LPARAM)&rect );
+    EnumWindows( update_windows_on_desktop_resize, (LPARAM)&resize_data );
 }
 
 




More information about the wine-cvs mailing list