dmenu: Check for locale support

This commit is contained in:
Tee KOBAYASHI 2022-04-25 21:55:12 +09:00 committed by xtkoba
parent 9eb2d6d13e
commit e08cb5c2c8
2 changed files with 44 additions and 1 deletions

View File

@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Generic menu for X"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=5.0
TERMUX_PKG_REVISION=4
TERMUX_PKG_REVISION=5
TERMUX_PKG_SRCURL=https://dl.suckless.org/tools/dmenu-$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_SHA256=fe18e142c4dbcf71ba5757dbbdea93b1c67d58fc206fc116664f4336deef6ed3
TERMUX_PKG_DEPENDS="dash, freetype, libxinerama, libx11, libxft"

View File

@ -0,0 +1,43 @@
--- a/dmenu.c
+++ b/dmenu.c
@@ -312,6 +312,11 @@
KeySym ksym;
Status status;
+#ifdef __ANDROID__
+ if (!XSupportsLocale()) {
+ len = XLookupString(ev, buf, sizeof buf, &ksym, NULL);
+ } else {
+#endif
len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status);
switch (status) {
default: /* XLookupNone, XBufferOverflow */
@@ -322,6 +327,9 @@
case XLookupBoth:
break;
}
+#ifdef __ANDROID__
+ }
+#endif
if (ev->state & ControlMask) {
switch(ksym) {
@@ -665,12 +673,18 @@
XSetClassHint(dpy, win, &ch);
+#ifdef __ANDROID__
+ if (XSupportsLocale()) {
+#endif
/* input methods */
if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL)
die("XOpenIM failed: could not open input device");
xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
XNClientWindow, win, XNFocusWindow, win, NULL);
+#ifdef __ANDROID__
+ }
+#endif
XMapRaised(dpy, win);
if (embed) {