Alexandre Julliard : x11drv: Replace the SWP_WINE_NOHOSTMOVE flag by a lock count.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Mar 30 05:44:00 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 3217e534fe20dcc19088229ce7cf82937a32b490
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=3217e534fe20dcc19088229ce7cf82937a32b490

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Mar 29 18:27:01 2006 +0200

x11drv: Replace the SWP_WINE_NOHOSTMOVE flag by a lock count.

---

 dlls/x11drv/window.c |    4 ++--
 dlls/x11drv/winpos.c |   25 +++++++++++++++++--------
 dlls/x11drv/x11drv.h |    1 +
 include/winpos.h     |    3 ---
 4 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/dlls/x11drv/window.c b/dlls/x11drv/window.c
index 592d874..a3fff6f 100644
--- a/dlls/x11drv/window.c
+++ b/dlls/x11drv/window.c
@@ -602,8 +602,7 @@ void X11DRV_sync_window_position( Displa
     data->client_rect = *new_client_rect;
     OffsetRect( &data->client_rect, -data->whole_rect.left, -data->whole_rect.top );
 
-    if (!data->whole_window) return;
-    if (swp_flags & SWP_WINE_NOHOSTMOVE) return;
+    if (!data->whole_window || data->lock_changes) return;
 
     mask = get_window_changes( &changes, &old_whole_rect, &data->whole_rect );
 
@@ -837,6 +836,7 @@ static struct x11drv_win_data *alloc_win
         data->xic           = 0;
         data->managed       = FALSE;
         data->dce           = NULL;
+        data->lock_changes  = 0;
         data->hWMIconBitmap = 0;
         data->hWMIconMask   = 0;
 
diff --git a/dlls/x11drv/winpos.c b/dlls/x11drv/winpos.c
index 331d6d4..5bf9368 100644
--- a/dlls/x11drv/winpos.c
+++ b/dlls/x11drv/winpos.c
@@ -567,7 +567,7 @@ BOOL X11DRV_set_window_pos( HWND hwnd, H
     {
         req->handle        = hwnd;
         req->previous      = insert_after;
-        req->flags         = swp_flags & ~SWP_WINE_NOHOSTMOVE;
+        req->flags         = swp_flags;
         req->window.left   = rectWindow->left;
         req->window.top    = rectWindow->top;
         req->window.right  = rectWindow->right;
@@ -625,7 +625,7 @@ BOOL X11DRV_set_window_pos( HWND hwnd, H
 
         /* FIXME: copy the valid bits */
 
-        if (data->whole_window && !(swp_flags & SWP_WINE_NOHOSTMOVE))
+        if (data->whole_window && !data->lock_changes)
         {
             if ((old_style & WS_VISIBLE) && !(new_style & WS_VISIBLE))
             {
@@ -647,7 +647,7 @@ BOOL X11DRV_set_window_pos( HWND hwnd, H
 
         X11DRV_sync_window_position( display, data, swp_flags, rectClient, &new_whole_rect );
 
-        if (data->whole_window && !(swp_flags & SWP_WINE_NOHOSTMOVE))
+        if (data->whole_window && !data->lock_changes)
         {
             if ((new_style & WS_VISIBLE) && !(new_style & WS_MINIMIZE) &&
                 X11DRV_is_window_rect_mapped( rectWindow ))
@@ -694,7 +694,6 @@ BOOL X11DRV_SetWindowPos( WINDOWPOS *win
            winpos->cx, winpos->cy, winpos->flags);
 
     orig_flags = winpos->flags;
-    winpos->flags &= ~SWP_WINE_NOHOSTMOVE;
 
     /* First make sure that coordinates are valid for WM_WINDOWPOSCHANGING */
     if (!(winpos->flags & SWP_NOMOVE))
@@ -1107,8 +1106,10 @@ void X11DRV_MapNotify( HWND hwnd, XEvent
         WIN_ReleasePtr( win );
 
         SendMessageA( hwnd, WM_SHOWWINDOW, SW_RESTORE, 0 );
+        data->lock_changes++;
         SetWindowPos( hwnd, 0, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top,
-                      SWP_NOZORDER | SWP_WINE_NOHOSTMOVE );
+                      SWP_NOZORDER );
+        data->lock_changes--;
     }
     else WIN_ReleasePtr( win );
     if (hwndFocus && IsChild( hwnd, hwndFocus )) X11DRV_SetFocus(hwndFocus);  /* FIXME */
@@ -1140,8 +1141,10 @@ void X11DRV_UnmapNotify( HWND hwnd, XEve
 
         EndMenu();
         SendMessageA( hwnd, WM_SHOWWINDOW, SW_MINIMIZE, 0 );
+        data->lock_changes++;
         SetWindowPos( hwnd, 0, 0, 0, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON),
-                      SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_WINE_NOHOSTMOVE );
+                      SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER );
+        data->lock_changes--;
     }
     else WIN_ReleasePtr( win );
 }
@@ -1154,12 +1157,16 @@ void X11DRV_handle_desktop_resize( unsig
 {
     RECT rect;
     HWND hwnd = GetDesktopWindow();
+    struct x11drv_win_data *data;
 
+    if (!(data = X11DRV_get_win_data( hwnd ))) return;
     screen_width  = width;
     screen_height = height;
     TRACE("desktop %p change to (%dx%d)\n", hwnd, width, height);
     SetRect( &rect, 0, 0, width, height );
-    X11DRV_set_window_pos( hwnd, 0, &rect, &rect, SWP_NOZORDER|SWP_NOMOVE|SWP_WINE_NOHOSTMOVE, NULL );
+    data->lock_changes++;
+    X11DRV_set_window_pos( hwnd, 0, &rect, &rect, SWP_NOZORDER|SWP_NOMOVE, NULL );
+    data->lock_changes--;
     SendMessageTimeoutW( HWND_BROADCAST, WM_DISPLAYCHANGE, screen_depth,
                          MAKELPARAM( width, height ), SMTO_ABORTIFHUNG, 2000, NULL );
 }
@@ -1202,7 +1209,7 @@ void X11DRV_ConfigureNotify( HWND hwnd, 
     y     = rect.top;
     cx    = rect.right - rect.left;
     cy    = rect.bottom - rect.top;
-    flags = SWP_NOACTIVATE | SWP_NOZORDER | SWP_WINE_NOHOSTMOVE;
+    flags = SWP_NOACTIVATE | SWP_NOZORDER;
 
     /* Compare what has changed */
 
@@ -1223,7 +1230,9 @@ void X11DRV_ConfigureNotify( HWND hwnd, 
         TRACE( "%p resizing from (%ldx%ld) to (%dx%d)\n",
                hwnd, rect.right - rect.left, rect.bottom - rect.top, cx, cy );
 
+    data->lock_changes++;
     SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
+    data->lock_changes--;
 }
 
 
diff --git a/dlls/x11drv/x11drv.h b/dlls/x11drv/x11drv.h
index c528c99..0ba4fce 100644
--- a/dlls/x11drv/x11drv.h
+++ b/dlls/x11drv/x11drv.h
@@ -643,6 +643,7 @@ struct x11drv_win_data
     XIC         xic;            /* X input context */
     BOOL        managed;        /* is window managed? */
     struct dce *dce;            /* DCE for CS_OWNDC or CS_CLASSDC windows */
+    unsigned int lock_changes;  /* lock count for X11 change requests */
     HBITMAP     hWMIconBitmap;
     HBITMAP     hWMIconMask;
 };
diff --git a/include/winpos.h b/include/winpos.h
index 27a950c..e480efc 100644
--- a/include/winpos.h
+++ b/include/winpos.h
@@ -31,9 +31,6 @@
 #define SWP_NOCLIENTSIZE	0x0800
 #define SWP_NOCLIENTMOVE	0x1000
 
-/* Wine extra SWP flag */
-#define SWP_WINE_NOHOSTMOVE	0x80000000
-
 extern BOOL WINPOS_RedrawIconTitle( HWND hWnd );
 extern BOOL WINPOS_ShowIconTitle( HWND hwnd, BOOL bShow );
 extern void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, POINT *minTrack,




More information about the wine-cvs mailing list