FKtPp, this is an old and annoying bug, introduced by XFree86 in 2004 or
so. Thanks for reporting it again.
My approach to it, below, will work with X.org servers, and whatever XFree86
servers are left out there, and doesn’t have the problem Mats saw. For those
running
non-X.org X11 client libraries on XFree86 servers, there will be the
very minor annoyance of the shift modifier not being stripped and the
keysyms XF86_Switch_VT_11 (etc) keysym being passed to XEmacs, but that has
an obvious workaround, which the current situation does not.
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1314473723 -3600
# Node ID 53c0663119210e3a5bee68d57e5eac19fb25d13d
# Parent a142ad1a9140f795f809aa4ad42fc11edcb4bdf5
If XLookupKeysym() returned an XFree86 "special key", ignore it. Fixes Sh-F11.
src/ChangeLog addition:
2011-08-27 Aidan Kehoe <kehoea(a)parhasard.net>
* config.h.in: Make HAVE_X11_XF86KEYSYM_H available here.
* event-Xt.c: #include X11/XF86keysym.h if available.
* event-Xt.c (x_event_to_emacs_event):
If XLookupKeysym () returned one of the XFree86 "special action
keys" for the shifted keysym, treat that as NoSymbol, fixing a
long-standing bug with shifted function keys under X.org.
Details of why in:
http://mid.gmane.org/16960.15685.26911.644835@parhasard.net
ChangeLog addition:
2011-08-27 Aidan Kehoe <kehoea(a)parhasard.net>
* configure.ac: Check whether X11/XF86keysym.h is available, to
allow us to avoid a bug in the interaction of XKB and XLookupKeysym.
* configure: Regenerate.
diff -r a142ad1a9140 -r 53c066311921 ChangeLog
--- a/ChangeLog Wed Aug 24 23:41:29 2011 +0100
+++ b/ChangeLog Sat Aug 27 20:35:23 2011 +0100
@@ -1,3 +1,9 @@
+2011-08-27 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * configure.ac: Check whether X11/XF86keysym.h is available, to
+ allow us to avoid a bug in the interaction of XKB and XLookupKeysym.
+ * configure: Regenerate.
+
2011-08-24 Aidan Kehoe <kehoea(a)parhasard.net>
* configure.ac:
diff -r a142ad1a9140 -r 53c066311921 configure
--- a/configure Wed Aug 24 23:41:29 2011 +0100
+++ b/configure Sat Aug 27 20:35:23 2011 +0100
@@ -13351,7 +13351,7 @@
done
- for ac_header in X11/Xlocale.h X11/Xfuncproto.h
+ for ac_header in X11/Xlocale.h X11/Xfuncproto.h X11/XF86keysym.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header"
"$as_ac_Header" "$ac_includes_default"
diff -r a142ad1a9140 -r 53c066311921 configure.ac
--- a/configure.ac Wed Aug 24 23:41:29 2011 +0100
+++ b/configure.ac Sat Aug 27 20:35:23 2011 +0100
@@ -3120,7 +3120,7 @@
AC_CHECK_FUNCS(XConvertCase XtRegisterDrawable)
- AC_CHECK_HEADERS(X11/Xlocale.h X11/Xfuncproto.h)
+ AC_CHECK_HEADERS(X11/Xlocale.h X11/Xfuncproto.h X11/XF86keysym.h)
dnl XFree86 has a non-standard prototype for this X11R6 function
AC_CHECK_FUNCS(XRegisterIMInstantiateCallback)
diff -r a142ad1a9140 -r 53c066311921 src/ChangeLog
--- a/src/ChangeLog Wed Aug 24 23:41:29 2011 +0100
+++ b/src/ChangeLog Sat Aug 27 20:35:23 2011 +0100
@@ -1,3 +1,14 @@
+2011-08-27 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * config.h.in: Make HAVE_X11_XF86KEYSYM_H available here.
+ * event-Xt.c: #include X11/XF86keysym.h if available.
+ * event-Xt.c (x_event_to_emacs_event):
+ If XLookupKeysym () returned one of the XFree86 "special action
+ keys" for the shifted keysym, treat that as NoSymbol, fixing a
+ long-standing bug with shifted function keys under X.org.
+ Details of why in:
+
http://mid.gmane.org/16960.15685.26911.644835@parhasard.net
+
2011-08-24 Aidan Kehoe <kehoea(a)parhasard.net>
* config.h.in:
diff -r a142ad1a9140 -r 53c066311921 src/config.h.in
--- a/src/config.h.in Wed Aug 24 23:41:29 2011 +0100
+++ b/src/config.h.in Sat Aug 27 20:35:23 2011 +0100
@@ -284,6 +284,7 @@
#undef HAVE_SYS_WAIT_H
#undef HAVE_LIBINTL_H
#undef HAVE_X11_XLOCALE_H
+#undef HAVE_X11_XF86KEYSYM_H
/* About __STDC__: Different compilers differ wrt __STDC__. Sunpro C
defines it, but its value is 0 unless we disable non-ANSI extensions.
diff -r a142ad1a9140 -r 53c066311921 src/event-Xt.c
--- a/src/event-Xt.c Wed Aug 24 23:41:29 2011 +0100
+++ b/src/event-Xt.c Sat Aug 27 20:35:23 2011 +0100
@@ -66,6 +66,10 @@
#include "xmotif.h"
#endif
+#ifdef HAVE_X11_XF86KEYSYM_H
+#include <X11/XF86keysym.h>
+#endif
+
#ifdef HAVE_DRAGNDROP
#include "dragdrop.h"
#endif
@@ -1230,6 +1234,21 @@
int Mode_switch_p = *state & xd->ModeMask;
KeySym bot = XLookupKeysym (ev, Mode_switch_p ? 2 : 0);
KeySym top = XLookupKeysym (ev, Mode_switch_p ? 3 : 1);
+
+#ifdef HAVE_X11_XF86KEYSYM_H
+ /* XLookupKeysm() and XLookupString() differ for these
+ keysyms under X.org. The latter treats them as not
+ visible to X11 apps (so if the event has the shift
+ modifer, the keysym of the unshifted key will be
+ returned) while the former treats them as visible. We
+ chose to follow XLookupString in x_to_emacs_keysym(), so
+ we need to do that here, too. */
+
+ if (XF86XK_Switch_VT_1 <= top && top <= XF86XK_Prev_VMode)
+ {
+ top = NoSymbol;
+ }
+#endif
if (top && bot && top != bot)
modifiers &= ~XEMACS_MOD_SHIFT;
}
--
‘Iodine deficiency was endemic in parts of the UK until, through what has been
described as “an unplanned and accidental public health triumph”, iodine was
added to cattle feed to improve milk production in the 1930s.’
(EN Pearce, Lancet, June 2011)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches