From 731e497a8737b3656e50245219fe323f9a73f148 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 18 Sep 2012 11:37:33 +0200 Subject: [PATCH] winex11: Add window data locking to the drag and drop functions. --- dlls/winex11.drv/event.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 11343160534..0e8ba04bed4 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1286,23 +1286,24 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event ) unsigned long aux_long; unsigned char* p_data = NULL; Atom atom_aux; - int x, y, dummy; + int x, y, cx, cy, dummy; BOOL bAccept; Window win, w_aux_root, w_aux_child; - win = X11DRV_get_whole_window(hWnd); + if (!(data = get_win_data( hWnd ))) return; + cx = data->whole_rect.right - data->whole_rect.left; + cy = data->whole_rect.bottom - data->whole_rect.top; + win = data->whole_window; + release_win_data( data ); + XQueryPointer( event->display, win, &w_aux_root, &w_aux_child, &x, &y, &dummy, &dummy, (unsigned int*)&aux_long); x += virtual_screen_rect.left; y += virtual_screen_rect.top; - if (!(data = X11DRV_get_win_data( hWnd ))) return; - /* find out drop point and drop window */ - if( x < 0 || y < 0 || - x > (data->whole_rect.right - data->whole_rect.left) || - y > (data->whole_rect.bottom - data->whole_rect.top) ) - { + if (x < 0 || y < 0 || x > cx || y > cy) + { bAccept = GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES; x = 0; y = 0; @@ -1439,7 +1440,7 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event ) hDrop = GlobalAlloc( GMEM_SHARE, drop_len ); lpDrop = GlobalLock( hDrop ); - if( lpDrop && (win_data = X11DRV_get_win_data( hWnd ))) + if( lpDrop && (win_data = get_win_data( hWnd ))) { lpDrop->pFiles = sizeof(DROPFILES); lpDrop->pt.x = x; @@ -1451,6 +1452,7 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event ) y > (win_data->client_rect.bottom - win_data->whole_rect.top) ); lpDrop->fWide = FALSE; p_drop = (char*)(lpDrop + 1); + release_win_data( win_data ); } /* create message content */