From f6fb5b536cd2a96ef1ac26599fd48ef89a628a77 Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Sat, 20 Jan 2024 16:07:00 +0100 Subject: Rework dummy variable usage in SetHighlightPixmap twm defines several "junk" variables to use with functions like XQueryPointer or XGetGeometry. In some instances, the returned values are actually used, which makes the code confusing and hard to reason about. Use dedicated variables in those cases. Signed-off-by: Tim Wiederhake --- src/add_window.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/add_window.c b/src/add_window.c index 9a526f7..1f5abe1 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -1347,15 +1347,18 @@ CreateWindowTitlebarButtons(TwmWindow *tmp_win) void SetHighlightPixmap(char *filename) { - Pixmap pm = GetBitmap(filename); + unsigned width = 0; + unsigned height = 0; + + Pixmap pm = FindBitmap(filename, &width, &height); if (pm) { if (Scr->hilitePm) { XFreePixmap(dpy, Scr->hilitePm); } Scr->hilitePm = pm; - Scr->hilite_pm_width = (int) JunkWidth; - Scr->hilite_pm_height = (int) JunkHeight; + Scr->hilite_pm_width = (int) width; + Scr->hilite_pm_height = (int) height; } } -- cgit v1.2.3