morgant / mlvwm

Macintosh-like Virtual Window Manager (official repo)
http://www2u.biglobe.ne.jp/~y-miyata/mlvwm.html
275 stars 8 forks source link

XKeycodeToKeysym is deprecated #7

Open morgant opened 3 years ago

morgant commented 3 years ago

There is currently one warning in mlvwm/event.c when compiling with clang on OpenBSD 6.8:

event.c:1791:26: warning: 'XKeycodeToKeysym' is deprecated [-Wdeprecated-declarations]
                        XKeysymToKeycode(dpy, XKeycodeToKeysym(dpy,ev->xkey.keycode,0));
                                              ^
/usr/X11R6/include/X11/Xlib.h:1686:1: note: 'XKeycodeToKeysym' has been explicitly marked deprecated here
_X_DEPRECATED
^
/usr/X11R6/include/X11/Xfuncproto.h:136:40: note: expanded from macro '_X_DEPRECATED'
# define _X_DEPRECATED  __attribute__((deprecated))
morgant commented 3 years ago

There are some XKeycodeToKeysym alternatives discussed in this Stack Overflow question.

fvwm on OpenBSD is still using XKeycodeToKeysym, so no direction there, but the comment for its usage (which is retained in mlvwm, less the comment) is interesting:

/* Here's a real hack - some systems have two keys with the
 * same keysym and different keycodes. This converts all
 * the cases to one keycode. */

I think that converting to XGetKeyboardMapping() is the correct solution as XKB is not available on all platforms, but I'll need to understand it better to see if we can reimplement the hack using it.