Index: dlls/winex11.drv/keyboard.c
===================================================================
RCS file: /home/wine/wine/dlls/winex11.drv/keyboard.c,v
retrieving revision 1.24
diff -u -r1.24 keyboard.c
--- dlls/winex11.drv/keyboard.c	8 Jan 2007 20:45:56 -0000	1.24
+++ dlls/winex11.drv/keyboard.c	24 Jan 2007 21:31:54 -0000
@@ -1833,7 +1833,23 @@
  */
 SHORT X11DRV_GetAsyncKeyState(INT key)
 {
-    SHORT retval = ((key_state_table[key] & 0x40) ? 0x0001 : 0) |
+    Window root, child;
+    int rootX, rootY, winX, winY;
+    unsigned int xstate;
+    Display *display = thread_display();
+    SHORT retval;
+
+    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 ))
+             X11DRV_update_button_state( xstate );
+        wine_tsx11_unlock();
+    }
+
+    retval = ((key_state_table[key] & 0x40) ? 0x0001 : 0) |
                    ((key_state_table[key] & 0x80) ? 0x8000 : 0);
     key_state_table[key] &= ~0x40;
     TRACE_(key)("(%x) -> %x\n", key, retval);
Index: dlls/winex11.drv/mouse.c
===================================================================
RCS file: /home/wine/wine/dlls/winex11.drv/mouse.c,v
retrieving revision 1.12
diff -u -r1.12 mouse.c
--- dlls/winex11.drv/mouse.c	6 Jan 2007 11:14:36 -0000	1.12
+++ dlls/winex11.drv/mouse.c	24 Jan 2007 21:31:55 -0000
@@ -108,7 +108,7 @@
  *
  * Update the button state with what X provides us
  */
-static inline void update_button_state( unsigned int state )
+void X11DRV_update_button_state( unsigned int state )
 {
     key_state_table[VK_LBUTTON] = (state & Button1Mask ? 0x80 : 0);
     key_state_table[VK_MBUTTON] = (state & Button2Mask ? 0x80 : 0);
@@ -729,7 +729,7 @@
         XQueryPointer( display, root_window, &root, &child,
                        &rootX, &rootY, &winX, &winY, &xstate ))
     {
-        update_button_state( xstate );
+        X11DRV_update_button_state( xstate );
         winX += virtual_screen_rect.left;
         winY += virtual_screen_rect.top;
         TRACE("pointer at (%d,%d)\n", winX, winY );
Index: dlls/winex11.drv/x11drv.h
===================================================================
RCS file: /home/wine/wine/dlls/winex11.drv/x11drv.h,v
retrieving revision 1.14
diff -u -r1.14 x11drv.h
--- dlls/winex11.drv/x11drv.h	6 Jan 2007 11:14:36 -0000	1.14
+++ dlls/winex11.drv/x11drv.h	24 Jan 2007 21:31:57 -0000
@@ -666,6 +666,7 @@
 extern int X11DRV_AcquireClipboard(HWND hWndClipWindow);
 extern void X11DRV_ResetSelectionOwner(void);
 extern void X11DRV_SetFocus( HWND hwnd );
+extern void X11DRV_update_button_state( unsigned int state );
 extern Cursor X11DRV_GetCursor( Display *display, struct tagCURSORICONINFO *ptr );
 extern BOOL X11DRV_ClipCursor( LPCRECT clip );
 extern void X11DRV_InitKeyboard(void);
