winex11: Store a pointer to the X11 event currently being handled instead of a simple count.

This commit is contained in:
Alexandre Julliard 2008-03-13 13:35:02 +01:00
parent 36ac341b55
commit 5977c72325
3 changed files with 10 additions and 15 deletions

View File

@ -291,6 +291,8 @@ static inline void call_event_handler( Display *display, XEvent *event )
{
HWND hwnd;
x11drv_event_handler handler;
XEvent *prev;
struct x11drv_thread_data *thread_data;
if (!(handler = find_handler( event->type )))
{
@ -305,7 +307,11 @@ static inline void call_event_handler( Display *display, XEvent *event )
TRACE( "%s for hwnd/window %p/%lx\n",
dbgstr_event( event->type ), hwnd, event->xany.window );
wine_tsx11_unlock();
thread_data = x11drv_thread_data();
prev = thread_data->current_event;
thread_data->current_event = event;
handler( hwnd, event );
thread_data->current_event = prev;
wine_tsx11_lock();
}
@ -364,9 +370,7 @@ DWORD X11DRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
timeout, flags & MWMO_ALERTABLE );
}
if (data->process_event_count) mask = 0; /* don't process nested events */
data->process_event_count++;
if (data->current_event) mask = 0; /* don't process nested events */
if (process_events( data->display, filter_event, mask )) ret = count - 1;
else if (count || timeout)
@ -377,7 +381,6 @@ DWORD X11DRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
}
else ret = WAIT_TIMEOUT;
data->process_event_count--;
return ret;
}

View File

@ -499,7 +499,7 @@ struct x11drv_escape_set_drawable
struct x11drv_thread_data
{
Display *display;
int process_event_count; /* recursion count for event processing */
XEvent *current_event; /* event currently being processed */
Cursor cursor; /* current cursor */
Window cursor_window; /* current window that contains the cursor */
Window grab_window; /* window that currently grabs the mouse */

View File

@ -617,7 +617,7 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
{
struct x11drv_thread_data *data;
if (!(data = HeapAlloc( GetProcessHeap(), 0, sizeof(*data) )))
if (!(data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data) )))
{
ERR( "could not create data\n" );
ExitProcess(1);
@ -651,18 +651,10 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
if (TRACE_ON(synchronous)) XSynchronize( data->display, True );
wine_tsx11_unlock();
if (!use_xim)
data->xim = NULL;
else if (!(data->xim = X11DRV_SetupXIM( data->display, input_style )))
if (use_xim && !(data->xim = X11DRV_SetupXIM( data->display, input_style )))
WARN("Input Method is not available\n");
set_queue_display_fd( data->display );
data->process_event_count = 0;
data->cursor = None;
data->cursor_window = None;
data->grab_window = None;
data->last_focus = 0;
data->selection_wnd = 0;
TlsSetValue( thread_data_tls_index, data );
X11DRV_SetCursor( NULL );
return data;