xen/xen-shift-key.patch

100 lines
3.8 KiB
Diff

Index: xen-3.2-testing/tools/ioemu/keymaps.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/keymaps.c 2008-01-16 13:19:03.000000000 -0700
+++ xen-3.2-testing/tools/ioemu/keymaps.c 2008-05-07 09:02:03.000000000 -0600
@@ -50,6 +50,7 @@
struct key_range *keypad_range;
struct key_range *numlock_range;
struct key_range *shift_range;
+ struct key_range *localstate_range;
} kbd_layout_t;
static void add_to_key_range(struct key_range **krp, int code) {
@@ -126,11 +127,15 @@
if (rest && strstr(rest, "numlock")) {
add_to_key_range(&k->keypad_range, keycode);
add_to_key_range(&k->numlock_range, keysym);
- fprintf(stderr, "keypad keysym %04x keycode %d\n", keysym, keycode);
+ //fprintf(stderr, "keypad keysym %04x keycode %d\n", keysym, keycode);
}
if (rest && strstr(rest, "shift")) {
add_to_key_range(&k->shift_range, keysym);
- fprintf(stderr, "shift keysym %04x keycode %d\n", keysym, keycode);
+ //fprintf(stderr, "shift keysym %04x keycode %d\n", keysym, keycode);
+ }
+ if (rest && strstr(rest, "localstate")) {
+ add_to_key_range(&k->localstate_range, keycode);
+ //fprintf(stderr, "localstate keysym %04x keycode %d\n", keysym, keycode);
}
/* if(keycode&0x80)
@@ -221,3 +226,14 @@
return 1;
return 0;
}
+
+static int keycodeIsShiftable(void *kbd_layout, int keycode)
+{
+ kbd_layout_t *k = kbd_layout;
+ struct key_range *kr;
+
+ for (kr = k->localstate_range; kr; kr = kr->next)
+ if (keycode >= kr->start && keycode <= kr->end)
+ return 0;
+ return 1;
+}
Index: xen-3.2-testing/tools/ioemu/vnc.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/vnc.c 2008-05-06 14:38:17.000000000 -0600
+++ xen-3.2-testing/tools/ioemu/vnc.c 2008-05-07 09:01:10.000000000 -0600
@@ -1107,6 +1107,7 @@
int keycode;
int shift_keys = 0;
int shift = 0;
+ int keypad = 0;
if (is_graphic_console()) {
if (sym >= 'A' && sym <= 'Z') {
@@ -1163,7 +1164,8 @@
return;
}
- if (keycodeIsKeypad(vs->kbd_layout, keycode)) {
+ keypad = keycodeIsKeypad(vs->kbd_layout, keycode);
+ if (keypad) {
/* If the numlock state needs to change then simulate an additional
keypress before sending this one. This will happen if the user
toggles numlock away from the VNC window.
@@ -1183,14 +1185,15 @@
if (is_graphic_console()) {
/* If the shift state needs to change then simulate an additional
- keypress before sending this one. Ignore for escape key, need to
- enhance for other non shiftable keys.
+ keypress before sending this one. Ignore for keypad keys and
+ those that have localstate, See keymaps/common
*/
- if (shift && !shift_keys && keycode != 1) {
+ if (shift && !shift_keys) {
press_key_shift_down(vs, down, keycode);
return;
}
- else if (!shift && shift_keys && keycode != 1) {
+ else if (!shift && shift_keys && !keypad &&
+ keycodeIsShiftable(vs->kbd_layout, keycode)) {
press_key_shift_up(vs, down, keycode);
return;
}
Index: xen-3.2-testing/tools/ioemu/vnc_keysym.h
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/vnc_keysym.h 2008-01-16 13:19:03.000000000 -0700
+++ xen-3.2-testing/tools/ioemu/vnc_keysym.h 2008-05-07 09:01:26.000000000 -0600
@@ -345,6 +345,7 @@
{"Num_Lock", 0xff7f}, /* XK_Num_Lock */
{"Pause", 0xff13}, /* XK_Pause */
{"Escape", 0xff1b}, /* XK_Escape */
+{"ISO_Left_Tab", 0xfe20},/* XK_ISO_Left_Tab */
/* localized keys */
{"BackApostrophe", 0xff21},