Dll separation (3)

Dimitrie O. Paun dpaun at rogers.com
Mon Sep 23 01:47:32 CDT 2002


More DLL separation work.

ChangeLog
  -- remove export of DRAG_QueryUpdate from USER
  -- get rid of associated 16 bit code from x11drv
  -- simplifications, cleanups, etc.

Index: dlls/user/user32.spec
===================================================================
RCS file: /var/cvs/wine/dlls/user/user32.spec,v
retrieving revision 1.53
diff -u -r1.53 user32.spec
--- dlls/user/user32.spec	20 Sep 2002 19:35:54 -0000	1.53
+++ dlls/user/user32.spec	23 Sep 2002 04:30:52 -0000
@@ -688,7 +687,6 @@
 @ cdecl CLIPBOARD_LookupFormat(long) CLIPBOARD_LookupFormat
 @ cdecl CLIPBOARD_ReleaseOwner() CLIPBOARD_ReleaseOwner
 @ cdecl DCE_InvalidateDCE(long ptr) DCE_InvalidateDCE
-@ cdecl DRAG_QueryUpdate(long long long) DRAG_QueryUpdate
 @ cdecl HOOK_CallHooksA(long long long long) HOOK_CallHooksA
 @ cdecl HOOK_CallHooksW(long long long long) HOOK_CallHooksW
 @ cdecl HOOK_IsHooked(long) HOOK_IsHooked
Index: dlls/x11drv/event.c
===================================================================
RCS file: /var/cvs/wine/dlls/x11drv/event.c,v
retrieving revision 1.8
diff -u -r1.8 event.c
--- dlls/x11drv/event.c	18 Sep 2002 23:09:50 -0000	1.8
+++ dlls/x11drv/event.c	23 Sep 2002 06:41:42 -0000
@@ -1093,6 +1093,56 @@
   }
 }
 
+static HWND find_drop_window( HWND hQueryWnd, LPPOINT lpPt )
+{
+    RECT tempRect;
+
+    if (!IsWindowEnabled(hQueryWnd)) return 0;
+    
+    GetWindowRect(hQueryWnd, &tempRect);
+
+    if(!PtInRect(&tempRect, *lpPt)) return 0;
+
+    if (!IsIconic( hQueryWnd ))
+    {
+        GetClientRect( hQueryWnd, &tempRect );
+        MapWindowPoints( hQueryWnd, 0, (LPPOINT)&tempRect, 2 );
+
+        if (PtInRect( &tempRect, *lpPt))
+        {
+            HWND *list = WIN_ListChildren( hQueryWnd );
+    	    HWND bResult = 0;
+
+            if (list)
+            {
+                int i;
+		
+                for (i = 0; list[i]; i++)
+                {
+                    if (GetWindowLongW( list[i], GWL_STYLE ) & WS_VISIBLE)
+                    {
+                        GetWindowRect( list[i], &tempRect );
+                        if (PtInRect( &tempRect, *lpPt )) break;
+                    }
+                }
+                if (list[i])
+                {
+                    if (IsWindowEnabled( list[i] ))
+                        bResult = find_drop_window( list[i], lpPt );
+                }
+                HeapFree( GetProcessHeap(), 0, list );
+            }
+            if(bResult) return bResult;
+        }
+    }
+
+    if(!(GetWindowLongA( hQueryWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES)) return 0;
+    
+    ScreenToClient(hQueryWnd, lpPt);
+
+    return hQueryWnd;
+}
+
 /**********************************************************************
  *           EVENT_DropFromOffix
  *
@@ -1100,49 +1150,55 @@
  */
 static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event )
 {
-  unsigned long		data_length;
-  unsigned long		aux_long;
-  unsigned char*	p_data = NULL;
-  union {
-    Atom		atom_aux;
-    struct {
-      int x;
-      int y;
-    } pt_aux;
-    int		i;
-  }		u;
-  int			x, y;
-  BOOL16	        bAccept;
-  HGLOBAL16		hDragInfo = GlobalAlloc16( GMEM_SHARE | GMEM_ZEROINIT, sizeof(DRAGINFO16));
-  LPDRAGINFO16          lpDragInfo = (LPDRAGINFO16) GlobalLock16(hDragInfo);
-  SEGPTR		spDragInfo = K32WOWGlobalLock16(hDragInfo);
-  Window		w_aux_root, w_aux_child;
-  WND*                  pWnd;
-
-  if( !lpDragInfo || !spDragInfo ) return;
-
-  pWnd = WIN_FindWndPtr(hWnd);
-
-  TSXQueryPointer( event->display, get_whole_window(pWnd), &w_aux_root, &w_aux_child,
-                   &x, &y, (int *) &u.pt_aux.x, (int *) &u.pt_aux.y,
-                   (unsigned int*)&aux_long);
-
-  lpDragInfo->hScope = HWND_16(hWnd);
-  lpDragInfo->pt.x = (INT16)x; lpDragInfo->pt.y = (INT16)y;
-
-  /* find out drop point and drop window */
-  if( x < 0 || y < 0 ||
-      x > (pWnd->rectWindow.right - pWnd->rectWindow.left) ||
-      y > (pWnd->rectWindow.bottom - pWnd->rectWindow.top) )
-    {   bAccept = pWnd->dwExStyle & WS_EX_ACCEPTFILES; x = y = 0; }
-  else
+    unsigned long	data_length;
+    unsigned long	aux_long;
+    unsigned char*	p_data = NULL;
+    union {
+    	Atom	atom_aux;
+    	struct {
+      	    int x;
+      	    int y;
+    	} 	pt_aux;
+    	int	i;
+    } 			u;
+    int			x, y;
+    BOOL	        bAccept;
+    Window		w_aux_root, w_aux_child;
+    WND*                pWnd;
+    HWND		hScope = hWnd;
+
+    pWnd = WIN_FindWndPtr(hWnd);
+
+    TSXQueryPointer( event->display, get_whole_window(pWnd), &w_aux_root, &w_aux_child,
+                     &x, &y, (int *) &u.pt_aux.x, (int *) &u.pt_aux.y,
+                     (unsigned int*)&aux_long);
+
+    /* find out drop point and drop window */
+    if( x < 0 || y < 0 ||
+        x > (pWnd->rectWindow.right - pWnd->rectWindow.left) ||
+        y > (pWnd->rectWindow.bottom - pWnd->rectWindow.top) )
+    {   
+	bAccept = pWnd->dwExStyle & WS_EX_ACCEPTFILES; 
+	x = 0;
+	y = 0; 
+    }
+    else
     {
-      bAccept = DRAG_QueryUpdate( hWnd, spDragInfo, TRUE );
-      x = lpDragInfo->pt.x; y = lpDragInfo->pt.y;
+    	POINT	pt = { x, y };
+        HWND    hwndDrop = find_drop_window( hWnd, &pt );
+	if (hwndDrop)
+	{
+	    x = pt.x;
+	    y = pt.y;
+	    hScope = hwndDrop;
+	    bAccept = TRUE;
+	}
+	else
+	{
+	    bAccept = FALSE;
+	}
     }
-  WIN_ReleaseWndPtr(pWnd);
-
-  GlobalFree16( hDragInfo );
+    WIN_ReleaseWndPtr(pWnd);
 
     if (!bAccept) return;
 
@@ -1179,7 +1235,7 @@
 
             if( lpDrop )
             {
-                WND *pDropWnd = WIN_FindWndPtr( HWND_32(lpDragInfo->hScope) );
+                WND *pDropWnd = WIN_FindWndPtr( hScope );
                 lpDrop->pFiles = sizeof(DROPFILES);
                 lpDrop->pt.x = x;
                 lpDrop->pt.y = y;
Index: windows/win.c
===================================================================
RCS file: /var/cvs/wine/windows/win.c,v
retrieving revision 1.189
diff -u -r1.189 win.c
--- windows/win.c	4 Sep 2002 19:37:02 -0000	1.189
+++ windows/win.c	23 Sep 2002 04:32:34 -0000
@@ -3112,12 +3112,12 @@
 
 
 /*******************************************************************
- *			DRAG_QueryUpdate
+ *			DRAG_QueryUpdate16
  *
  * recursively find a child that contains spDragInfo->pt point
  * and send WM_QUERYDROPOBJECT
  */
-BOOL16 DRAG_QueryUpdate( HWND hQueryWnd, SEGPTR spDragInfo, BOOL bNoSend )
+static BOOL16 DRAG_QueryUpdate16( HWND hQueryWnd, SEGPTR spDragInfo )
 {
     BOOL16 wParam, bResult = 0;
     POINT pt;
@@ -3157,7 +3157,7 @@
                 if (list[i])
                 {
                     if (IsWindowEnabled( list[i] ))
-                        bResult = DRAG_QueryUpdate( list[i], spDragInfo, bNoSend );
+                        bResult = DRAG_QueryUpdate16( list[i], spDragInfo );
                 }
                 HeapFree( GetProcessHeap(), 0, list );
             }
@@ -3171,9 +3171,7 @@
 
     ptrDragInfo->hScope = HWND_16(hQueryWnd);
 
-    if (bNoSend) bResult = (GetWindowLongA( hQueryWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES) != 0;
-    else bResult = SendMessage16( HWND_16(hQueryWnd), WM_QUERYDROPOBJECT,
-				  (WPARAM16)wParam, spDragInfo );
+    bResult = SendMessage16( HWND_16(hQueryWnd), WM_QUERYDROPOBJECT, (WPARAM16)wParam, spDragInfo );
 
     if( !bResult ) CONV_POINT32TO16( &pt, &ptrDragInfo->pt );
 
@@ -3272,7 +3270,7 @@
 	/* update DRAGINFO struct */
 	TRACE_(msg)("lpDI->hScope = %04x\n",lpDragInfo->hScope);
 
-	if( DRAG_QueryUpdate(WIN_Handle32(hwndScope), spDragInfo, FALSE) > 0 )
+	if( DRAG_QueryUpdate16(WIN_Handle32(hwndScope), spDragInfo) > 0 )
 	    hCurrentCursor = hCursor;
 	else
         {




More information about the wine-patches mailing list