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

This commit is contained in:
Alexandre Julliard 2008-04-02 16:43:49 +02:00
parent a442d3b46d
commit 86675edfee
3 changed files with 16 additions and 9 deletions

View File

@ -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--;
}
}

View File

@ -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--;
}

View File

@ -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;
};