changeset 5557:53c066311921

If XLookupKeysym() returned an XFree86 "special key", ignore it. Fixes Sh-F11. src/ChangeLog addition: 2011-08-27 Aidan Kehoe <kehoea@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@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.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 27 Aug 2011 20:35:23 +0100
parents a142ad1a9140
children 10455659ab64
files ChangeLog configure configure.ac src/ChangeLog src/config.h.in src/event-Xt.c
diffstat 6 files changed, 39 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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@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@parhasard.net>
 
 	* configure.ac:
--- 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"
--- 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)
--- 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@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@parhasard.net>
 
 	* 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.
--- 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;
 	      }