[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [qemu patches] Update patches upto changeset 15036:dfbbb4d3b0dd.



# HG changeset patch
# User Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
# Date 1178822125 -3600
# Node ID 16319e70f77d17b3524b6e02cca1a88e7515ed3c
# Parent  dfbbb4d3b0dd2107cfee2b07fab6f33cefc4719c
[qemu patches] Update patches upto changeset 15036:dfbbb4d3b0dd.

Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
---
 tools/ioemu/patches/vnc-numpad-handling |  231 --------------------------------
 tools/ioemu/patches/series              |    1 
 tools/ioemu/patches/vnc-keypad-handling |   81 +++++++++++
 3 files changed, 82 insertions(+), 231 deletions(-)

diff -r dfbbb4d3b0dd -r 16319e70f77d tools/ioemu/patches/series
--- a/tools/ioemu/patches/series        Thu May 10 19:33:05 2007 +0100
+++ b/tools/ioemu/patches/series        Thu May 10 19:35:25 2007 +0100
@@ -77,3 +77,4 @@ qemu-block-device-bounds-checks
 qemu-block-device-bounds-checks
 qemu-dma-null-pointer-check
 vnc-fix-text-display-shift-key
+vnc-keypad-handling
diff -r dfbbb4d3b0dd -r 16319e70f77d tools/ioemu/patches/vnc-keypad-handling
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ioemu/patches/vnc-keypad-handling   Thu May 10 19:35:25 2007 +0100
@@ -0,0 +1,190 @@
+# HG changeset patch
+# User Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
+# Date 1178821985 -3600
+# Node ID dfbbb4d3b0dd2107cfee2b07fab6f33cefc4719c
+# Parent  23c4790512dbc889c4deed8ae1f8d54813c4b474
+[qemu] Fix keypad handling for VNC.
+
+Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
+
+Index: ioemu/vnc.c
+===================================================================
+--- ioemu.orig/vnc.c   2007-05-10 19:34:49.000000000 +0100
++++ ioemu/vnc.c        2007-05-10 19:34:51.000000000 +0100
+@@ -909,6 +909,12 @@
+     }
+ }
+ 
++static void press_key(VncState *vs, int keysym)
++{
++    kbd_put_keycode(keysym2scancode(vs->kbd_layout, keysym) & 0x7f);
++    kbd_put_keycode(keysym2scancode(vs->kbd_layout, keysym) | 0x80);
++}
++
+ static void do_key_event(VncState *vs, int down, uint32_t sym)
+ {
+     int keycode;
+@@ -936,6 +942,28 @@
+             return;
+         }
+         break;
++    case 0x45:                        /* NumLock */
++      if (!down)
++          vs->modifiers_state[keycode] ^= 1;
++      break;
++    }
++
++    if (keycodeIsKeypad(vs->kbd_layout, keycode)) {
++        /* 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.
++        */
++        if (keysymIsNumlock(vs->kbd_layout, sym & 0xFFFF)) {
++          if (!vs->modifiers_state[0x45]) {
++              vs->modifiers_state[0x45] = 1;
++              press_key(vs, 0xff7f);
++          }
++      } else {
++          if (vs->modifiers_state[0x45]) {
++              vs->modifiers_state[0x45] = 0;
++              press_key(vs, 0xff7f);
++          }
++        }
+     }
+ 
+     if (is_graphic_console()) {
+@@ -1427,6 +1455,7 @@
+     vs->kbd_layout = init_keyboard_layout(keyboard_layout);
+     if (!vs->kbd_layout)
+       exit(1);
++    vs->modifiers_state[0x45] = 1; /* NumLock on - on boot */
+ 
+     vs->ds->data = NULL;
+     vs->ds->dpy_update = vnc_dpy_update;
+Index: ioemu/keymaps.c
+===================================================================
+--- ioemu.orig/keymaps.c       2007-05-10 19:34:49.000000000 +0100
++++ ioemu/keymaps.c    2007-05-10 19:34:51.000000000 +0100
+@@ -32,6 +32,12 @@
+     return 0;
+ }
+ 
++struct key_range {
++    int start;
++    int end;
++    struct key_range *next;
++};
++
+ #define MAX_NORMAL_KEYCODE 512
+ #define MAX_EXTRA_COUNT 256
+ typedef struct {
+@@ -41,8 +47,34 @@
+       uint16_t keycode;
+     } keysym2keycode_extra[MAX_EXTRA_COUNT];
+     int extra_count;
++    struct key_range *keypad_range;
++    struct key_range *numlock_range;
+ } kbd_layout_t;
+ 
++static void add_to_key_range(struct key_range **krp, int code) {
++    struct key_range *kr;
++    for (kr = *krp; kr; kr = kr->next) {
++      if (code >= kr->start && code <= kr->end)
++          break;
++      if (code == kr->start - 1) {
++          kr->start--;
++          break;
++      }
++      if (code == kr->end + 1) {
++          kr->end++;
++          break;
++      }
++    }
++    if (kr == NULL) {
++      kr = qemu_mallocz(sizeof(*kr));
++      if (kr) {
++          kr->start = kr->end = code;
++          kr->next = *krp;
++          *krp = kr;
++      }
++    }
++}
++
+ static kbd_layout_t *parse_keyboard_layout(const char *language,
+                                          kbd_layout_t * k)
+ {
+@@ -87,7 +119,15 @@
+                     //                    fprintf(stderr, "Warning: unknown 
keysym %s\n", line);
+               } else {
+                   const char *rest = end_of_keysym + 1;
+-                  int keycode = strtol(rest, NULL, 0);
++                  char *rest2;
++                  int keycode = strtol(rest, &rest2, 0);
++
++                  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);
++                  }
++
+                   /* if(keycode&0x80)
+                      keycode=(keycode<<8)^0x80e0; */
+                   if (keysym < MAX_NORMAL_KEYCODE) {
+@@ -143,3 +183,25 @@
+     }
+     return 0;
+ }
++
++static int keycodeIsKeypad(void *kbd_layout, int keycode)
++{
++    kbd_layout_t *k = kbd_layout;
++    struct key_range *kr;
++
++    for (kr = k->keypad_range; kr; kr = kr->next)
++      if (keycode >= kr->start && keycode <= kr->end)
++          return 1;
++    return 0;
++}
++
++static int keysymIsNumlock(void *kbd_layout, int keysym)
++{
++    kbd_layout_t *k = kbd_layout;
++    struct key_range *kr;
++
++    for (kr = k->numlock_range; kr; kr = kr->next)
++      if (keysym >= kr->start && keysym <= kr->end)
++          return 1;
++    return 0;
++}
+Index: ioemu/vnc_keysym.h
+===================================================================
+--- ioemu.orig/vnc_keysym.h    2007-05-10 19:34:49.000000000 +0100
++++ ioemu/vnc_keysym.h 2007-05-10 19:34:51.000000000 +0100
+@@ -232,6 +232,19 @@
+ {"Home", 0xff50},      /* XK_Home */
+ {"End", 0xff57},       /* XK_End */
+ {"Scroll_Lock", 0xff14}, /* XK_Scroll_Lock */
++{"KP_Home", 0xff95},
++{"KP_Left", 0xff96},
++{"KP_Up", 0xff97},
++{"KP_Right", 0xff98},
++{"KP_Down", 0xff99},
++{"KP_Prior", 0xff9a},
++{"KP_Page_Up", 0xff9a},
++{"KP_Next", 0xff9b},
++{"KP_Page_Down", 0xff9b},
++{"KP_End", 0xff9c},
++{"KP_Begin", 0xff9d},
++{"KP_Insert", 0xff9e},
++{"KP_Delete", 0xff9f},
+ {"F1", 0xffbe},        /* XK_F1 */
+ {"F2", 0xffbf},        /* XK_F2 */
+ {"F3", 0xffc0},        /* XK_F3 */
+@@ -259,6 +272,7 @@
+ {"KP_8", 0xffb8},      /* XK_KP_8 */
+ {"KP_9", 0xffb9},      /* XK_KP_9 */
+ {"KP_Add", 0xffab},    /* XK_KP_Add */
++{"KP_Separator", 0xffac},/* XK_KP_Separator */
+ {"KP_Decimal", 0xffae},  /* XK_KP_Decimal */
+ {"KP_Divide", 0xffaf},   /* XK_KP_Divide */
+ {"KP_Enter", 0xff8d},    /* XK_KP_Enter */
diff -r dfbbb4d3b0dd -r 16319e70f77d tools/ioemu/patches/vnc-numpad-handling
--- a/tools/ioemu/patches/vnc-numpad-handling   Thu May 10 19:33:05 2007 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,236 +0,0 @@
-# HG changeset patch
-# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
-# Node ID c7f4a89eb054a1ad411da1e4cdc8aeda1a98c4fa
-# Parent  565cd8f32c70da8ae7dbaaeb9dff28aa8b6307e1
-Fix numpad handling in QEMU's VNC server.  The keymaps that we have include
-information on which keys change depending upon the numlock setting, but
-this isn't being used.  By forcing numlock on and off as necessary, when
-receiving these keysyms through the VNC connection, we ensure that the
-server's numlock status is the same as the client's.
-
-Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
-
-Index: ioemu/keymaps.c
-===================================================================
---- ioemu.orig/keymaps.c       2006-12-06 23:41:30.000000000 +0000
-+++ ioemu/keymaps.c    2006-12-08 18:20:27.000000000 +0000
-@@ -36,8 +36,10 @@
- #define MAX_EXTRA_COUNT 256
- typedef struct {
-     uint16_t keysym2keycode[MAX_NORMAL_KEYCODE];
-+    int keysym2numlock[MAX_NORMAL_KEYCODE];
-     struct {
-       int keysym;
-+      int numlock;
-       uint16_t keycode;
-     } keysym2keycode_extra[MAX_EXTRA_COUNT];
-     int extra_count;
-@@ -50,6 +52,8 @@
-     char file_name[1024];
-     char line[1024];
-     int len;
-+    int *keycode2numlock;
-+    int i;
- 
-     snprintf(file_name, sizeof(file_name),
-              "%s/keymaps/%s", bios_dir, language);
-@@ -63,6 +67,15 @@
-               "Could not read keymap file: '%s'\n", file_name);
-       return 0;
-     }
-+
-+    /* Allocate a temporary map tracking which keycodes change when numlock is
-+       set.  Keycodes are 16 bit, so 65536 is safe. */
-+    keycode2numlock = malloc(65536 * sizeof(int));
-+    if (!keycode2numlock) {
-+        perror("Could not read keymap file");
-+      return 0;
-+    }
-+
-     for(;;) {
-       if (fgets(line, 1024, f) == NULL)
-             break;
-@@ -86,13 +99,19 @@
-               if (keysym == 0) {
-                     //                    fprintf(stderr, "Warning: unknown 
keysym %s\n", line);
-               } else {
--                  const char *rest = end_of_keysym + 1;
--                  int keycode = strtol(rest, NULL, 0);
-+                  char *rest = end_of_keysym + 1;
-+                  int keycode = strtol(rest, &rest, 0);
-+                  int numlock = (rest != NULL &&
-+                                 strstr(rest, "numlock") != NULL);
-+
-+                    keycode2numlock[keycode] = numlock;
-+
-                   /* if(keycode&0x80)
-                      keycode=(keycode<<8)^0x80e0; */
-                   if (keysym < MAX_NORMAL_KEYCODE) {
-                       //fprintf(stderr,"Setting keysym %s (%d) to 
%d\n",line,keysym,keycode);
-                       k->keysym2keycode[keysym] = keycode;
-+                      k->keysym2numlock[keysym] = numlock;
-                   } else {
-                       if (k->extra_count >= MAX_EXTRA_COUNT) {
-                           fprintf(stderr,
-@@ -107,6 +126,8 @@
-                               keysym = keysym;
-                           k->keysym2keycode_extra[k->extra_count].
-                               keycode = keycode;
-+                          k->keysym2keycode_extra[k->extra_count].
-+                              numlock = numlock;
-                           k->extra_count++;
-                       }
-                   }
-@@ -115,6 +136,22 @@
-       }
-     }
-     fclose(f);
-+
-+    for (i = 0; i < MAX_NORMAL_KEYCODE; i++) {
-+        if (k->keysym2numlock[i] != 1) {
-+            k->keysym2numlock[i] = -keycode2numlock[k->keysym2keycode[i]];
-+        }
-+    }
-+
-+    for (i = 0; i < k->extra_count; i++) {
-+        if (k->keysym2keycode_extra[i].numlock != 1) {
-+            k->keysym2keycode_extra[i].numlock =
-+                -keycode2numlock[k->keysym2keycode_extra[i].keycode];
-+        }
-+    }
-+
-+    free(keycode2numlock);
-+
-     return k;
- }
- 
-@@ -143,3 +180,25 @@
-     }
-     return 0;
- }
-+
-+/**
-+ * Returns 1 if the given keysym requires numlock to be pressed, -1 if it
-+ * requires it to be cleared, and 0 otherwise.
-+ */
-+static int keysym2numlock(void *kbd_layout, int keysym)
-+{
-+    kbd_layout_t *k = kbd_layout;
-+    if (keysym < MAX_NORMAL_KEYCODE) {
-+      return k->keysym2numlock[keysym];
-+    } else {
-+      int i;
-+#ifdef XK_ISO_Left_Tab
-+      if (keysym == XK_ISO_Left_Tab)
-+          keysym = XK_Tab;
-+#endif
-+      for (i = 0; i < k->extra_count; i++)
-+          if (k->keysym2keycode_extra[i].keysym == keysym)
-+              return k->keysym2keycode_extra[i].numlock;
-+    }
-+    return 0;
-+}
-Index: ioemu/vnc.c
-===================================================================
---- ioemu.orig/vnc.c   2006-12-08 18:18:26.000000000 +0000
-+++ ioemu/vnc.c        2006-12-08 18:19:43.000000000 +0000
-@@ -115,6 +115,7 @@
- 
-     int ctl_keys;               /* Ctrl+Alt starts calibration */
-     int shift_keys;             /* Shift / CapsLock keys */
-+    int numlock;
- };
- 
- #define DIRTY_PIXEL_BITS 64
-@@ -854,14 +855,40 @@
-     }
- }
- 
-+static void press_key(VncState *vs, int keycode)
-+{
-+    kbd_put_keycode(keysym2scancode(vs->kbd_layout, keycode) & 0x7f);
-+    kbd_put_keycode(keysym2scancode(vs->kbd_layout, keycode) | 0x80);
-+}
-+
- static void do_key_event(VncState *vs, int down, uint32_t sym)
- {
-     sym &= 0xFFFF;
- 
-     if (is_graphic_console()) {
-       int keycode;
-+      int numlock;
- 
-       keycode = keysym2scancode(vs->kbd_layout, sym);
-+      numlock = keysym2numlock(vs->kbd_layout, sym);
-+
-+        /* 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.
-+        */
-+      if (numlock == 1) {
-+          if (!vs->numlock) {
-+              vs->numlock = 1;
-+              press_key(vs, XK_Num_Lock);
-+          }
-+      }
-+      else if (numlock == -1) {
-+          if (vs->numlock) {
-+              vs->numlock = 0;
-+              press_key(vs, XK_Num_Lock);
-+          }
-+        }
-+
-       if (keycode & 0x80)
-           kbd_put_keycode(0xe0);
-       if (down)
-@@ -932,6 +959,10 @@
-           vs->shift_keys ^= 2;
-           break;
- 
-+      case XK_Num_Lock:
-+          vs->numlock = !vs->numlock;
-+          break;
-+
-       case XK_1 ... XK_9:
-           if ((vs->ctl_keys & 3) != 3)
-               break;
-@@ -1355,6 +1386,7 @@
-     vs->lsock = -1;
-     vs->csock = -1;
-     vs->depth = 4;
-+    vs->numlock = 0;
- 
-     vs->ds = ds;
- 
-Index: ioemu/vnc_keysym.h
-===================================================================
---- ioemu.orig/vnc_keysym.h    2006-12-08 18:17:01.000000000 +0000
-+++ ioemu/vnc_keysym.h 2006-12-08 18:19:43.000000000 +0000
-@@ -231,6 +231,19 @@
- {"Home", 0xff50},      /* XK_Home */
- {"End", 0xff57},       /* XK_End */
- {"Scroll_Lock", 0xff14}, /* XK_Scroll_Lock */
-+{"KP_Home", 0xff95},
-+{"KP_Left", 0xff96},
-+{"KP_Up", 0xff97},
-+{"KP_Right", 0xff98},
-+{"KP_Down", 0xff99},
-+{"KP_Prior", 0xff9a},
-+{"KP_Page_Up", 0xff9a},
-+{"KP_Next", 0xff9b},
-+{"KP_Page_Down", 0xff9b},
-+{"KP_End", 0xff9c},
-+{"KP_Begin", 0xff9d},
-+{"KP_Insert", 0xff9e},
-+{"KP_Delete", 0xff9f},
- {"F1", 0xffbe},        /* XK_F1 */
- {"F2", 0xffbf},        /* XK_F2 */
- {"F3", 0xffc0},        /* XK_F3 */
-@@ -258,6 +271,7 @@
- {"KP_8", 0xffb8},      /* XK_KP_8 */
- {"KP_9", 0xffb9},      /* XK_KP_9 */
- {"KP_Add", 0xffab},    /* XK_KP_Add */
-+{"KP_Separator", 0xffac},/* XK_KP_Separator */
- {"KP_Decimal", 0xffae},  /* XK_KP_Decimal */
- {"KP_Divide", 0xffaf},   /* XK_KP_Divide */
- {"KP_Enter", 0xff8d},    /* XK_KP_Enter */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.