diff options
| author | Andrew Guschin <saintruler@gmail.com> | 2021-09-02 13:36:03 +0400 |
|---|---|---|
| committer | Andrew Guschin <saintruler@gmail.com> | 2021-09-02 13:36:03 +0400 |
| commit | 66d96197ebd426f8a23dd456b83e7e433561c42b (patch) | |
| tree | 2fc16340aa18d2f0c70a537e324f6a20ebe78883 /dmenu.c | |
| parent | a07da3824f8ddae3fd06e0353ea351f846022147 (diff) | |
Bumped to 5.0
Diffstat (limited to 'dmenu.c')
| -rw-r--r-- | dmenu.c | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -553,9 +553,14 @@ run(void) XEvent ev; while (!XNextEvent(dpy, &ev)) { - if (XFilterEvent(&ev, None)) + if (XFilterEvent(&ev, win)) continue; switch(ev.type) { + case DestroyNotify: + if (ev.xdestroywindow.window != win) + break; + cleanup(); + exit(1); case Expose: if (ev.xexpose.count == 0) drw_map(drw, win, 0, 0, mw, mh); @@ -659,15 +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) + die("XOpenIM failed: could not open input device"); + xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, win, XNFocusWindow, win, NULL); XMapRaised(dpy, win); - XSetInputFocus(dpy, win, RevertToParent, CurrentTime); if (embed) { - XSelectInput(dpy, parentwin, FocusChangeMask); + XSelectInput(dpy, parentwin, FocusChangeMask | SubstructureNotifyMask); if (XQueryTree(dpy, parentwin, &dw, &w, &dws, &du) && dws) { for (i = 0; i < du && dws[i] != win; ++i) XSelectInput(dpy, dws[i], FocusChangeMask); @@ -731,8 +738,6 @@ 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); |