fix crash when XOpenIM returns NULL - dmenu - dynamic menu | |
git clone git://git.suckless.org/dmenu | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit f5036b90efd9423d805923a0bc73cd54e30e72ab | |
parent 153aaf88bf9bf5c6c4b118bd871f8cf1eafdcab5 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Tue, 12 Feb 2019 19:10:43 +0100 | |
fix crash when XOpenIM returns NULL | |
for example when IME variables are set, but the program is not started (yet). | |
Diffstat: | |
M dmenu.c | 13 +++++++++++-- | |
1 file changed, 11 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/dmenu.c b/dmenu.c | |
@@ -664,8 +664,17 @@ setup(void) | |
CWOverrideRedirect | CWBackPixel | CWEventMask, &s… | |
XSetClassHint(dpy, win, &ch); | |
- /* open input methods */ | |
- xim = XOpenIM(dpy, NULL, NULL, NULL); | |
+ | |
+ /* input methods */ | |
+ if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) { | |
+ XSetLocaleModifiers("@im=local"); | |
+ if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) { | |
+ XSetLocaleModifiers("@im="); | |
+ if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) | |
+ die("XOpenIM failed. Could not open input devi… | |
+ } | |
+ } | |
+ | |
xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothin… | |
XNClientWindow, win, XNFocusWindow, win, NULL); | |