xserver: Branch 'master'

Matthew Allum mallum at kemper.freedesktop.org
Sat Jul 8 23:57:25 EEST 2006


 hw/kdrive/ephyr/hostx.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

New commits:
diff-tree 90a9b82272446fdaebe71c966325fd7e670f75c6 (from 21e3e3ca298dce22e5fad6ef38aa6fe9736a1d3b)
Author: Matthew Allum <mallum at polystyrene.(none)>
Date:   Sat Jul 8 21:57:07 2006 +0100

    Fix crash in Xephyr when running on host X with keymap width < 4 ( i.e xvnc )

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index ae776a7..32a46dc 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -669,7 +669,7 @@ void
 hostx_load_keymap(void)
 {
   KeySym          *keymap;
-  int              mapWidth, min_keycode, max_keycode;
+  int              host_width, min_keycode, max_keycode, width;
   int              i,j;
 
   XDisplayKeycodes(HostX.dpy, &min_keycode, &max_keycode);
@@ -679,25 +679,21 @@ hostx_load_keymap(void)
   keymap = XGetKeyboardMapping(HostX.dpy, 
 			       min_keycode,
 			       max_keycode - min_keycode + 1,
-			       &mapWidth);
+			       &host_width);
 
   /* Try and copy the hosts keymap into our keymap to avoid loads
    * of messing around.
    *
    * kdrive cannot can have more than 4 keysyms per keycode
-   * so we only copy the first 4 ( xorg has 6 per keycode )
+   * so we only copy at most the first 4 ( xorg has 6 per keycode, XVNC 2 )
    */
+  width = (host_width > 4) ? 4 : host_width;
 
   for (i=0; i<(max_keycode - min_keycode+1); i++)
-    for (j=0; j<4; j++)
-      kdKeymap[ (i*4)+j ] = keymap[ (i*mapWidth) + j ];
+    for (j=0; j<width; j++)
+      kdKeymap[ (i*width)+j ] = keymap[ (i*host_width) + j ];
 
-  /* old way
-    memcpy (kdKeymap, keymap, 
-    (max_keycode - min_keycode + 1)*mapWidth*sizeof(KeySym));
-  */
-
-  EPHYR_DBG("keymap width: %d", mapWidth);
+  EPHYR_DBG("keymap width, host:%d kdrive:%d", host_width, width);
   
   /* all kdrive vars - see kkeymap.c */
 
@@ -705,7 +701,7 @@ hostx_load_keymap(void)
   kdMaxScanCode = max_keycode;
   kdMinKeyCode  = min_keycode;
   kdMaxKeyCode  = max_keycode;
-  kdKeymapWidth = (mapWidth > 4) ? 4 : mapWidth;
+  kdKeymapWidth = width;
 
   XFree(keymap);
 }



More information about the xorg-commit mailing list