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
commitb9f33162eaad31988e3595ddcd3efd97ee2da0aa (patch)
tree1ffc0ca4b38e16c8e5c4a0ec54aea62b713bfacd
parentf6fb5b536cd2a96ef1ac26599fd48ef89a628a77 (diff)
Rework dummy variable usage in HandleButtonPress
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/events.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/events.c b/src/events.c
index a8c8fec..9d82b81 100644
--- a/src/events.c
+++ b/src/events.c
@@ -1782,13 +1782,17 @@ HandleButtonPress(void)
if (Tmp_win->list && RootFunction != 0 &&
(Event.xany.window == Tmp_win->list->w ||
Event.xany.window == Tmp_win->list->icon)) {
+ int x = 0;
+ int y = 0;
+
Tmp_win = Tmp_win->list->iconmgr->twm_win;
+
XTranslateCoordinates(dpy, Event.xany.window, Tmp_win->w,
Event.xbutton.x, Event.xbutton.y,
- &JunkX, &JunkY, &JunkChild);
+ &x, &y, &JunkChild);
- Event.xbutton.x = JunkX;
- Event.xbutton.y = JunkY - Tmp_win->title_height;
+ Event.xbutton.x = x;
+ Event.xbutton.y = y - Tmp_win->title_height;
Event.xany.window = Tmp_win->w;
Context = C_WINDOW;
@@ -1844,6 +1848,8 @@ HandleButtonPress(void)
* inside of a client that was getting button press events.
*/
XPointer context_data;
+ int x = 0;
+ int y = 0;
XTranslateCoordinates(dpy, Scr->Root, Scr->Root,
Event.xbutton.x,
@@ -1863,10 +1869,10 @@ HandleButtonPress(void)
XTranslateCoordinates(dpy, Scr->Root, Event.xany.window,
Event.xbutton.x,
- Event.xbutton.y, &JunkX, &JunkY, &JunkChild);
+ Event.xbutton.y, &x, &y, &JunkChild);
- Event.xbutton.x = JunkX;
- Event.xbutton.y = JunkY;
+ Event.xbutton.x = x;
+ Event.xbutton.y = y;
Context = C_WINDOW;
}