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

(-)xorg-server-1.9.3/hw/vnc/kbdptr.c (-5 / +42 lines)
Lines 142-147 KbdAddEvent(Bool down, KeySym keySym, rf Link Here
142
    Bool fakeShiftRRelease = FALSE;
142
    Bool fakeShiftRRelease = FALSE;
143
    Bool shiftMustBeReleased = FALSE;
143
    Bool shiftMustBeReleased = FALSE;
144
    Bool shiftMustBePressed = FALSE;
144
    Bool shiftMustBePressed = FALSE;
145
    Bool fakeLevel3Press = FALSE;
146
    Bool fakeLevel3Release = FALSE;
147
    Bool level3MustBeReleased = FALSE;
148
    Bool level3MustBePressed = FALSE;
145
149
146
    keySyms = XkbGetCoreMap(inputInfo.keyboard);
150
    keySyms = XkbGetCoreMap(inputInfo.keyboard);
147
151
Lines 161-166 KbdAddEvent(Bool down, KeySym keySym, rf Link Here
161
     *
165
     *
162
     * Alan.
166
     * Alan.
163
     */
167
     */
168
    /* Never use predefined keys.
169
     * This is inherently incapable of dealing with changing
170
     * keyboard layouts. Not being able to work with non-local xmodmaps
171
     * is a nuisance at worst, and probably even preferred.
172
     * 2011-04-15 mhopf@suse.de */
173
#if 0
164
#if !XFREE86VNC
174
#if !XFREE86VNC
165
    /* First check if it's one of our predefined keys.  If so then we can make
175
    /* First check if it's one of our predefined keys.  If so then we can make
166
       some attempt at allowing an xmodmap inside a VNC desktop behave
176
       some attempt at allowing an xmodmap inside a VNC desktop behave
Lines 187-192 KbdAddEvent(Bool down, KeySym keySym, rf Link Here
187
	}
197
	}
188
    }
198
    }
189
#endif
199
#endif
200
#endif
190
201
191
    if (!keyCode) {
202
    if (!keyCode) {
192
203
Lines 201-218 KbdAddEvent(Bool down, KeySym keySym, rf Link Here
201
212
202
	for (i = 0; i < NO_OF_KEYS * keySyms->mapWidth; i++) {
213
	for (i = 0; i < NO_OF_KEYS * keySyms->mapWidth; i++) {
203
	    if (keySym == keySyms->map[i]) {
214
	    if (keySym == keySyms->map[i]) {
215
		int j, numSyms = 0;
204
		keyCode = MIN_KEY_CODE + i / keySyms->mapWidth;
216
		keyCode = MIN_KEY_CODE + i / keySyms->mapWidth;
205
217
206
		if (keySyms->map[(i / keySyms->mapWidth)
218
		for (j = 0; j < keySyms->mapWidth; j++)
207
					* keySyms->mapWidth + 1] != NoSymbol) {
219
		    if (keySyms->map[(i / keySyms->mapWidth)
208
220
					* keySyms->mapWidth + j] != NoSymbol)
221
			numSyms++;
222
		if (numSyms > 1) {
209
		    /* this keycode has more than one symbol associated with
223
		    /* this keycode has more than one symbol associated with
210
		       it, so shift state is important */
224
		       it, so shift/Level3_shift state is important */
211
225
212
		    if ((i % keySyms->mapWidth) == 0)
226
		    if (((i % keySyms->mapWidth) & 1) == 0)
213
			shiftMustBeReleased = TRUE;
227
			shiftMustBeReleased = TRUE;
214
		    else
228
		    else
215
			shiftMustBePressed = TRUE;
229
			shiftMustBePressed = TRUE;
230
		    /* Does NOT consider Mode_shift (entries 2-3) */
231
		    if (((i % keySyms->mapWidth) & 4) == 0)
232
			level3MustBeReleased = TRUE;
233
		    else {
234
			level3MustBePressed = TRUE;
235
		    }
216
		}
236
		}
217
		break;
237
		break;
218
	    }
238
	    }
Lines 252-257 KbdAddEvent(Bool down, KeySym keySym, rf Link Here
252
		shiftMustBeReleased = TRUE;
272
		shiftMustBeReleased = TRUE;
253
	    else
273
	    else
254
		shiftMustBePressed = TRUE;
274
		shiftMustBePressed = TRUE;
275
	    level3MustBeReleased = TRUE;
255
	}
276
	}
256
277
257
	XkbApplyMappingChange(inputInfo.keyboard, keySyms, keyCode, 1, NULL, serverClient);
278
	XkbApplyMappingChange(inputInfo.keyboard, keySyms, keyCode, 1, NULL, serverClient);
Lines 262-267 KbdAddEvent(Bool down, KeySym keySym, rf Link Here
262
283
263
    xkb = &inputInfo.keyboard->key->xkbInfo->state;
284
    xkb = &inputInfo.keyboard->key->xkbInfo->state;
264
    if (down) {
285
    if (down) {
286
	// TODO: would require to check which keycodes are actually
287
	// bound to ISO_Level3_Shift and/or Shift_L
288
	if (level3MustBePressed && !KEY_IS_PRESSED(ISO_LEVEL3_KEY_CODE)) {
289
	    fakeLevel3Press = TRUE;
290
	    EnqueueKey(inputInfo.keyboard, KeyPress, ISO_LEVEL3_KEY_CODE);
291
	}
292
	if (level3MustBeReleased && KEY_IS_PRESSED(ISO_LEVEL3_KEY_CODE)) {
293
	    fakeLevel3Release = TRUE;
294
	    EnqueueKey(inputInfo.keyboard, KeyRelease, ISO_LEVEL3_KEY_CODE);
295
	}
265
	if (shiftMustBePressed && !(XkbStateFieldFromRec(xkb) & ShiftMask)) {
296
	if (shiftMustBePressed && !(XkbStateFieldFromRec(xkb) & ShiftMask)) {
266
	    fakeShiftPress = TRUE;
297
	    fakeShiftPress = TRUE;
267
            EnqueueKey(inputInfo.keyboard, KeyPress, SHIFT_L_KEY_CODE);
298
            EnqueueKey(inputInfo.keyboard, KeyPress, SHIFT_L_KEY_CODE);
Lines 289-294 KbdAddEvent(Bool down, KeySym keySym, rf Link Here
289
    if (fakeShiftRRelease) {
320
    if (fakeShiftRRelease) {
290
        EnqueueKey(inputInfo.keyboard, KeyPress, SHIFT_R_KEY_CODE);
321
        EnqueueKey(inputInfo.keyboard, KeyPress, SHIFT_R_KEY_CODE);
291
    }
322
    }
323
    if (fakeLevel3Press) {
324
        EnqueueKey(inputInfo.keyboard, KeyRelease, ISO_LEVEL3_KEY_CODE);
325
    }
326
    if (fakeLevel3Release) {
327
        EnqueueKey(inputInfo.keyboard, KeyPress, ISO_LEVEL3_KEY_CODE);
328
    }
292
}
329
}
293
330
294
331
(-)xorg-server-1.9.3/hw/vnc/keyboard.h (+1 lines)
Lines 32-37 Link Here
32
#define META_R_KEY_CODE		(MIN_KEY_CODE + 108)
32
#define META_R_KEY_CODE		(MIN_KEY_CODE + 108)
33
#define ALT_L_KEY_CODE		(MIN_KEY_CODE + 56)
33
#define ALT_L_KEY_CODE		(MIN_KEY_CODE + 56)
34
#define ALT_R_KEY_CODE		(MIN_KEY_CODE + 105)
34
#define ALT_R_KEY_CODE		(MIN_KEY_CODE + 105)
35
#define ISO_LEVEL3_KEY_CODE	ALT_R_KEY_CODE
35
36
36
static KeySym map[MAX_KEY_CODE * GLYPHS_PER_KEY] = {
37
static KeySym map[MAX_KEY_CODE * GLYPHS_PER_KEY] = {
37
    /* 0x00 */  NoSymbol,       NoSymbol,	NoSymbol,	NoSymbol,
38
    /* 0x00 */  NoSymbol,       NoSymbol,	NoSymbol,	NoSymbol,

Return to bug 400520