diff --git a/WINGs/ChangeLog b/WINGs/ChangeLog index 805fb5a6..63bef5c6 100644 --- a/WINGs/ChangeLog +++ b/WINGs/ChangeLog @@ -1,3 +1,9 @@ +Changes since wmaker 0.95.10: +............................ + +- added W_KeycodeToKeysym to replace XKeycodeToKeysym/XkbKeycodeToKeysym calls + + Changes since wmaker 0.92.0: ............................ diff --git a/WINGs/NEWS b/WINGs/NEWS index 327985f3..d3f04063 100644 --- a/WINGs/NEWS +++ b/WINGs/NEWS @@ -1,7 +1,9 @@ -** API and ABI modifications since wmaker 0.92.0 +** API and ABI modifications since wmaker 0.95.10 +---------------------------------------------------- ** libWINGs ** +W_KeycodeToKeysym ADDED struct W_DragDestinationInfo: new members added SIZE CHANGE diff --git a/WINGs/WINGs/WINGs.h b/WINGs/WINGs/WINGs.h index b8e55c43..b6192bdb 100644 --- a/WINGs/WINGs/WINGs.h +++ b/WINGs/WINGs/WINGs.h @@ -26,7 +26,7 @@ #include #include -#define WINGS_H_VERSION 20210726 +#define WINGS_H_VERSION 20230226 #ifdef __cplusplus diff --git a/WINGs/WINGs/WINGsP.h.in b/WINGs/WINGs/WINGsP.h.in index aa60f387..2c36b269 100644 --- a/WINGs/WINGs/WINGsP.h.in +++ b/WINGs/WINGs/WINGsP.h.in @@ -494,6 +494,8 @@ void W_SetPreeditPositon(W_View *view, int x, int y); int W_LookupString(W_View *view, XKeyPressedEvent *event, char *buffer, int buflen, KeySym *keysym, Status *status); +KeySym W_KeycodeToKeysym(Display *display, KeyCode keycode, int index); + /* ---[ wmisc.c ]--------------------------------------------------------- */ diff --git a/WINGs/winputmethod.c b/WINGs/winputmethod.c index 27188112..490a74c2 100644 --- a/WINGs/winputmethod.c +++ b/WINGs/winputmethod.c @@ -213,3 +213,35 @@ int W_LookupString(W_View *view, XKeyPressedEvent *event, char *buffer, int bufl #endif return XLookupString(event, buffer, buflen, keysym, (XComposeStatus *) status); } + +/* + * Map a keycode to the corresponding keysym + * To replace the deprecated X11 function XKeycodeToKeysym + */ +KeySym W_KeycodeToKeysym(Display *display, KeyCode keycode, int index) +{ + static int min_kc = -1; + static int max_kc; + int num_syms; + KeySym *key_syms; + KeySym ks; + + if (min_kc == -1) { + (void) XDisplayKeycodes(display, &min_kc, &max_kc); + } + + if (keycode < min_kc || keycode > max_kc || index < 0) { + return NoSymbol; + } + + key_syms = XGetKeyboardMapping(display, keycode, 1, &num_syms); + if (index >= num_syms) { + XFree(key_syms); + return NoSymbol; + } + + ks = key_syms[index]; + XFree(key_syms); + + return ks; +} diff --git a/configure.ac b/configure.ac index 4e29f69b..3054cc6a 100644 --- a/configure.ac +++ b/configure.ac @@ -78,9 +78,9 @@ WRASTER_VERSION=$WRASTER_CURRENT:$WRASTER_REVISION:$WRASTER_AGE AC_SUBST(WRASTER_VERSION) dnl dnl libWINGs -WINGS_CURRENT=4 +WINGS_CURRENT=5 WINGS_REVISION=0 -WINGS_AGE=1 +WINGS_AGE=2 WINGS_VERSION=$WINGS_CURRENT:$WINGS_REVISION:$WINGS_AGE AC_SUBST(WINGS_VERSION) dnl