Fix the code which generates fake keypresses when an X window gains focus to
bring the X servers idea of the state of these mode keys in to sync with any
changes which might have taken place whilst unfocused.

With MPX changes, the place the server stores the current mode key state has
changed, appears they are now only held on the virtual core keyboard.

Signed-off-by: Jon TURNEY <jon.tur...@dronecode.org.uk>
---
 hw/xwin/winkeybd.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c
index 24a7b43..0c07c2f 100644
--- a/hw/xwin/winkeybd.c
+++ b/hw/xwin/winkeybd.c
@@ -49,10 +49,6 @@
 
 static Bool g_winKeyState[NUM_KEYCODES];
 
-/* Stored to get internal mode key states.  Must be read-only.  */
-static unsigned short const *g_winInternalModeKeyStatesPtr = NULL;
-
-
 /*
  * Local prototypes
  */
@@ -209,7 +205,6 @@ winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt,
 static void
 winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl)
 {
-  g_winInternalModeKeyStatesPtr = &(pDevice->key->state);
 }
 
 
@@ -297,19 +292,15 @@ winKeybdProc (DeviceIntPtr pDeviceInt, int iState)
             }
         }
 #endif
-
-      g_winInternalModeKeyStatesPtr = &(pDeviceInt->key->state);
       break;
       
     case DEVICE_ON: 
       pDevice->on = TRUE;
-      g_winInternalModeKeyStatesPtr = &(pDeviceInt->key->state);
       break;
 
     case DEVICE_CLOSE:
     case DEVICE_OFF: 
       pDevice->on = FALSE;
-      g_winInternalModeKeyStatesPtr = NULL;
       break;
     }
 
@@ -371,7 +362,7 @@ winRestoreModeKeyStates ()
   unsigned short       internalKeyStates;
 
   /* X server is being initialized */
-  if (!g_winInternalModeKeyStatesPtr)
+  if (!inputInfo.keyboard)
     return;
 
   /* Only process events if the rootwindow is mapped. The keyboard events
@@ -384,7 +375,9 @@ winRestoreModeKeyStates ()
     mieqProcessInputEvents ();
   
   /* Read the mode key states of our X server */
-  internalKeyStates = *g_winInternalModeKeyStatesPtr;
+  /* (stored in the virtual core keyboard) */
+  internalKeyStates = inputInfo.keyboard->key->state;
+  winDebug("winRestoreModeKeyStates: state %d\n", internalKeyStates);
 
   /* 
    * NOTE: The C XOR operator, ^, will not work here because it is
-- 
1.6.0.4

_______________________________________________
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg

Reply via email to