fix crash when XOpenIM returns NULL
for example when IME variables are set, but the program is not started (yet).
This commit is contained in:
parent
153aaf88bf
commit
f5036b90ef
1 changed files with 11 additions and 2 deletions
13
dmenu.c
13
dmenu.c
|
@ -664,8 +664,17 @@ setup(void)
|
||||||
CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
|
CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
|
||||||
XSetClassHint(dpy, win, &ch);
|
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,
|
xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
|
||||||
XNClientWindow, win, XNFocusWindow, win, NULL);
|
XNClientWindow, win, XNFocusWindow, win, NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue