diff options
author | marha <marha@users.sourceforge.net> | 2009-09-06 18:48:27 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-09-06 18:48:27 +0000 |
commit | a915739887477b28d924ecc8417ee107d125bd6c (patch) | |
tree | c02f315476b61892d1fd89182e18943dce8d6277 /xorg-server/hw/xwin/winkeybd.c | |
parent | 6f25a23db1df27e992c34f6fd4c82e83c44fc2e2 (diff) | |
download | vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.gz vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.bz2 vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.zip |
Switched to xorg-server-1.6.99.900.tar.gz
Diffstat (limited to 'xorg-server/hw/xwin/winkeybd.c')
-rw-r--r-- | xorg-server/hw/xwin/winkeybd.c | 129 |
1 files changed, 42 insertions, 87 deletions
diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c index d574f2053..611ea5d55 100644 --- a/xorg-server/hw/xwin/winkeybd.c +++ b/xorg-server/hw/xwin/winkeybd.c @@ -40,19 +40,10 @@ #include "winconfig.h" #include "winmsg.h" -#ifdef XKB -#ifndef XKB_IN_SERVER -#define XKB_IN_SERVER -#endif -#include <xkbsrv.h> -#endif +#include "xkbsrv.h" 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 +200,6 @@ winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt, static void winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl) { - g_winInternalModeKeyStatesPtr = &(pDevice->key->state); } @@ -221,93 +211,52 @@ winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl) int winKeybdProc (DeviceIntPtr pDeviceInt, int iState) { - KeySymsRec keySyms; - CARD8 modMap[MAP_LENGTH]; DevicePtr pDevice = (DevicePtr) pDeviceInt; -#ifdef XKB - XkbComponentNamesRec names; XkbSrvInfoPtr xkbi; XkbControlsPtr ctrl; -#endif switch (iState) { case DEVICE_INIT: winConfigKeyboard (pDeviceInt); - winGetKeyMappings (&keySyms, modMap); - -#ifdef XKB /* FIXME: Maybe we should use winGetKbdLeds () here? */ defaultKeyboardControl.leds = g_winInfo.keyboard.leds; -#else - defaultKeyboardControl.leds = g_winInfo.keyboard.leds; -#endif - -#ifdef XKB - if (g_winInfo.xkb.disable) - { -#endif - InitKeyboardDeviceStruct (pDevice, - &keySyms, - modMap, - winKeybdBell, - winKeybdCtrl); -#ifdef XKB - } - else - { - - names.keymap = g_winInfo.xkb.keymap; - names.keycodes = g_winInfo.xkb.keycodes; - names.types = g_winInfo.xkb.types; - names.compat = g_winInfo.xkb.compat; - names.symbols = g_winInfo.xkb.symbols; - names.geometry = g_winInfo.xkb.geometry; - - winErrorFVerb(2, "Rules = \"%s\" Model = \"%s\" Layout = \"%s\"" - " Variant = \"%s\" Options = \"%s\"\n", - g_winInfo.xkb.rules, g_winInfo.xkb.model, - g_winInfo.xkb.layout, g_winInfo.xkb.variant, - g_winInfo.xkb.options); - - XkbSetRulesDflts (g_winInfo.xkb.rules, g_winInfo.xkb.model, - g_winInfo.xkb.layout, g_winInfo.xkb.variant, - g_winInfo.xkb.options); - XkbInitKeyboardDeviceStruct (pDeviceInt, &names, &keySyms, - modMap, winKeybdBell, winKeybdCtrl); - } -#endif -#ifdef XKB - if (!g_winInfo.xkb.disable) - { - xkbi = pDeviceInt->key->xkbInfo; - if (xkbi != NULL) - { - ctrl = xkbi->desc->ctrls; - ctrl->repeat_delay = g_winInfo.keyboard.delay; - ctrl->repeat_interval = 1000/g_winInfo.keyboard.rate; - } - else - { - winErrorFVerb (1, "winKeybdProc - Error initializing keyboard AutoRepeat (No XKB)\n"); - } + winErrorFVerb(2, "Rules = \"%s\" Model = \"%s\" Layout = \"%s\"" + " Variant = \"%s\" Options = \"%s\"\n", + g_winInfo.xkb.rules ? g_winInfo.xkb.rules : "none", + g_winInfo.xkb.model ? g_winInfo.xkb.model : "none", + g_winInfo.xkb.layout ? g_winInfo.xkb.layout : "none", + g_winInfo.xkb.variant ? g_winInfo.xkb.variant : "none", + g_winInfo.xkb.options ? g_winInfo.xkb.options : "none"); + + InitKeyboardDeviceStruct (pDeviceInt, + &g_winInfo.xkb, + winKeybdBell, + winKeybdCtrl); + + xkbi = pDeviceInt->key->xkbInfo; + if ((xkbi != NULL) && (xkbi->desc != NULL)) + { + ctrl = xkbi->desc->ctrls; + ctrl->repeat_delay = g_winInfo.keyboard.delay; + ctrl->repeat_interval = 1000/g_winInfo.keyboard.rate; + } + else + { + winErrorFVerb (1, "winKeybdProc - Error initializing keyboard AutoRepeat\n"); } -#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; } @@ -362,14 +311,14 @@ winInitializeModeKeyStates (void) */ void -winRestoreModeKeyStates () +winRestoreModeKeyStates (void) { DWORD dwKeyState; BOOL processEvents = TRUE; 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 @@ -382,7 +331,9 @@ winRestoreModeKeyStates () mieqProcessInputEvents (); /* Read the mode key states of our X server */ - internalKeyStates = *g_winInternalModeKeyStatesPtr; + /* (stored in the virtual core keyboard) */ + internalKeyStates = XkbStateFieldFromRec(&inputInfo.keyboard->key->xkbInfo->state); + winDebug("winRestoreModeKeyStates: state %d\n", internalKeyStates); /* * NOTE: The C XOR operator, ^, will not work here because it is @@ -548,7 +499,7 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam) */ void -winKeybdReleaseKeys () +winKeybdReleaseKeys (void) { int i; @@ -580,7 +531,8 @@ winKeybdReleaseKeys () void winSendKeyEvent (DWORD dwKey, Bool fDown) { - xEvent xCurrentEvent; + EventListPtr events; + int i, nevents; /* * When alt-tabing between screens we can get phantom key up messages @@ -590,14 +542,17 @@ winSendKeyEvent (DWORD dwKey, Bool fDown) /* Update the keyState map */ g_winKeyState[dwKey] = fDown; - - ZeroMemory (&xCurrentEvent, sizeof (xCurrentEvent)); - xCurrentEvent.u.u.type = fDown ? KeyPress : KeyRelease; - xCurrentEvent.u.keyButtonPointer.time = - g_c32LastInputEventTime = GetTickCount (); - xCurrentEvent.u.u.detail = dwKey + MIN_KEYCODE; - mieqEnqueue (&xCurrentEvent); + GetEventList(&events); + nevents = GetKeyboardEvents(events, g_pwinKeyboard, fDown ? KeyPress : KeyRelease, dwKey + MIN_KEYCODE); + + for (i = 0; i < nevents; i++) + mieqEnqueue(g_pwinKeyboard, events[i].event); + +#if CYGDEBUG + ErrorF("winSendKeyEvent: dwKey: %d, fDown: %d, nEvents %d\n", + dwKey, fDown, nevents); +#endif } BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam) |