USER: make GetAsyncState truely asynchronous

Mike McCormack mike at codeweavers.com
Fri Oct 29 00:51:57 CDT 2004


This solves problems with Visio 2000's menus.

Mike


ChangeLog:
* make GetAsyncState truely asynchronous
-------------- next part --------------
Index: dlls/user/user_main.c
===================================================================
RCS file: /home/wine/wine/dlls/user/user_main.c,v
retrieving revision 1.70
diff -u -r1.70 user_main.c
--- dlls/user/user_main.c	18 Oct 2004 21:25:26 -0000	1.70
+++ dlls/user/user_main.c	29 Oct 2004 05:42:54 -0000
@@ -130,6 +130,7 @@
     GET_USER_FUNC(SetWindowText);
     GET_USER_FUNC(ShowWindow);
     GET_USER_FUNC(SysCommandSizeMove);
+    GET_USER_FUNC(GetAsyncKeyState);
 
     return TRUE;
 }
Index: dlls/x11drv/mouse.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/mouse.c,v
retrieving revision 1.14
diff -u -r1.14 mouse.c
--- dlls/x11drv/mouse.c	21 Nov 2003 21:48:36 -0000	1.14
+++ dlls/x11drv/mouse.c	29 Oct 2004 05:42:54 -0000
@@ -518,6 +518,30 @@
 }
 
 /***********************************************************************
+ *		GetAsyncKeyState (X11DRV.@)
+ */
+void X11DRV_GetAsyncKeyState( INT key )
+{
+  Display *display = thread_display();
+  Window root, child;
+  int rootX, rootY, winX, winY;
+  unsigned int xstate;
+
+  if (key == VK_LBUTTON || key == VK_MBUTTON || key == VK_RBUTTON ||
+      key == VK_SHIFT || key == VK_CONTROL)
+  {
+      wine_tsx11_lock();
+      if (XQueryPointer( display, root_window, &root, &child,
+                         &rootX, &rootY, &winX, &winY, &xstate ))
+      {
+          update_button_state( xstate );
+          update_key_state( xstate );
+      }
+      wine_tsx11_unlock();
+  }
+}
+
+/***********************************************************************
  *		GetCursorPos (X11DRV.@)
  */
 void X11DRV_GetCursorPos(LPPOINT pos)
@@ -531,8 +555,6 @@
   if (XQueryPointer( display, root_window, &root, &child,
                      &rootX, &rootY, &winX, &winY, &xstate ))
   {
-      update_key_state( xstate );
-      update_button_state( xstate );
       TRACE("pointer at (%d,%d)\n", winX, winY );
       pos->x = winX;
       pos->y = winY;
Index: dlls/x11drv/x11drv.spec
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/x11drv.spec,v
retrieving revision 1.60
diff -u -r1.60 x11drv.spec
--- dlls/x11drv/x11drv.spec	2 Aug 2004 18:54:54 -0000	1.60
+++ dlls/x11drv/x11drv.spec	29 Oct 2004 05:42:54 -0000
@@ -110,6 +110,7 @@
 @ cdecl SetWindowText(long wstr) X11DRV_SetWindowText
 @ cdecl ShowWindow(long long) X11DRV_ShowWindow
 @ cdecl SysCommandSizeMove(long long) X11DRV_SysCommandSizeMove
+@ cdecl GetAsyncKeyState(long) X11DRV_GetAsyncKeyState
 
 # WinTab32
 @ cdecl AttachEventQueueToTablet(long) X11DRV_AttachEventQueueToTablet
Index: include/user.h
===================================================================
RCS file: /home/wine/wine/include/user.h,v
retrieving revision 1.66
diff -u -r1.66 user.h
--- include/user.h	1 Sep 2004 18:26:41 -0000	1.66
+++ include/user.h	29 Oct 2004 05:42:54 -0000
@@ -123,6 +123,7 @@
     BOOL   (*pSetWindowText)(HWND,LPCWSTR);
     BOOL   (*pShowWindow)(HWND,INT);
     void   (*pSysCommandSizeMove)(HWND,WPARAM);
+    void   (*pGetAsyncKeyState)(INT);
 } USER_DRIVER;
 
 extern USER_DRIVER USER_Driver;
Index: windows/input.c
===================================================================
RCS file: /home/wine/wine/windows/input.c,v
retrieving revision 1.99
diff -u -r1.99 input.c
--- windows/input.c	1 Sep 2004 22:47:48 -0000	1.99
+++ windows/input.c	29 Oct 2004 05:42:54 -0000
@@ -597,8 +597,11 @@
  */
 SHORT WINAPI GetAsyncKeyState(INT nKey)
 {
-    SHORT retval = ((AsyncKeyStateTable[nKey] & 0x80) ? 0x0001 : 0) |
-                   ((InputKeyStateTable[nKey] & 0x80) ? 0x8000 : 0);
+    SHORT retval;
+
+    if (USER_Driver.pGetAsyncKeyState) USER_Driver.pGetAsyncKeyState( nKey );
+    retval = ((AsyncKeyStateTable[nKey] & 0x80) ? 0x0001 : 0) |
+                  ((InputKeyStateTable[nKey] & 0x80) ? 0x8000 : 0);
     AsyncKeyStateTable[nKey] = 0;
     TRACE_(key)("(%x) -> %x\n", nKey, retval);
     return retval;


More information about the wine-patches mailing list