tRefactorize code based on -d flag - xmenu - drop-down menu for X11
(HTM) git clone git://git.z3bra.org/xmenu.git
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit 8f9be12c94925f9ded2dc48f78dbaf98cd437d4e
(DIR) parent a4ae7032b6547f29e21c8f94a0b36836bbe64af8
(HTM) Author: Willy Goiffon <dev@z3bra.org>
Date: Thu, 5 Dec 2019 08:21:04 +0100
Refactorize code based on -d flag
Diffstat:
M xmenu.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
---
(DIR) diff --git a/xmenu.c b/xmenu.c
t@@ -309,25 +309,22 @@ main(int argc, char *argv[])
xcb_change_window_attributes(dpy, screen->root, XCB_CW_EVENT_MASK, val);
xcb_flush(dpy);
+ } else {
+ popwindow(menu.x, menu.y, menu.w, menu.h);
+ }
- for (;;) {
- current = -1;
- eventloop();
- if (current >= 0) {
- printf("%s\n", entries[current]);
- fflush(stdout);
- }
-
- xcb_destroy_window(dpy, wid);
+ do {
+ current = -1;
+ eventloop();
+ if (current >= 0) {
+ printf("%s\n", entries[current]);
+ fflush(stdout);
}
- }
- popwindow(menu.x, menu.y, menu.w, menu.h);
- eventloop();
- if (current >= 0)
- printf("%s\n", entries[current]);
+ xcb_destroy_window(dpy, wid);
+ xcb_flush(dpy);
+ } while (dflag);
- xcb_destroy_window(dpy, wid);
xft_unload();
xcb_disconnect(dpy);
return 0;