Fixing pointer grabbing again
Jukka Heinonen
jhei at iki.fi
Sun Aug 26 13:12:14 CDT 2001
Changes in window procedure handling made it necessary
to use SetWindowLong instead of directly accessing winproc
field of struct WND. Hopefully, after this fix, GrabPointer
does not need fixing until Wine supports SetWindowLongPtr.
Changelog:
GrabPointer uses now SetWindowLong to change window procedure instead
of accessing directly WND structure.
Index: wine/dlls/x11drv/x11ddraw.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/x11ddraw.c,v
retrieving revision 1.11
diff -B -u -r1.11 x11ddraw.c
--- wine/dlls/x11drv/x11ddraw.c 2001/08/06 18:47:25 1.11
+++ wine/dlls/x11drv/x11ddraw.c 2001/08/26 17:54:47
@@ -78,8 +78,6 @@
static void GrabPointer(BOOL grab)
{
- WND* pWnd;
-
if(grab) {
Window window = X11DRV_get_whole_window(GetFocus());
if(window)
@@ -88,28 +86,15 @@
if(!X11DRV_DD_GrabMessage)
X11DRV_DD_GrabMessage = RegisterWindowMessageA("WINE_X11DRV_GRABPOINTER");
-
- pWnd = WIN_FindWndPtr(X11DRV_DD_PrimaryWnd);
- if(!pWnd)
- return;
- X11DRV_DD_GrabOldProcedure = pWnd->winproc;
- pWnd->winproc = GrabWndProc;
+ /* FIXME: Replace with SetWindowLongPtrA when available */
+ X11DRV_DD_GrabOldProcedure = (WNDPROC)SetWindowLongA(X11DRV_DD_PrimaryWnd, GWL_WNDPROC, (LONG)GrabWndProc);
- WIN_ReleaseWndPtr(pWnd);
-
SendMessageA(X11DRV_DD_PrimaryWnd, X11DRV_DD_GrabMessage, grab ? 1 : 0, 0);
-
- pWnd = WIN_FindWndPtr(X11DRV_DD_PrimaryWnd);
- if(!pWnd)
- return;
- if(pWnd->winproc != GrabWndProc)
+ /* FIXME: Replace with SetWindowLongPtrA when available */
+ if(SetWindowLongA(X11DRV_DD_PrimaryWnd, GWL_WNDPROC, (LONG)X11DRV_DD_GrabOldProcedure) != (LONG)GrabWndProc)
ERR("Window procedure has been changed!\n");
- else
- pWnd->winproc = X11DRV_DD_GrabOldProcedure;
-
- WIN_ReleaseWndPtr(pWnd);
}
static DWORD PASCAL X11DRV_DDHAL_DestroyDriver(LPDDHAL_DESTROYDRIVERDATA data)
--
Jukka Heinonen <http://www.iki.fi/jhei/>
More information about the wine-patches
mailing list