Alexandre Julliard : winex11: Move handling of WM_STATE changes to a separate function, and call it directly from wait_from_withdrawn_state.
Alexandre Julliard
julliard at winehq.org
Wed Apr 2 16:36:15 CDT 2008
Module: wine
Branch: master
Commit: f89aa1282907bb5d1192fbdaa53becbb6a109150
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f89aa1282907bb5d1192fbdaa53becbb6a109150
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Apr 2 15:55:25 2008 +0200
winex11: Move handling of WM_STATE changes to a separate function, and call it directly from wait_from_withdrawn_state.
---
dlls/winex11.drv/event.c | 56 ++++++++++++++++++++++++++++++++-------------
1 files changed, 40 insertions(+), 16 deletions(-)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index cd6eaf6..1bcec8c 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -687,28 +687,19 @@ int get_window_wm_state( Display *display, struct x11drv_win_data *data )
/***********************************************************************
- * EVENT_PropertyNotify
+ * handle_wm_state_notify
+ *
+ * Handle a PropertyNotify for WM_STATE.
*/
-static void EVENT_PropertyNotify( HWND hwnd, XEvent *xev )
+static void handle_wm_state_notify( struct x11drv_win_data *data, XPropertyEvent *event )
{
- XPropertyEvent *event = &xev->xproperty;
- struct x11drv_win_data *data;
-
- if (!hwnd) return;
- if (!(data = X11DRV_get_win_data( hwnd ))) return;
-
switch(event->state)
{
case PropertyDelete:
- if (event->atom == x11drv_atom(WM_STATE))
- {
- data->wm_state = WithdrawnState;
- TRACE( "%p/%lx: WM_STATE deleted\n", data->hwnd, data->whole_window );
- }
+ data->wm_state = WithdrawnState;
+ TRACE( "%p/%lx: WM_STATE deleted\n", data->hwnd, data->whole_window );
break;
-
case PropertyNewValue:
- if (event->atom == x11drv_atom(WM_STATE))
{
int new_state = get_window_wm_state( event->display, data );
if (new_state != -1 && new_state != data->wm_state)
@@ -722,6 +713,21 @@ static void EVENT_PropertyNotify( HWND hwnd, XEvent *xev )
}
+/***********************************************************************
+ * EVENT_PropertyNotify
+ */
+static void EVENT_PropertyNotify( HWND hwnd, XEvent *xev )
+{
+ XPropertyEvent *event = &xev->xproperty;
+ struct x11drv_win_data *data;
+
+ if (!hwnd) return;
+ if (!(data = X11DRV_get_win_data( hwnd ))) return;
+
+ if (event->atom == x11drv_atom(WM_STATE)) handle_wm_state_notify( data, event );
+}
+
+
/* event filter to wait for a WM_STATE change notification on a window */
static Bool is_wm_state_notify( Display *display, XEvent *event, XPointer arg )
{
@@ -744,7 +750,25 @@ void wait_for_withdrawn_state( Display *display, struct x11drv_win_data *data, B
while (data->whole_window && ((data->wm_state == WithdrawnState) == !set))
{
- if (!process_events( display, is_wm_state_notify, data->whole_window ))
+ XEvent event;
+ int count = 0;
+
+ wine_tsx11_lock();
+ while (XCheckIfEvent( display, &event, is_wm_state_notify, (char *)data->whole_window ))
+ {
+ count++;
+ if (XFilterEvent( &event, None )) continue; /* filtered, ignore it */
+ if (event.type == DestroyNotify) call_event_handler( display, &event );
+ else
+ {
+ wine_tsx11_unlock();
+ handle_wm_state_notify( data, &event.xproperty );
+ wine_tsx11_lock();
+ }
+ }
+ wine_tsx11_unlock();
+
+ if (!count)
{
struct pollfd pfd;
int timeout = end - GetTickCount();
More information about the wine-cvs
mailing list