View | Details | Raw Unified | Return to bug 400520
Collapse All | Expand All

(-)xorg-server-1.9.3/hw/vnc/kbdptr.c (-22 / +17 lines)
Lines 46-64 Link Here
46
#endif
46
#endif
47
47
48
#define KEY_IS_PRESSED(keycode) \
48
#define KEY_IS_PRESSED(keycode) \
49
    (kbdDevice->key->down[(keycode) >> 3] & (1 << ((keycode) & 7)))
49
    (inputInfo.keyboard->key->down[(keycode) >> 3] & (1 << ((keycode) & 7)))
50
50
51
static void vncXConvertCase(KeySym sym, KeySym *lower, KeySym *upper);
51
static void vncXConvertCase(KeySym sym, KeySym *lower, KeySym *upper);
52
52
53
static DeviceIntPtr ptrDevice = NULL, kbdDevice = NULL;
53
static DeviceIntPtr ptrDevice = NULL;
54
54
55
55
56
void
56
void
57
vncSetKeyboardDevice(DeviceIntPtr kbd)
57
vncSetKeyboardDevice(DeviceIntPtr kbd)
58
{
58
{
59
   if (kbdDevice && kbd)
59
  // obsoleted by inputInfo
60
      return; /* set once */
61
   kbdDevice = kbd;
62
}
60
}
63
61
64
62
Lines 145-154 KbdAddEvent(Bool down, KeySym keySym, rf Link Here
145
    Bool shiftMustBeReleased = FALSE;
143
    Bool shiftMustBeReleased = FALSE;
146
    Bool shiftMustBePressed = FALSE;
144
    Bool shiftMustBePressed = FALSE;
147
145
148
    if (!kbdDevice)
146
    keySyms = XkbGetCoreMap(inputInfo.keyboard);
149
        return;
150
151
    keySyms = XkbGetCoreMap(kbdDevice);
152
147
153
#ifdef CORBA
148
#ifdef CORBA
154
    if (cl) {
149
    if (cl) {
Lines 259-298 KbdAddEvent(Bool down, KeySym keySym, rf Link Here
259
		shiftMustBePressed = TRUE;
254
		shiftMustBePressed = TRUE;
260
	}
255
	}
261
256
262
	XkbApplyMappingChange(kbdDevice, keySyms, keyCode, 1, NULL, serverClient);
257
	XkbApplyMappingChange(inputInfo.keyboard, keySyms, keyCode, 1, NULL, serverClient);
263
258
264
	ErrorF("KbdAddEvent: unknown KeySym 0x%x - allocating KeyCode %d\n",
259
	ErrorF("KbdAddEvent: unknown KeySym 0x%x - allocating KeyCode %d\n",
265
	       (int)keySym, keyCode);
260
	       (int)keySym, keyCode);
266
    }
261
    }
267
262
268
    xkb = &kbdDevice->key->xkbInfo->state;
263
    xkb = &inputInfo.keyboard->key->xkbInfo->state;
269
    if (down) {
264
    if (down) {
270
	if (shiftMustBePressed && !(XkbStateFieldFromRec(xkb) & ShiftMask)) {
265
	if (shiftMustBePressed && !(XkbStateFieldFromRec(xkb) & ShiftMask)) {
271
	    fakeShiftPress = TRUE;
266
	    fakeShiftPress = TRUE;
272
            EnqueueKey(kbdDevice, KeyPress, SHIFT_L_KEY_CODE);
267
            EnqueueKey(inputInfo.keyboard, KeyPress, SHIFT_L_KEY_CODE);
273
	}
268
	}
274
	if (shiftMustBeReleased && (XkbStateFieldFromRec(xkb) & ShiftMask)) {
269
	if (shiftMustBeReleased && (XkbStateFieldFromRec(xkb) & ShiftMask)) {
275
	    if (KEY_IS_PRESSED(SHIFT_L_KEY_CODE)) {
270
	    if (KEY_IS_PRESSED(SHIFT_L_KEY_CODE)) {
276
		fakeShiftLRelease = TRUE;
271
		fakeShiftLRelease = TRUE;
277
                EnqueueKey(kbdDevice, KeyRelease, SHIFT_L_KEY_CODE);
272
                EnqueueKey(inputInfo.keyboard, KeyRelease, SHIFT_L_KEY_CODE);
278
	    }
273
	    }
279
	    if (KEY_IS_PRESSED(SHIFT_R_KEY_CODE)) {
274
	    if (KEY_IS_PRESSED(SHIFT_R_KEY_CODE)) {
280
		fakeShiftRRelease = TRUE;
275
		fakeShiftRRelease = TRUE;
281
                EnqueueKey(kbdDevice, KeyRelease, SHIFT_R_KEY_CODE);
276
                EnqueueKey(inputInfo.keyboard, KeyRelease, SHIFT_R_KEY_CODE);
282
	    }
277
	    }
283
	}
278
	}
284
    }
279
    }
285
280
286
    EnqueueKey(kbdDevice, type, keyCode);
281
    EnqueueKey(inputInfo.keyboard, type, keyCode);
287
282
288
    if (fakeShiftPress) {
283
    if (fakeShiftPress) {
289
        EnqueueKey(kbdDevice, KeyRelease, SHIFT_L_KEY_CODE);
284
        EnqueueKey(inputInfo.keyboard, KeyRelease, SHIFT_L_KEY_CODE);
290
    }
285
    }
291
    if (fakeShiftLRelease) {
286
    if (fakeShiftLRelease) {
292
        EnqueueKey(kbdDevice, KeyPress, SHIFT_L_KEY_CODE);
287
        EnqueueKey(inputInfo.keyboard, KeyPress, SHIFT_L_KEY_CODE);
293
    }
288
    }
294
    if (fakeShiftRRelease) {
289
    if (fakeShiftRRelease) {
295
        EnqueueKey(kbdDevice, KeyPress, SHIFT_R_KEY_CODE);
290
        EnqueueKey(inputInfo.keyboard, KeyPress, SHIFT_R_KEY_CODE);
296
    }
291
    }
297
}
292
}
298
293
Lines 343-357 KbdReleaseAllKeys(void) Link Here
343
{
338
{
344
    int i, j;
339
    int i, j;
345
340
346
    if (!kbdDevice) 
341
    if (!inputInfo.keyboard) 
347
	return;
342
	return;
348
343
349
    for (i = 0; i < DOWN_LENGTH; i++) {
344
    for (i = 0; i < DOWN_LENGTH; i++) {
350
	if (kbdDevice->key->down[i] != 0) {
345
	if (inputInfo.keyboard->key->down[i] != 0) {
351
	    for (j = 0; j < 8; j++) {
346
	    for (j = 0; j < 8; j++) {
352
		if (kbdDevice->key->down[i] & (1 << j)) {
347
		if (inputInfo.keyboard->key->down[i] & (1 << j)) {
353
                    int detail = (i << 3) | j;
348
                    int detail = (i << 3) | j;
354
                    EnqueueKey(kbdDevice, KeyRelease, detail);
349
                    EnqueueKey(inputInfo.keyboard, KeyRelease, detail);
355
		}
350
		}
356
	    }
351
	    }
357
	}
352
	}

Return to bug 400520