summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Wiederhake <twied@gmx.net>2024-01-20 16:07:00 +0100
committerTim Wiederhake <twied@gmx.net>2024-01-20 16:07:00 +0100
commit7b24db53fc606a94067d90e8c64d8e7c8c75c12b (patch)
tree68d2e944e324996a72434e64f87a6ffb865d37e0
parent24bfa418612288c4847bcfe088aba05ce402d1d2 (diff)
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 <twied@gmx.net>
-rw-r--r--src/icons.c9
1 files 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) &&