Handle IME input
authorQuentin Rameau <quinq@fifth.space>
Mon, 19 Mar 2018 14:42:28 +0000 (15:42 +0100)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Sun, 22 Apr 2018 12:09:05 +0000 (14:09 +0200)
Thanks to nzl <uruabi@gmail.com> for the patch!

dmenu.c

diff --git a/dmenu.c b/dmenu.c
index c852e92..314256f 100644 (file)
--- a/dmenu.c
+++ b/dmenu.c
@@ -552,7 +552,7 @@ run(void)
        XEvent ev;
 
        while (!XNextEvent(dpy, &ev)) {
-               if (XFilterEvent(&ev, win))
+               if (XFilterEvent(&ev, None))
                        continue;
                switch(ev.type) {
                case Expose:
@@ -664,6 +664,7 @@ setup(void)
                        XNClientWindow, win, XNFocusWindow, win, NULL);
 
        XMapRaised(dpy, win);
+       XSetInputFocus(dpy, win, RevertToParent, CurrentTime);
        if (embed) {
                XSelectInput(dpy, parentwin, FocusChangeMask);
                if (XQueryTree(dpy, parentwin, &dw, &w, &dws, &du) && dws) {
@@ -729,6 +730,8 @@ main(int argc, char *argv[])
 
        if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
                fputs("warning: no locale support\n", stderr);
+       if (!XSetLocaleModifiers(""))
+               fputs("warning: no locale modifiers support\n", stderr);
        if (!(dpy = XOpenDisplay(NULL)))
                die("cannot open display");
        screen = DefaultScreen(dpy);