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

Bug#256706: Patch to solve XKB mess about modifiers



tags 256706 + patch
thanks

The bugs described in these merged bugreports were fixed upstream, see
http://cvsweb.xfree86.org/cvsweb/xc/programs/Xserver/hw/xfree86/CHANGELOG
(numbers slightly differs in XFree86 CVS logs and Debian changelogs):
 646. Fix for XKB map 'altwin' to avoid one keysym to more than one modifier
      mapping (Ivan Pascal).
 635. Fix xmodmap's output of the modifiers map when the first column keysym
      is empty (Ivan Pascal).
 634. Fixes for XKB keyboard maps:
      - fix Meta, Super, Hyper keysyms interpretation
      - fix typo in rules/xfree86.xml (Ivan Pascal).

Oddly debian/patches/000_stolen_from_HEAD_xkb_data.diff contains 634,
but not the other 2 chunks.  The missing pieces are in modifiers.patch.
I checked that when applied, xmodmap displays the right modifiers and
Meta_L is no more bound to Mod1.

Few days later, Ivan Pascal committed (attached in none.patch)
 667. Fixes and updates for XKB keyboard maps:
      ...
      - Fix wrong key type in the 'keymap without special keys' (Ivan Pascal).
I do not know what this does fix, but it looks pretty sane, maybe it
should go also.

Denis
Index: programs/xkbcomp/symbols/altwin
===================================================================
RCS file: /cvs/xc/programs/xkbcomp/symbols/altwin,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- programs/xkbcomp/symbols/altwin	10 Oct 2001 19:18:32 -0000	1.4
+++ programs/xkbcomp/symbols/altwin	3 Dec 2003 14:09:08 -0000	1.5
@@ -1,4 +1,4 @@
-// $XFree86: xc/programs/xkbcomp/symbols/altwin,v 1.4 2001/10/10 19:18:32 herrb Exp $
+// $XFree86: xc/programs/xkbcomp/symbols/altwin,v 1.5 2003/12/03 14:09:08 pascal Exp $
 
 partial modifier_keys 
 xkb_symbols "meta_alt" {
@@ -15,7 +15,7 @@
     key <LWIN> {	[ 	Meta_L			]	};
     key <RWIN> {	[ 	Meta_R			]	};
     modifier_map Mod1	{ Alt_L, Alt_R };
-    modifier_map Mod4	{ Meta_L, Meta_R };
+    modifier_map Mod4	{ <META>, Meta_L, Meta_R };
 };
 
 partial modifier_keys 
@@ -23,7 +23,7 @@
     key <LALT> {	[ 	Alt_L,	Alt_L		]	};
     key <LWIN> {	[ 	Meta_L			]	};
     modifier_map Mod1	{ Alt_L };
-    modifier_map Mod4	{ Meta_L };
+    modifier_map Mod4	{ <META>, Meta_L };
 };
 
 partial modifier_keys 
Index: programs/xmodmap/exec.c
===================================================================
RCS file: /cvs/xc/programs/xmodmap/exec.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- programs/xmodmap/exec.c	14 Dec 2001 20:02:13 -0000	1.5
+++ programs/xmodmap/exec.c	2 Dec 2003 13:13:57 -0000	1.6
@@ -56,7 +56,7 @@
  * Author:  Jim Fulton, MIT X Consortium; derived from parts of the
  * original xmodmap, written by David Rosenthal, of Sun Microsystems.
  */
-/* $XFree86: xc/programs/xmodmap/exec.c,v 1.5 2001/12/14 20:02:13 dawes Exp $ */
+/* $XFree86: xc/programs/xmodmap/exec.c,v 1.6 2003/12/02 13:13:57 pascal Exp $ */
 
 #include <X11/Xos.h>
 #include <X11/Xlib.h>
@@ -212,8 +212,13 @@
 PrintModifierMapping(XModifierKeymap *map, FILE *fp)
 {
     int i, k = 0;
+    int min_keycode, max_keycode, keysyms_per_keycode = 0;
 
-    fprintf (fp, 
+    XDisplayKeycodes (dpy, &min_keycode, &max_keycode);
+    XGetKeyboardMapping (dpy, min_keycode, (max_keycode - min_keycode + 1),
+			 &keysyms_per_keycode);
+
+    fprintf (fp,
     	     "%s:  up to %d keys per modifier, (keycodes in parentheses):\n\n", 
     	     ProgramName, map->max_keypermod);
     for (i = 0; i < 8; i++) {
@@ -222,8 +227,14 @@
 	fprintf(fp, "%-10s", modifier_table[i].name);
 	for (j = 0; j < map->max_keypermod; j++) {
 	    if (map->modifiermap[k]) {
-		KeySym ks = XKeycodeToKeysym(dpy, map->modifiermap[k], 0);
-		char *nm = XKeysymToString(ks);
+		KeySym ks;
+		int index = 0;
+		char *nm;
+		do {
+		    ks = XKeycodeToKeysym(dpy, map->modifiermap[k], index);
+		    index++;
+		} while ( !ks && index < keysyms_per_keycode);
+		nm = XKeysymToString(ks);
 
 		fprintf (fp, "%s  %s (0x%0x)", (j > 0 ? "," : ""), 
 			 (nm ? nm : "BadKey"), map->modifiermap[k]);
Index: programs/xkbcomp/expr.c
===================================================================
RCS file: /cvs/xc/programs/xkbcomp/expr.c,v
retrieving revision 3.7
retrieving revision 3.8
diff -u -r3.7 -r3.8
--- programs/xkbcomp/expr.c	6 Aug 2003 14:04:05 -0000	3.7
+++ programs/xkbcomp/expr.c	18 Dec 2003 14:14:37 -0000	3.8
@@ -24,7 +24,7 @@
  THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
  ********************************************************/
-/* $XFree86: xc/programs/xkbcomp/expr.c,v 3.7 2003/08/06 14:04:05 eich Exp $ */
+/* $XFree86: xc/programs/xkbcomp/expr.c,v 3.8 2003/12/18 14:14:37 pascal Exp $ */
 
 #include "xkbcomp.h"
 #include "tokens.h"
@@ -245,6 +245,7 @@
 	{	"mod3",		Mod3MapIndex	},
 	{	"mod4",		Mod4MapIndex	},
 	{	"mod5",		Mod5MapIndex	},
+	{	"none",		XkbNoModifier	},
 	{	NULL,		0		}
 };
 

Reply to: