summaryrefslogtreecommitdiffstats
path: root/dmenu.c
diff options
context:
space:
mode:
authorGravatar Hiltjo Posthuma 2019-02-12 19:10:43 +0100
committerGravatar Hiltjo Posthuma 2019-02-12 19:10:43 +0100
commitf5036b90efd9423d805923a0bc73cd54e30e72ab (patch)
treef4749d145a5296546aa98e041f9c0fbb501a4f60 /dmenu.c
parentClose when the embedding window is destroyed (diff)
fix crash when XOpenIM returns NULL
for example when IME variables are set, but the program is not started (yet).
Diffstat (limited to '')
-rw-r--r--dmenu.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/dmenu.c b/dmenu.c
index f803149..ae56f4f 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -664,8 +664,17 @@ setup(void)
CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
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 device.\n");
+ }
+ }
+
xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
XNClientWindow, win, XNFocusWindow, win, NULL);