tMake calculated width/height available globally - xmenu - drop-down menu for X11
(HTM) git clone git://git.z3bra.org/xmenu.git
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit c6811f6a13d0f8b361c2860ae1c38ac88ac341ec
(DIR) parent 8bac6abcc55ccd2e2a7e20349aa87362becbd683
(HTM) Author: Willy Goiffon <dev@z3bra.org>
Date: Wed, 20 Nov 2019 12:21:15 +0100
Make calculated width/height available globally
Diffstat:
M xmenu.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/xmenu.c b/xmenu.c
t@@ -24,6 +24,8 @@ xcb_window_t wid;
size_t nent = 0;
size_t maxwidth = 0;
size_t maxheight = 0;
+int width = 0;
+int height = 0;
void
usage(FILE *fd, char *name)
t@@ -123,10 +125,13 @@ main(int argc, char *argv[])
maxheight = MAX(xft_txth(entries[nent]), maxheight);
}
+ width = maxwidth * 1.2;
+ height = maxheight * nent * 2.5;
+
wid = xcb_generate_id(dpy);
xcb_create_window(dpy, screen->root_depth, wid, screen->root,
- 0, 0, maxwidth * 1.2, maxheight * nent * 2.5, 0,
- XCB_WINDOW_CLASS_INPUT_OUTPUT, screen->root_visual, mask, val);
+ 0, 0, width, height, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT,
+ screen->root_visual, mask, val);
xcb_map_window(dpy, wid);