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
commit783b31821d87ea551457f4700f796a51f359cfd1 (patch)
tree00ee2750f4ce1348b8661ffea760eca335648a66
parentc5a63751f8b4eab72794e56365ead929023f2b94 (diff)
Remove global variables JunkWidth, JunkHeight, JunkBW, JunkDepth, JunkMask
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.c7
-rw-r--r--src/cursor.c5
-rw-r--r--src/events.c17
-rw-r--r--src/icons.c20
-rw-r--r--src/menus.c19
-rw-r--r--src/session.c3
-rw-r--r--src/twm.c5
-rw-r--r--src/twm.h1
-rw-r--r--src/util.c12
9 files changed, 51 insertions, 38 deletions
diff --git a/src/add_window.c b/src/add_window.c
index 87cb51b..8af8f73 100644
--- a/src/add_window.c
+++ b/src/add_window.c
@@ -163,6 +163,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp)
Bool height_ever_changed_by_user;
char *name;
int dummy = 0;
+ unsigned udummy = 0;
Window wdummy = None;
#ifdef DEBUG
@@ -571,7 +572,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp)
XQueryPointer(dpy, Scr->Root, &wdummy, &wdummy,
&dummy, &dummy, &AddingX, &AddingY,
- &JunkMask);
+ &udummy);
if (Scr->DontMoveOff) {
int AddingR, AddingB;
@@ -666,7 +667,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp)
*/
XQueryPointer(dpy, Scr->Root, &wdummy, &wdummy,
&dummy, &dummy, &AddingX, &AddingY,
- &JunkMask);
+ &udummy);
if (lastx != AddingX || lasty != AddingY) {
DoResize(AddingX, AddingY, tmp_win);
@@ -768,7 +769,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp)
* gotten one for anything up to here, however.
*/
if (XGetGeometry(dpy, tmp_win->w, &wdummy, &dummy, &dummy,
- &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth) == 0) {
+ &udummy, &udummy, &udummy, &udummy) == 0) {
free(tmp_win);
XUngrabServer(dpy);
return (NULL);
diff --git a/src/cursor.c b/src/cursor.c
index 9cc26c7..297fc08 100644
--- a/src/cursor.c
+++ b/src/cursor.c
@@ -149,6 +149,7 @@ NewBitmapCursor(Cursor *cp, char *source, char *mask)
int sx, sy, mx, my;
unsigned int sw, sh, mw, mh;
Pixmap spm, mpm;
+ unsigned udummy = 0;
Window wdummy = None;
spm = GetBitmap(source);
@@ -160,8 +161,8 @@ NewBitmapCursor(Cursor *cp, char *source, char *mask)
/* make sure they are the same size */
- XGetGeometry(dpy, spm, &wdummy, &sx, &sy, &sw, &sh, &JunkBW, &JunkDepth);
- XGetGeometry(dpy, mpm, &wdummy, &mx, &my, &mw, &mh, &JunkBW, &JunkDepth);
+ XGetGeometry(dpy, spm, &wdummy, &sx, &sy, &sw, &sh, &udummy, &udummy);
+ XGetGeometry(dpy, mpm, &wdummy, &mx, &my, &mw, &mh, &udummy, &udummy);
if (sw != mw || sh != mh) {
twmWarning("cursor bitmaps \"%s\" and \"%s\" not the same size\n",
source, mask);
diff --git a/src/events.c b/src/events.c
index 3fd74d2..9b2daa9 100644
--- a/src/events.c
+++ b/src/events.c
@@ -736,6 +736,7 @@ HandlePropertyNotify(void)
XSetWindowAttributes attributes; /* attributes for create windows */
Pixmap pm;
int dummy = 0;
+ unsigned udummy = 0;
Window wdummy = None;
/* watch for standard colormap changes */
@@ -825,7 +826,7 @@ HandlePropertyNotify(void)
XGetGeometry(dpy, Tmp_win->icon_w, &wdummy,
&icon_x, &icon_y,
- &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth);
+ &udummy, &udummy, &udummy, &udummy);
XSelectInput(dpy, Tmp_win->icon_w, None);
XDeleteContext(dpy, Tmp_win->icon_w, TwmContext);
XDeleteContext(dpy, Tmp_win->icon_w, ScreenContext);
@@ -844,8 +845,8 @@ HandlePropertyNotify(void)
* window to where the old one is.
*/
if (XGetGeometry(dpy, Tmp_win->icon_w, &wdummy, &icon_x,
- &icon_y, &JunkWidth, &JunkHeight, &JunkBW,
- &JunkDepth)) {
+ &icon_y, &udummy, &udummy, &udummy,
+ &udummy)) {
/*
* Move the new icon window to where the old one was.
*/
@@ -904,8 +905,8 @@ HandlePropertyNotify(void)
if (!XGetGeometry(dpy, Tmp_win->wmhints->icon_pixmap, &wdummy,
&dummy, &dummy,
(unsigned int *) &Tmp_win->icon_width,
- (unsigned int *) &Tmp_win->icon_height, &JunkBW,
- &JunkDepth)) {
+ (unsigned int *) &Tmp_win->icon_height, &udummy,
+ &udummy)) {
return;
}
@@ -1019,6 +1020,7 @@ void
HandleClientMessage(void)
{
int dummy = 0;
+ unsigned udummy = 0;
Window wdummy = None;
if (Event.xclient.message_type == _XA_WM_CHANGE_STATE) {
@@ -1029,7 +1031,7 @@ HandleClientMessage(void)
XQueryPointer(dpy, Scr->Root, &wdummy, &wdummy,
&(button.xmotion.x_root),
&(button.xmotion.y_root),
- &dummy, &dummy, &JunkMask);
+ &dummy, &dummy, &udummy);
ExecuteFunction(F_ICONIFY, NULLSTR, Event.xany.window,
Tmp_win, &button, FRAME, FALSE);
@@ -1471,13 +1473,14 @@ void
HandleMotionNotify(void)
{
XPointer context_data;
+ unsigned udummy = 0;
Window wdummy = None;
if (ResizeWindow != (Window) 0) {
XQueryPointer(dpy, Event.xany.window,
&(Event.xmotion.root), &wdummy,
&(Event.xmotion.x_root), &(Event.xmotion.y_root),
- &(Event.xmotion.x), &(Event.xmotion.y), &JunkMask);
+ &(Event.xmotion.x), &(Event.xmotion.y), &udummy);
/* Set WindowMoved appropriately so that f.deltastop will
work with resize as well as move. */
diff --git a/src/icons.c b/src/icons.c
index 5b34245..39a2097 100644
--- a/src/icons.c
+++ b/src/icons.c
@@ -163,6 +163,7 @@ IconUp(TwmWindow *tmp_win)
int x, y;
int defx, defy;
struct IconRegion *ir;
+ unsigned udummy = 0;
Window wdummy = None;
/*
@@ -178,7 +179,7 @@ IconUp(TwmWindow *tmp_win)
unsigned height = 0;
if (!XGetGeometry(dpy, tmp_win->icon_w, &wdummy, &defx, &defy,
- &width, &height, &JunkBW, &JunkDepth))
+ &width, &height, &udummy, &udummy))
return;
x = defx + ((int) width) / 2;
@@ -321,6 +322,7 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y)
Pixmap pm = None; /* tmp pixmap variable */
int final_x, final_y;
int dummy = 0;
+ unsigned udummy = 0;
Window wdummy = None;
FB(tmp_win->iconc.fore, tmp_win->iconc.back);
@@ -354,8 +356,8 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y)
if (bm != None) {
XGetGeometry(dpy, bm, &wdummy, &dummy, &dummy,
(unsigned int *) &tmp_win->icon_width,
- (unsigned int *) &tmp_win->icon_height, &JunkBW,
- &JunkDepth);
+ (unsigned int *) &tmp_win->icon_height, &udummy,
+ &udummy);
pm = XCreatePixmap(dpy, Scr->Root, (unsigned) tmp_win->icon_width,
(unsigned) tmp_win->icon_height,
@@ -380,8 +382,8 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y)
XGetGeometry(dpy, tmp_win->wmhints->icon_pixmap,
&wdummy, &dummy, &dummy,
(unsigned int *) &tmp_win->icon_width,
- (unsigned int *) &tmp_win->icon_height, &JunkBW,
- &JunkDepth);
+ (unsigned int *) &tmp_win->icon_height, &udummy,
+ &udummy);
pm = XCreatePixmap(dpy, Scr->Root,
(unsigned) tmp_win->icon_width,
@@ -418,8 +420,8 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y)
if (bm != None) {
XGetGeometry(dpy, bm, &wdummy, &dummy, &dummy,
(unsigned int *) &tmp_win->icon_width,
- (unsigned int *) &tmp_win->icon_height, &JunkBW,
- &JunkDepth);
+ (unsigned int *) &tmp_win->icon_height, &udummy,
+ &udummy);
pm = XCreatePixmap(dpy, Scr->Root, (unsigned) tmp_win->icon_width,
(unsigned) tmp_win->icon_height,
@@ -480,8 +482,8 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y)
if (tmp_win->forced ||
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) {
+ (unsigned int *) &tmp_win->icon_w_height, &udummy,
+ &udummy) == 0) {
tmp_win->icon_w = None;
tmp_win->wmhints->flags &= ~IconWindowHint;
}
diff --git a/src/menus.c b/src/menus.c
index 528fb54..5450363 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -469,6 +469,7 @@ UpdateMenu(void)
int done;
MenuItem *badItem = NULL;
XPointer context_data;
+ unsigned udummy = 0;
Window wdummy = None;
fromMenu = TRUE;
@@ -508,7 +509,7 @@ UpdateMenu(void)
done = FALSE;
XQueryPointer(dpy, ActiveMenu->w, &wdummy, &wdummy,
- &x_root, &y_root, &x, &y, &JunkMask);
+ &x_root, &y_root, &x, &y, &udummy);
/* if we haven't received the enter notify yet, wait */
if (!ActiveMenu->entered)
@@ -1121,6 +1122,7 @@ resizeFromCenter(Window w, TwmWindow *tmp_win)
int lastx, lasty, bw2;
XEvent event;
int dummy = 0;
+ unsigned udummy = 0;
Window wdummy = None;
bw2 = tmp_win->frame_bw * 2;
@@ -1128,10 +1130,10 @@ resizeFromCenter(Window w, TwmWindow *tmp_win)
AddingH = tmp_win->attr.height + tmp_win->title_height + bw2;
XGetGeometry(dpy, w, &wdummy, &origDragX, &origDragY,
(unsigned int *) &DragWidth, (unsigned int *) &DragHeight,
- &JunkBW, &JunkDepth);
+ &udummy, &udummy);
XWarpPointer(dpy, None, w, 0, 0, 0, 0, DragWidth / 2, DragHeight / 2);
XQueryPointer(dpy, Scr->Root, &wdummy,
- &wdummy, &dummy, &dummy, &AddingX, &AddingY, &JunkMask);
+ &wdummy, &dummy, &dummy, &AddingX, &AddingY, &udummy);
lastx = -10000;
lasty = -10000;
MenuStartResize(tmp_win, origDragX, origDragY, DragWidth, DragHeight);
@@ -1165,7 +1167,7 @@ resizeFromCenter(Window w, TwmWindow *tmp_win)
* grab the server.
*/
XQueryPointer(dpy, Scr->Root, &wdummy, &wdummy,
- &dummy, &dummy, &AddingX, &AddingY, &JunkMask);
+ &dummy, &dummy, &AddingX, &AddingY, &udummy);
if (lastx != AddingX || lasty != AddingY) {
MenuDoResize(AddingX, AddingY, tmp_win);
@@ -1222,6 +1224,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
Bool fromtitlebar = False;
unsigned bw = 0;
int dummy = 0;
+ unsigned udummy = 0;
Window wdummy = None;
RootFunction = 0;
@@ -1485,7 +1488,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
XGetGeometry(dpy, w, &wdummy, &origDragX, &origDragY,
(unsigned int *) &DragWidth, (unsigned int *) &DragHeight,
- &bw, &JunkDepth);
+ &bw, &udummy);
origX = eventp->xbutton.x_root;
origY = eventp->xbutton.y_root;
@@ -1519,7 +1522,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,
- &dummy, &dummy, &DragX, &DragY, &JunkMask);
+ &dummy, &dummy, &DragX, &DragY, &udummy);
}
last_time = eventp->xbutton.time;
@@ -1635,7 +1638,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),
- &dummy, &dummy, &JunkMask);
+ &dummy, &dummy, &udummy);
if (DragWindow == None &&
abs(eventp->xmotion.x_root - origX) < Scr->MoveDelta &&
@@ -1660,7 +1663,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
ConstMoveDir = MOVE_VERT;
XQueryPointer(dpy, DragWindow, &wdummy, &wdummy,
- &dummy, &dummy, &DragX, &DragY, &JunkMask);
+ &dummy, &dummy, &DragX, &DragY, &udummy);
break;
case MOVE_VERT:
diff --git a/src/session.c b/src/session.c
index ce601ac..f2b2a6b 100644
--- a/src/session.c
+++ b/src/session.c
@@ -275,6 +275,7 @@ WriteWinConfigEntry(FILE *configFile, TwmWindow *theWindow,
{
char **wm_command;
int wm_command_count;
+ unsigned udummy = 0;
if (!write_counted_string(configFile, clientId))
return 0;
@@ -333,7 +334,7 @@ WriteWinConfigEntry(FILE *configFile, TwmWindow *theWindow,
Window wdummy = None;
XGetGeometry(dpy, theWindow->icon_w, &wdummy, &icon_x,
- &icon_y, &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth);
+ &icon_y, &udummy, &udummy, &udummy, &udummy);
if (!write_short(configFile, (short) icon_x))
return 0;
diff --git a/src/twm.c b/src/twm.c
index 86c27e3..564eeb0 100644
--- a/src/twm.c
+++ b/src/twm.c
@@ -138,8 +138,6 @@ int ParseError; /* error parsing the .twmrc file */
int HandlingEvents = FALSE; /* are we handling events yet? */
-unsigned int JunkWidth, JunkHeight, JunkBW, JunkDepth, JunkMask;
-
char *ProgramName;
int Argc;
char **Argv;
@@ -816,10 +814,11 @@ RestoreWithdrawnLocation(TwmWindow *tmp)
int gravx, gravy;
unsigned int bw;
XWindowChanges xwc;
+ unsigned udummy = 0;
Window wdummy = None;
if (XGetGeometry(dpy, tmp->w, &wdummy, &xwc.x, &xwc.y,
- &JunkWidth, &JunkHeight, &bw, &JunkDepth)) {
+ &udummy, &udummy, &bw, &udummy)) {
unsigned mask;
GetGravityOffsets(tmp, &gravx, &gravy);
diff --git a/src/twm.h b/src/twm.h
index 70992a9..ed179aa 100644
--- a/src/twm.h
+++ b/src/twm.h
@@ -372,7 +372,6 @@ extern int ParseError;
extern int HandlingEvents;
-extern unsigned int JunkWidth, JunkHeight, JunkBW, JunkDepth, JunkMask;
extern XGCValues Gcv;
extern int InfoLines;
extern char Info[][INFO_SIZE];
diff --git a/src/util.c b/src/util.c
index edf93a9..a3673e3 100644
--- a/src/util.c
+++ b/src/util.c
@@ -209,6 +209,7 @@ Zoom(Window wf, Window wt)
long dx, dy, dw, dh;
long z;
int j;
+ unsigned udummy = 0;
Window wdummy = None;
if (!Scr->DoZoom || Scr->ZoomCount < 1)
@@ -217,8 +218,8 @@ Zoom(Window wf, Window wt)
if (wf == None || wt == None)
return;
- XGetGeometry(dpy, wf, &wdummy, &fx, &fy, &fw, &fh, &JunkBW, &JunkDepth);
- XGetGeometry(dpy, wt, &wdummy, &tx, &ty, &tw, &th, &JunkBW, &JunkDepth);
+ XGetGeometry(dpy, wf, &wdummy, &fx, &fy, &fw, &fh, &udummy, &udummy);
+ XGetGeometry(dpy, wt, &wdummy, &tx, &ty, &tw, &th, &udummy, &udummy);
dx = ((long) (tx - fx)); /* going from -> to */
dy = ((long) (ty - fy)); /* going from -> to */
@@ -280,12 +281,13 @@ void
GetUnknownIcon(const char *name)
{
int dummy = 0;
+ unsigned udummy = 0;
Window wdummy = None;
if ((Scr->UnknownPm = GetBitmap(name)) != None) {
XGetGeometry(dpy, Scr->UnknownPm, &wdummy, &dummy, &dummy,
(unsigned int *) &Scr->UnknownWidth,
- (unsigned int *) &Scr->UnknownHeight, &JunkBW, &JunkDepth);
+ (unsigned int *) &Scr->UnknownHeight, &udummy, &udummy);
}
}
@@ -379,7 +381,9 @@ FindBitmap(const char *name, unsigned *widthp, unsigned *heightp)
Pixmap
GetBitmap(const char *name)
{
- return FindBitmap(name, &JunkWidth, &JunkHeight);
+ unsigned udummy = 0;
+
+ return FindBitmap(name, &udummy, &udummy);
}
void