forked from pool/xorg-x11-server
118 lines
3.7 KiB
Diff
118 lines
3.7 KiB
Diff
|
This patch fixes keyboard handling for XInput enabled servers. W/o this patch
|
||
|
the wrong keyboard was used for adding new KeyCodes.
|
||
|
|
||
|
This should basically already enable the use of other keyboards, if the remote
|
||
|
keyboard stays at US.
|
||
|
|
||
|
mhopf - 21/04/2011
|
||
|
|
||
|
Index: xorg-server-1.9.3/hw/vnc/kbdptr.c
|
||
|
===================================================================
|
||
|
--- xorg-server-1.9.3.orig/hw/vnc/kbdptr.c
|
||
|
+++ xorg-server-1.9.3/hw/vnc/kbdptr.c
|
||
|
@@ -46,19 +46,17 @@
|
||
|
#endif
|
||
|
|
||
|
#define KEY_IS_PRESSED(keycode) \
|
||
|
- (kbdDevice->key->down[(keycode) >> 3] & (1 << ((keycode) & 7)))
|
||
|
+ (inputInfo.keyboard->key->down[(keycode) >> 3] & (1 << ((keycode) & 7)))
|
||
|
|
||
|
static void vncXConvertCase(KeySym sym, KeySym *lower, KeySym *upper);
|
||
|
|
||
|
-static DeviceIntPtr ptrDevice = NULL, kbdDevice = NULL;
|
||
|
+static DeviceIntPtr ptrDevice = NULL;
|
||
|
|
||
|
|
||
|
void
|
||
|
vncSetKeyboardDevice(DeviceIntPtr kbd)
|
||
|
{
|
||
|
- if (kbdDevice && kbd)
|
||
|
- return; /* set once */
|
||
|
- kbdDevice = kbd;
|
||
|
+ // obsoleted by inputInfo
|
||
|
}
|
||
|
|
||
|
|
||
|
@@ -145,10 +143,7 @@ KbdAddEvent(Bool down, KeySym keySym, rf
|
||
|
Bool shiftMustBeReleased = FALSE;
|
||
|
Bool shiftMustBePressed = FALSE;
|
||
|
|
||
|
- if (!kbdDevice)
|
||
|
- return;
|
||
|
-
|
||
|
- keySyms = XkbGetCoreMap(kbdDevice);
|
||
|
+ keySyms = XkbGetCoreMap(inputInfo.keyboard);
|
||
|
|
||
|
#ifdef CORBA
|
||
|
if (cl) {
|
||
|
@@ -259,40 +254,40 @@ KbdAddEvent(Bool down, KeySym keySym, rf
|
||
|
shiftMustBePressed = TRUE;
|
||
|
}
|
||
|
|
||
|
- XkbApplyMappingChange(kbdDevice, keySyms, keyCode, 1, NULL, serverClient);
|
||
|
+ XkbApplyMappingChange(inputInfo.keyboard, keySyms, keyCode, 1, NULL, serverClient);
|
||
|
|
||
|
ErrorF("KbdAddEvent: unknown KeySym 0x%x - allocating KeyCode %d\n",
|
||
|
(int)keySym, keyCode);
|
||
|
}
|
||
|
|
||
|
- xkb = &kbdDevice->key->xkbInfo->state;
|
||
|
+ xkb = &inputInfo.keyboard->key->xkbInfo->state;
|
||
|
if (down) {
|
||
|
if (shiftMustBePressed && !(XkbStateFieldFromRec(xkb) & ShiftMask)) {
|
||
|
fakeShiftPress = TRUE;
|
||
|
- EnqueueKey(kbdDevice, KeyPress, SHIFT_L_KEY_CODE);
|
||
|
+ EnqueueKey(inputInfo.keyboard, KeyPress, SHIFT_L_KEY_CODE);
|
||
|
}
|
||
|
if (shiftMustBeReleased && (XkbStateFieldFromRec(xkb) & ShiftMask)) {
|
||
|
if (KEY_IS_PRESSED(SHIFT_L_KEY_CODE)) {
|
||
|
fakeShiftLRelease = TRUE;
|
||
|
- EnqueueKey(kbdDevice, KeyRelease, SHIFT_L_KEY_CODE);
|
||
|
+ EnqueueKey(inputInfo.keyboard, KeyRelease, SHIFT_L_KEY_CODE);
|
||
|
}
|
||
|
if (KEY_IS_PRESSED(SHIFT_R_KEY_CODE)) {
|
||
|
fakeShiftRRelease = TRUE;
|
||
|
- EnqueueKey(kbdDevice, KeyRelease, SHIFT_R_KEY_CODE);
|
||
|
+ EnqueueKey(inputInfo.keyboard, KeyRelease, SHIFT_R_KEY_CODE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- EnqueueKey(kbdDevice, type, keyCode);
|
||
|
+ EnqueueKey(inputInfo.keyboard, type, keyCode);
|
||
|
|
||
|
if (fakeShiftPress) {
|
||
|
- EnqueueKey(kbdDevice, KeyRelease, SHIFT_L_KEY_CODE);
|
||
|
+ EnqueueKey(inputInfo.keyboard, KeyRelease, SHIFT_L_KEY_CODE);
|
||
|
}
|
||
|
if (fakeShiftLRelease) {
|
||
|
- EnqueueKey(kbdDevice, KeyPress, SHIFT_L_KEY_CODE);
|
||
|
+ EnqueueKey(inputInfo.keyboard, KeyPress, SHIFT_L_KEY_CODE);
|
||
|
}
|
||
|
if (fakeShiftRRelease) {
|
||
|
- EnqueueKey(kbdDevice, KeyPress, SHIFT_R_KEY_CODE);
|
||
|
+ EnqueueKey(inputInfo.keyboard, KeyPress, SHIFT_R_KEY_CODE);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@@ -343,15 +338,15 @@ KbdReleaseAllKeys(void)
|
||
|
{
|
||
|
int i, j;
|
||
|
|
||
|
- if (!kbdDevice)
|
||
|
+ if (!inputInfo.keyboard)
|
||
|
return;
|
||
|
|
||
|
for (i = 0; i < DOWN_LENGTH; i++) {
|
||
|
- if (kbdDevice->key->down[i] != 0) {
|
||
|
+ if (inputInfo.keyboard->key->down[i] != 0) {
|
||
|
for (j = 0; j < 8; j++) {
|
||
|
- if (kbdDevice->key->down[i] & (1 << j)) {
|
||
|
+ if (inputInfo.keyboard->key->down[i] & (1 << j)) {
|
||
|
int detail = (i << 3) | j;
|
||
|
- EnqueueKey(kbdDevice, KeyRelease, detail);
|
||
|
+ EnqueueKey(inputInfo.keyboard, KeyRelease, detail);
|
||
|
}
|
||
|
}
|
||
|
}
|