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
commit895e0e6630eea3cea07d4e4f47f0264ea5263c8e (patch)
treed85bd03dee1b8d4c81d656a5fae99bf43ecd83b3
parent0182535025b0864d6e0cf165ab14756bfbe6d015 (diff)
Rework dummy variable usage in AddWindow
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/add_window.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/add_window.c b/src/add_window.c
index 39a9325..9a526f7 100644
--- a/src/add_window.c
+++ b/src/add_window.c
@@ -432,29 +432,30 @@ AddWindow(Window w, int iconm, IconMgr *iconp)
*/
while (TRUE) {
int stat;
+ Window root = None;
+ unsigned mask = 0;
XUngrabServer(dpy);
XSync(dpy, 0);
XGrabServer(dpy);
- JunkMask = 0;
- if (!XQueryPointer(dpy, Scr->Root, &JunkRoot,
+ if (!XQueryPointer(dpy, Scr->Root, &root,
&JunkChild, &JunkX, &JunkY,
- &AddingX, &AddingY, &JunkMask))
- JunkMask = 0;
+ &AddingX, &AddingY, &mask))
+ mask = 0;
- JunkMask &= (Button1Mask | Button2Mask | Button3Mask |
+ mask &= (Button1Mask | Button2Mask | Button3Mask |
Button4Mask | Button5Mask);
/*
* watch out for changing screens
*/
if (firsttime) {
- if (JunkRoot != Scr->Root) {
+ if (root != Scr->Root) {
register int scrnum;
for (scrnum = 0; scrnum < NumScreens; scrnum++) {
- if (JunkRoot == RootWindow(dpy, scrnum))
+ if (root == RootWindow(dpy, scrnum))
break;
}
@@ -467,7 +468,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp)
/*
* wait for buttons to come up; yuck
*/
- if (JunkMask != 0)
+ if (mask != 0)
continue;
/*