diff options
author | Tim Wiederhake <twied@gmx.net> | 2024-01-20 16:07:00 +0100 |
---|---|---|
committer | Tim Wiederhake <twied@gmx.net> | 2024-01-20 16:07:00 +0100 |
commit | c5a63751f8b4eab72794e56365ead929023f2b94 (patch) | |
tree | df13c5ec28b27bb1b02a06c214b0b889fe3f174e | |
parent | 6ea386bd98a737a9f54e2ca4216adf45868fd6e4 (diff) |
Remove global variables JunkX, JunkY
Replace with a local variable following the naming scheme from
Identify() in src/menus.c.
Signed-off-by: Tim Wiederhake <twied@gmx.net>
-rw-r--r-- | src/add_window.c | 9 | ||||
-rw-r--r-- | src/events.c | 9 | ||||
-rw-r--r-- | src/icons.c | 9 | ||||
-rw-r--r-- | src/menus.c | 14 | ||||
-rw-r--r-- | src/parse.c | 3 | ||||
-rw-r--r-- | src/twm.c | 5 | ||||
-rw-r--r-- | src/twm.h | 2 | ||||
-rw-r--r-- | src/util.c | 3 |
8 files changed, 28 insertions, 26 deletions
diff --git a/src/add_window.c b/src/add_window.c index e451bfe..87cb51b 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -162,6 +162,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) Bool width_ever_changed_by_user; Bool height_ever_changed_by_user; char *name; + int dummy = 0; Window wdummy = None; #ifdef DEBUG @@ -441,7 +442,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) XGrabServer(dpy); if (!XQueryPointer(dpy, Scr->Root, &root, - &wdummy, &JunkX, &JunkY, + &wdummy, &dummy, &dummy, &AddingX, &AddingY, &mask)) mask = 0; @@ -569,7 +570,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) } XQueryPointer(dpy, Scr->Root, &wdummy, &wdummy, - &JunkX, &JunkY, &AddingX, &AddingY, + &dummy, &dummy, &AddingX, &AddingY, &JunkMask); if (Scr->DontMoveOff) { @@ -664,7 +665,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) * grab the server. */ XQueryPointer(dpy, Scr->Root, &wdummy, &wdummy, - &JunkX, &JunkY, &AddingX, &AddingY, + &dummy, &dummy, &AddingX, &AddingY, &JunkMask); if (lastx != AddingX || lasty != AddingY) { @@ -766,7 +767,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) * reparented, so we'll get a DestroyNotify for it. We won't have * gotten one for anything up to here, however. */ - if (XGetGeometry(dpy, tmp_win->w, &wdummy, &JunkX, &JunkY, + if (XGetGeometry(dpy, tmp_win->w, &wdummy, &dummy, &dummy, &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth) == 0) { free(tmp_win); XUngrabServer(dpy); diff --git a/src/events.c b/src/events.c index 54f5bff..3fd74d2 100644 --- a/src/events.c +++ b/src/events.c @@ -735,6 +735,7 @@ HandlePropertyNotify(void) char *name = NULL; XSetWindowAttributes attributes; /* attributes for create windows */ Pixmap pm; + int dummy = 0; Window wdummy = None; /* watch for standard colormap changes */ @@ -901,7 +902,7 @@ HandlePropertyNotify(void) unsigned long valuemask; /* mask for create windows */ if (!XGetGeometry(dpy, Tmp_win->wmhints->icon_pixmap, &wdummy, - &JunkX, &JunkY, + &dummy, &dummy, (unsigned int *) &Tmp_win->icon_width, (unsigned int *) &Tmp_win->icon_height, &JunkBW, &JunkDepth)) { @@ -1017,6 +1018,7 @@ RedoIconName(void) void HandleClientMessage(void) { + int dummy = 0; Window wdummy = None; if (Event.xclient.message_type == _XA_WM_CHANGE_STATE) { @@ -1027,7 +1029,7 @@ HandleClientMessage(void) XQueryPointer(dpy, Scr->Root, &wdummy, &wdummy, &(button.xmotion.x_root), &(button.xmotion.y_root), - &JunkX, &JunkY, &JunkMask); + &dummy, &dummy, &JunkMask); ExecuteFunction(F_ICONIFY, NULLSTR, Event.xany.window, Tmp_win, &button, FRAME, FALSE); @@ -1701,6 +1703,7 @@ HandleButtonPress(void) { unsigned int modifier; Cursor cur; + int dummy = 0; Window wdummy = None; /* too much code relies on this assumption */ @@ -1859,7 +1862,7 @@ HandleButtonPress(void) XTranslateCoordinates(dpy, Scr->Root, Scr->Root, Event.xbutton.x, Event.xbutton.y, - &JunkX, &JunkY, &Event.xany.window); + &dummy, &dummy, &Event.xany.window); if (Event.xany.window == 0 || (XFindContext(dpy, Event.xany.window, TwmContext, diff --git a/src/icons.c b/src/icons.c index 4e406af..5b34245 100644 --- a/src/icons.c +++ b/src/icons.c @@ -320,6 +320,7 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) XSetWindowAttributes attributes; /* attributes for create windows */ Pixmap pm = None; /* tmp pixmap variable */ int final_x, final_y; + int dummy = 0; Window wdummy = None; FB(tmp_win->iconc.fore, tmp_win->iconc.back); @@ -351,7 +352,7 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) } if (bm != None) { - XGetGeometry(dpy, bm, &wdummy, &JunkX, &JunkY, + XGetGeometry(dpy, bm, &wdummy, &dummy, &dummy, (unsigned int *) &tmp_win->icon_width, (unsigned int *) &tmp_win->icon_height, &JunkBW, &JunkDepth); @@ -377,7 +378,7 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) tmp_win->wmhints->flags & IconPixmapHint) { XGetGeometry(dpy, tmp_win->wmhints->icon_pixmap, - &wdummy, &JunkX, &JunkY, + &wdummy, &dummy, &dummy, (unsigned int *) &tmp_win->icon_width, (unsigned int *) &tmp_win->icon_height, &JunkBW, &JunkDepth); @@ -415,7 +416,7 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) } if (bm != None) { - XGetGeometry(dpy, bm, &wdummy, &JunkX, &JunkY, + XGetGeometry(dpy, bm, &wdummy, &dummy, &dummy, (unsigned int *) &tmp_win->icon_width, (unsigned int *) &tmp_win->icon_height, &JunkBW, &JunkDepth); @@ -477,7 +478,7 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) if (tmp_win->wmhints && tmp_win->wmhints->flags & IconWindowHint) { tmp_win->icon_w = tmp_win->wmhints->icon_window; if (tmp_win->forced || - XGetGeometry(dpy, tmp_win->icon_w, &wdummy, &JunkX, &JunkY, + XGetGeometry(dpy, tmp_win->icon_w, &wdummy, &dummy, &dummy, (unsigned int *) &tmp_win->icon_w_width, (unsigned int *) &tmp_win->icon_w_height, &JunkBW, &JunkDepth) == 0) { diff --git a/src/menus.c b/src/menus.c index 4ab2a30..528fb54 100644 --- a/src/menus.c +++ b/src/menus.c @@ -1120,6 +1120,7 @@ resizeFromCenter(Window w, TwmWindow *tmp_win) { int lastx, lasty, bw2; XEvent event; + int dummy = 0; Window wdummy = None; bw2 = tmp_win->frame_bw * 2; @@ -1130,7 +1131,7 @@ resizeFromCenter(Window w, TwmWindow *tmp_win) &JunkBW, &JunkDepth); XWarpPointer(dpy, None, w, 0, 0, 0, 0, DragWidth / 2, DragHeight / 2); XQueryPointer(dpy, Scr->Root, &wdummy, - &wdummy, &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask); + &wdummy, &dummy, &dummy, &AddingX, &AddingY, &JunkMask); lastx = -10000; lasty = -10000; MenuStartResize(tmp_win, origDragX, origDragY, DragWidth, DragHeight); @@ -1164,7 +1165,7 @@ resizeFromCenter(Window w, TwmWindow *tmp_win) * grab the server. */ XQueryPointer(dpy, Scr->Root, &wdummy, &wdummy, - &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask); + &dummy, &dummy, &AddingX, &AddingY, &JunkMask); if (lastx != AddingX || lasty != AddingY) { MenuDoResize(AddingX, AddingY, tmp_win); @@ -1220,6 +1221,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, int moving_icon = FALSE; Bool fromtitlebar = False; unsigned bw = 0; + int dummy = 0; Window wdummy = None; RootFunction = 0; @@ -1517,7 +1519,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, 0, 0, 0, 0, DragWidth / 2, DragHeight / 2); XQueryPointer(dpy, w, &wdummy, &wdummy, - &JunkX, &JunkY, &DragX, &DragY, &JunkMask); + &dummy, &dummy, &DragX, &DragY, &JunkMask); } last_time = eventp->xbutton.time; @@ -1633,7 +1635,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, XQueryPointer(dpy, rootw, &(eventp->xmotion.root), &wdummy, &(eventp->xmotion.x_root), &(eventp->xmotion.y_root), - &JunkX, &JunkY, &JunkMask); + &dummy, &dummy, &JunkMask); if (DragWindow == None && abs(eventp->xmotion.x_root - origX) < Scr->MoveDelta && @@ -1658,7 +1660,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, ConstMoveDir = MOVE_VERT; XQueryPointer(dpy, DragWindow, &wdummy, &wdummy, - &JunkX, &JunkY, &DragX, &DragY, &JunkMask); + &dummy, &dummy, &DragX, &DragY, &JunkMask); break; case MOVE_VERT: @@ -2530,7 +2532,7 @@ Identify(TwmWindow *t) Info[n++][0] = '\0'; if (t) { - XGetGeometry(dpy, t->w, &wdummy, &JunkX, &JunkY, + XGetGeometry(dpy, t->w, &wdummy, &dummy, &dummy, &wwidth, &wheight, &bw, &depth); (void) XTranslateCoordinates(dpy, t->w, Scr->Root, 0, 0, &x, &y, &junk); snprintf(Info[n++], INFO_SIZE, diff --git a/src/parse.c b/src/parse.c index 3a93806..eae817e 100644 --- a/src/parse.c +++ b/src/parse.c @@ -750,6 +750,7 @@ do_string_keyword(int keyword, char *s) unsigned width = 0; unsigned height = 0; unsigned mask = 0; + int dummy = 0; switch (keyword) { case kws_UsePPosition: @@ -801,7 +802,7 @@ do_string_keyword(int keyword, char *s) return 1; case kws_MaxWindowSize: - mask = (unsigned) XParseGeometry(s, &JunkX, &JunkY, &width, &height); + mask = (unsigned) XParseGeometry(s, &dummy, &dummy, &width, &height); if ((mask & (WidthValue | HeightValue)) != (WidthValue | HeightValue)) { parseWarning("bad MaxWindowSize \"%s\"", s); @@ -138,8 +138,6 @@ int ParseError; /* error parsing the .twmrc file */ int HandlingEvents = FALSE; /* are we handling events yet? */ -int JunkX; /* junk variable */ -int JunkY; /* junk variable */ unsigned int JunkWidth, JunkHeight, JunkBW, JunkDepth, JunkMask; char *ProgramName; @@ -554,9 +552,6 @@ main(int argc, char *argv[]) XGrabServer(dpy); XSync(dpy, 0); - JunkX = 0; - JunkY = 0; - XQueryTree(dpy, Scr->Root, &root, &parent, &children, &nchildren); CreateIconManagers(); if (!Scr->NoIconManagers) @@ -372,8 +372,6 @@ extern int ParseError; extern int HandlingEvents; -extern int JunkX; -extern int JunkY; extern unsigned int JunkWidth, JunkHeight, JunkBW, JunkDepth, JunkMask; extern XGCValues Gcv; extern int InfoLines; @@ -279,10 +279,11 @@ ExpandFilename(const char *name) void GetUnknownIcon(const char *name) { + int dummy = 0; Window wdummy = None; if ((Scr->UnknownPm = GetBitmap(name)) != None) { - XGetGeometry(dpy, Scr->UnknownPm, &wdummy, &JunkX, &JunkY, + XGetGeometry(dpy, Scr->UnknownPm, &wdummy, &dummy, &dummy, (unsigned int *) &Scr->UnknownWidth, (unsigned int *) &Scr->UnknownHeight, &JunkBW, &JunkDepth); } |