From 9ad7b060e055f08ff39ee569f1cf40c7ac56e321 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 CreateIconManagers 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/iconmgr.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/iconmgr.c b/src/iconmgr.c index 7cbc7a7..4aad8fd 100644 --- a/src/iconmgr.c +++ b/src/iconmgr.c @@ -73,26 +73,25 @@ CreateIconManagers(void) } for (p = &Scr->iconmgr; p != NULL; p = p->next) { - int mask = XParseGeometry(p->geometry, &JunkX, &JunkY, + int x = 0; + int y = 0; + int mask = XParseGeometry(p->geometry, &x, &y, (unsigned int *) &p->width, (unsigned int *) &p->height); if (mask & XNegative) - JunkX = Scr->MyDisplayWidth - p->width - - (2 * Scr->BorderWidth) + JunkX; + x += Scr->MyDisplayWidth - p->width - (2 * Scr->BorderWidth); if (mask & YNegative) - JunkY = Scr->MyDisplayHeight - p->height - - (2 * Scr->BorderWidth) + JunkY; + y += Scr->MyDisplayHeight - p->height - (2 * Scr->BorderWidth); background = Scr->IconManagerC.back; GetColorFromList(Scr->IconManagerBL, p->name, (XClassHint *) NULL, &background); - p->w = XCreateSimpleWindow(dpy, Scr->Root, - JunkX, JunkY, (unsigned) p->width, - (unsigned) p->height, 1, Scr->Black, - background); + p->w = XCreateSimpleWindow(dpy, Scr->Root, x, y, + (unsigned) p->width, (unsigned) p->height, + 1, Scr->Black, background); snprintf(str, sizeof(str), "%s Icon Manager", p->name); snprintf(str1, sizeof(str1), "%s Icons", p->name); -- cgit v1.2.3