Alexandre Julliard : winex11: Replace the lock_changes flag by a check on the event currently being processed .

Alexandre Julliard julliard at winehq.org
Wed Apr 2 16:36:15 CDT 2008


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Apr  2 16:43:49 2008 +0200

winex11: Replace the lock_changes flag by a check on the event currently being processed.

---

 dlls/winex11.drv/event.c  |    4 ----
 dlls/winex11.drv/winpos.c |   20 ++++++++++++++++----
 dlls/winex11.drv/x11drv.h |    1 -
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index c57d497..8fd9b20 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -743,17 +743,13 @@ static void handle_wm_state_notify( struct x11drv_win_data *data, XPropertyEvent
 
         TRACE( "restoring win %p/%lx\n", data->hwnd, data->whole_window );
         data->iconic = FALSE;
-        data->lock_changes++;
         SetWindowPlacement( data->hwnd, &wp );
-        data->lock_changes--;
     }
     else if (!data->iconic && data->wm_state == IconicState)
     {
         TRACE( "minimizing win %p/%lx\n", data->hwnd, data->whole_window );
         data->iconic = TRUE;
-        data->lock_changes++;
         ShowWindow( data->hwnd, SW_MINIMIZE );
-        data->lock_changes--;
     }
 }
 
diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c
index e60d42a..e858acf 100644
--- a/dlls/winex11.drv/winpos.c
+++ b/dlls/winex11.drv/winpos.c
@@ -300,10 +300,12 @@ void X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, UINT swp_flags,
                           const RECT *rectWindow, const RECT *rectClient,
                           const RECT *visible_rect, const RECT *valid_rects )
 {
-    Display *display = thread_display();
+    struct x11drv_thread_data *thread_data = x11drv_thread_data();
+    Display *display = thread_data->display;
     struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
     DWORD new_style = GetWindowLongW( hwnd, GWL_STYLE );
     RECT old_window_rect, old_whole_rect, old_client_rect;
+    int event_type;
 
     if (!data)
     {
@@ -379,7 +381,19 @@ void X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, UINT swp_flags,
 
     X11DRV_sync_client_position( display, data, swp_flags, &old_client_rect, &old_whole_rect );
 
-    if (!data->whole_window || data->lock_changes) return;  /* nothing more to do */
+    if (!data->whole_window) return;
+
+    /* check if we are currently processing an event relevant to this window */
+    event_type = 0;
+    if (thread_data->current_event && thread_data->current_event->xany.window == data->whole_window)
+        event_type = thread_data->current_event->type;
+
+    if (event_type == ConfigureNotify || event_type == PropertyNotify)
+    {
+        TRACE( "not changing window %p/%lx while processing event %u\n",
+               hwnd, data->whole_window, event_type );
+        return;
+    }
 
     if (data->mapped && (!(new_style & WS_VISIBLE) || !X11DRV_is_window_rect_mapped( rectWindow )))
     {
@@ -578,9 +592,7 @@ void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
         TRACE( "%p resizing from (%dx%d) 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/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index fbf9ebc..ab5ff76 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -678,7 +678,6 @@ struct x11drv_win_data
     BOOL        iconic : 1;     /* is window in iconic state? */
     int         wm_state;       /* current value of the WM_STATE property */
     DWORD       net_wm_state;   /* bit mask of active x11drv_net_wm_state values */
-    unsigned int lock_changes;  /* lock count for X11 change requests */
     HBITMAP     hWMIconBitmap;
     HBITMAP     hWMIconMask;
 };




More information about the wine-cvs mailing list