Alexandre Julliard : winex11: Add window data locking to the drag and drop functions.

Alexandre Julliard julliard at winehq.org
Tue Sep 18 14:04:29 CDT 2012


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Sep 18 11:37:33 2012 +0200

winex11: Add window data locking to the drag and drop functions.

---

 dlls/winex11.drv/event.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index 1134316..0e8ba04 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 */




More information about the wine-cvs mailing list