Replace deprecated XKeycodeToKeysym with XkbKeycodeToKeysym

XKeycodeToKeysym() has been deprecated since X11R6.1 (1996).
Use XkbKeycodeToKeysym() instead, which takes an additional group
parameter (0 for default keyboard group).

API change:
  XKeycodeToKeysym(display, keycode, index)
  -> XkbKeycodeToKeysym(display, keycode, 0, index)

Files modified:
- lib/DtWidget/Editor.c
- programs/dtcalc/motif.c
- programs/dtsession/SmSave.c
- programs/dtwm/WmCPlace.c
- programs/dtwm/WmResParse.c
- programs/dtwm/WmWinConf.c
This commit is contained in:
Trung Lê 2026-01-29 16:48:22 +11:00
parent f0154141b1
commit c0c47c28e9
6 changed files with 15 additions and 9 deletions

View File

@ -82,6 +82,7 @@
#include "X11/Xutil.h"
#include <X11/StringDefs.h>
#include <X11/keysymdef.h>
#include <X11/XKBlib.h>
#include <Xm/Form.h>
#include <Xm/MessageB.h>
#include <Xm/MwmUtil.h>
@ -3735,7 +3736,7 @@ GetModeSwitchModifier(
for (mapIndex = 3*pMap->max_keypermod; mapIndex < mapSize; mapIndex++) {
/* look only at the first 4 columns of key map */
for (keyCol = 0; keyCol < 4; keyCol++) {
keySym = XKeycodeToKeysym(dpy, pMap->modifiermap[mapIndex], keyCol);
keySym = XkbKeycodeToKeysym(dpy, pMap->modifiermap[mapIndex], 0, keyCol);
if (keySym == XK_Mode_switch)
modeSwitchModMask |= 1 << (mapIndex / pMap->max_keypermod);
}

View File

@ -47,6 +47,7 @@
#include "calctool.h"
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/XKBlib.h>
#include <X11/Xatom.h>
#include <Xm/XmP.h>
#include <Xm/Xm.h>
@ -2105,7 +2106,7 @@ key_init(void)
X->kparray[i - X->kcmin] = 0 ;
for (j = 0; j < X->keysyms_per_key; ++j)
{
ks = XKeycodeToKeysym(X->dpy, i, j) ;
ks = XkbKeycodeToKeysym(X->dpy, i, 0, j) ;
if (IsKeypadKey(ks))
{
X->kparray[i - X->kcmin] = 1 ;
@ -2125,7 +2126,7 @@ keypad_keysym(XEvent *xevent)
for (i = 0; i < X->keysyms_per_key; ++i)
{
ks = XKeycodeToKeysym(X->dpy, keycode, i) ;
ks = XkbKeycodeToKeysym(X->dpy, keycode, 0, i) ;
if (IsKeypadKey(ks))
{
#ifdef sun

View File

@ -67,6 +67,7 @@
#endif /* _SUN_OS */
#include <X11/Intrinsic.h>
#include <X11/XKBlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/StringDefs.h>
@ -1327,7 +1328,7 @@ QueryServerSettings( void )
return(-1);
}
}
tmpMod = XKeycodeToKeysym(smGD.display, modMap->modifiermap[i], 0);
tmpMod = XkbKeycodeToKeysym(smGD.display, modMap->modifiermap[i], 0, 0);
sprintf(tmpChar,"%ld", tmpMod);
strcat(resSpec, tmpChar);
if(i != numLoops)

View File

@ -37,6 +37,7 @@
#define XK_MISCELLANY
#define XK_LATIN1
#include <X11/keysymdef.h>
#include <X11/XKBlib.h>
/* absolute value macro */
#ifndef ABS
@ -302,7 +303,7 @@ void HandlePlacementKeyEvent (ClientData *pcd, XKeyEvent *pev)
}
/* convert event data to useful key data */
keysym = XKeycodeToKeysym (DISPLAY, pev->keycode, 0);
keysym = XkbKeycodeToKeysym(DISPLAY, pev->keycode, 0, 0);
control = (pev->state & ControlMask) != 0;
big_inc = DisplayWidth(DISPLAY, ACTIVE_PSD->screen) / 20;

View File

@ -61,6 +61,7 @@
#include <X11/cursorfont.h>
#include <X11/keysym.h>
#include <X11/XKBlib.h>
#include <X11/Xatom.h>
#include <ctype.h>
@ -1583,7 +1584,7 @@ void SyncModifierStrings(void)
{
if (map->modifiermap[k])
{
KeySym ks = XKeycodeToKeysym(DISPLAY, map->modifiermap[k], 0);
KeySym ks = XkbKeycodeToKeysym(DISPLAY, map->modifiermap[k], 0, 0);
char *nm = XKeysymToString(ks);
/* Compare, ignoring the trailing '_L' or '_R' in keysym */

View File

@ -38,6 +38,7 @@
#define XK_MISCELLANY
#include <X11/keysymdef.h>
#include <X11/XKBlib.h>
#define MOVE_OUTLINE_WIDTH 2
@ -279,7 +280,7 @@ void HandleClientFrameMove (ClientData *pcd, XEvent *pev)
keyMultiplier++;
}
keysym = XKeycodeToKeysym (DISPLAY, pev->xkey.keycode, 0);
keysym = XkbKeycodeToKeysym(DISPLAY, pev->xkey.keycode, 0, 0);
control = (pev->xkey.state & ControlMask) != 0;
tmpX = tmpY = 0;
@ -692,7 +693,7 @@ Boolean HandleResizeKeyPress (ClientData *pcd, XEvent *pev)
keyMult++;
}
keysym = XKeycodeToKeysym (DISPLAY, pev->xkey.keycode, 0);
keysym = XkbKeycodeToKeysym(DISPLAY, pev->xkey.keycode, 0, 0);
control = (pev->xkey.state & ControlMask) != 0;
switch (keysym) {
@ -4328,7 +4329,7 @@ Boolean HandleMarqueeKeyPress (WmScreenData *pSD, XEvent *pev)
keyMult++;
}
keysym = XKeycodeToKeysym (DISPLAY, pev->xkey.keycode, 0);
keysym = XkbKeycodeToKeysym(DISPLAY, pev->xkey.keycode, 0, 0);
control = (pev->xkey.state & ControlMask) != 0;
switch (keysym) {