Ar an triú lá déag de mí Méan Fómhair, scríobh Jeff Sparkes:
Here's an updated patch. I autoconfed the header XKBlib.h as
well.
This is still broken. It checks HAVE_XKBKEYCODETOKEYSYM at compile time, and
then tries to call XkbKeycodeToKeysym at run time, when XkbKeycodeToKeysym
may well not be there. This is exactly the situation on Apple’s X11, the XKB
library is available at compile time, and as I mentioned, the XKB extension
is not available on the server at runtime, so the below code fails. There
are other servers in use where this is true, see
https://www.google.com/search?q=%22xkb+extension+not+present%22 .
If you *really* want to use XkbKeycodeToKeysym, keep around a function
pointer in the XEmacs device object, initialise it to XkbKeycodeToKeysym on
connection if the XKB extension is available, XKeycodeToKeysym if it isn’t,
and call through the function pointer every time. This will still trigger a
compile-time warning because you’re referencing the XKeycodeToKeysym symbol,
you can use dlsym() to trick this away, but I don’t recommend this.
As I say, there is no problem with our current code, it is the warning that
is incorrect.
--- a/src/event-Xt.c
+++ b/src/event-Xt.c
@@ -382,7 +386,11 @@
for (column = 0; column < 4; column += 2) {
KeyCode code = xd->x_modifier_keymap->modifiermap[modifier_index * mkpm
+ modifier_key];
+#ifdef HAVE_XKBKEYCODETOKEYSYM
+ KeySym sym = (code ? XkbKeycodeToKeysym (display, code, column, 0) : 0);
+#else
KeySym sym = (code ? XKeycodeToKeysym (display, code, column) : 0);
+#endif
if (sym == last_sym) continue;
last_sym = sym;
switch (sym) {
--
‘Liston operated so fast that he once accidentally amputated an assistant’s
fingers along with a patient’s leg, […] The patient and the assistant both
died of sepsis, and a spectator reportedly died of shock, resulting in the
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches