From 742839139ec63a2933395064100c1510bda1a86e Mon Sep 17 00:00:00 2001 From: Deven Blake Date: Tue, 11 May 2021 14:18:07 -0400 Subject: [PATCH] tear out more stuff --- dmenubar/dmenu.c | 46 ++-------------------------------------------- 1 file changed, 2 insertions(+), 44 deletions(-) diff --git a/dmenubar/dmenu.c b/dmenubar/dmenu.c index abae21e..a136aad 100644 --- a/dmenubar/dmenu.c +++ b/dmenubar/dmenu.c @@ -168,41 +168,10 @@ drawmenu(void) drw_map(drw, win, 0, 0, mw, mh); } -static void -grabfocus(void) -{ - return; - struct timespec ts = { .tv_sec = 0, .tv_nsec = 10000000 }; - Window focuswin; - int i, revertwin; - - for (i = 0; i < 100; ++i) { - XGetInputFocus(dpy, &focuswin, &revertwin); - if (focuswin == win) - return; - XSetInputFocus(dpy, win, RevertToParent, CurrentTime); - nanosleep(&ts, NULL); - } - die("cannot grab focus"); -} - static void grabkeyboard(void) { return; - struct timespec ts = { .tv_sec = 0, .tv_nsec = 1000000 }; - int i; - - if (embed) - return; - /* try to grab keyboard, we may have to wait for another process to ungrab */ - for (i = 0; i < 1000; i++) { - if (XGrabKeyboard(dpy, DefaultRootWindow(dpy), True, GrabModeAsync, - GrabModeAsync, CurrentTime) == GrabSuccess) - return; - nanosleep(&ts, NULL); - } - die("cannot grab keyboard"); } static void @@ -363,11 +332,6 @@ run(void) if (ev.xexpose.count == 0) drw_map(drw, win, 0, 0, mw, mh); break; - case FocusIn: - /* regrab focus from parent window */ - if (ev.xfocus.window != win) - grabfocus(); - break; case SelectionNotify: if (ev.xselection.property == utf8) paste(); @@ -474,7 +438,6 @@ setup(void) XSelectInput(dpy, dws[i], FocusChangeMask); XFree(dws); } - grabfocus(); } drw_resize(drw, mw, mh); drawmenu(); @@ -544,13 +507,8 @@ main(int argc, char *argv[]) die("pledge"); #endif - if (fast && !isatty(0)) { - grabkeyboard(); - readstdin(); - } else { - readstdin(); - grabkeyboard(); - } + readstdin(); + setup(); run();