From 7b24db53fc606a94067d90e8c64d8e7c8c75c12b 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 IconUp 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/icons.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/icons.c b/src/icons.c index f4fde40..296d3e3 100644 --- a/src/icons.c +++ b/src/icons.c @@ -173,12 +173,15 @@ IconUp(TwmWindow *tmp_win) return; if (tmp_win->icon_moved) { + unsigned width = 0; + unsigned height = 0; + if (!XGetGeometry(dpy, tmp_win->icon_w, &JunkRoot, &defx, &defy, - &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth)) + &width, &height, &JunkBW, &JunkDepth)) return; - x = defx + ((int) JunkWidth) / 2; - y = defy + ((int) JunkHeight) / 2; + x = defx + ((int) width) / 2; + y = defy + ((int) height) / 2; for (ir = Scr->FirstRegion; ir; ir = ir->next) { if (x >= ir->x && x < (ir->x + ir->w) && -- cgit v1.2.3