summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@herrb.eu>2024-05-05 10:59:11 +0200
committerMatthieu Herrb <matthieu@herrb.eu>2024-05-05 10:59:11 +0200
commited85f3d22352c8e469ed1e386af3926b4d63efcd (patch)
tree2162ff552f17fdd9f6c6eba479fa1f2498f99d19 /src/util.c
parent1e866201f1ccf8fa3bb22c6f5fa723b26c86dbe1 (diff)
parent79b0987e63daff97ce9ee1dce883df13668a80c6 (diff)
Merge remote-tracking branch 'origin/master' into obsd
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/util.c b/src/util.c
index a6bf902..236458d 100644
--- a/src/util.c
+++ b/src/util.c
@@ -59,7 +59,7 @@ in this Software without prior written authorization from The Open Group.
#include "twm.h"
#include "util.h"
-#include "gram.h"
+#include "parse.h"
#include "screen.h"
#include <X11/Xos.h>
#include <X11/Xatom.h>
@@ -96,7 +96,7 @@ MoveOutline(Window root, int x, int y, int width, int height, int bw, int th)
int xl, xr, yt, yb, xinnerl, xinnerr, yinnert, yinnerb;
int xthird, ythird;
XSegment outline[18];
- register XSegment *r;
+ XSegment *r;
if (x == lastx && y == lasty && width == lastWidth && height == lastHeight
&& lastBW == bw && th == lastTH)
@@ -209,6 +209,8 @@ 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)
return;
@@ -216,8 +218,8 @@ Zoom(Window wf, Window wt)
if (wf == None || wt == None)
return;
- XGetGeometry(dpy, wf, &JunkRoot, &fx, &fy, &fw, &fh, &JunkBW, &JunkDepth);
- XGetGeometry(dpy, wt, &JunkRoot, &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 */
@@ -275,10 +277,14 @@ ExpandFilename(const char *name)
void
GetUnknownIcon(const char *name)
{
+ int dummy = 0;
+ unsigned udummy = 0;
+ Window wdummy = None;
+
if ((Scr->UnknownPm = GetBitmap(name)) != None) {
- XGetGeometry(dpy, Scr->UnknownPm, &JunkRoot, &JunkX, &JunkY,
+ XGetGeometry(dpy, Scr->UnknownPm, &wdummy, &dummy, &dummy,
(unsigned int *) &Scr->UnknownWidth,
- (unsigned int *) &Scr->UnknownHeight, &JunkBW, &JunkDepth);
+ (unsigned int *) &Scr->UnknownHeight, &udummy, &udummy);
}
}
@@ -371,7 +377,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
@@ -387,7 +395,7 @@ InsertRGBColormap(Atom a, XStandardColormap *maps, int nmaps, Bool replace)
}
if (!sc) { /* no existing, allocate new */
- sc = malloc(sizeof(StdCmap));
+ sc = (StdCmap *) malloc(sizeof(StdCmap));
if (!sc) {
twmWarning("unable to allocate %lu bytes for StdCmap",
(unsigned long) sizeof(StdCmap));
@@ -474,10 +482,8 @@ GetColor(int kind, Pixel *what, const char *name)
Status stat = 0;
Colormap cmap = Scr->TwmRoot.cmaps.cwins[0]->colormap->c;
-#ifndef TOM
if (!Scr->FirstTime)
return;
-#endif
if (Scr->Monochrome != kind)
return;
@@ -549,10 +555,8 @@ GetColorValue(int kind, XColor *what, const char *name)
XColor junkcolor;
Colormap cmap = Scr->TwmRoot.cmaps.cwins[0]->colormap->c;
-#ifndef TOM
if (!Scr->FirstTime)
return;
-#endif
if (Scr->Monochrome != kind)
return;
@@ -579,7 +583,7 @@ FindFontSet(MyFont *font, const char *fontname)
int ascent;
int descent;
int fnum;
- register int i;
+ int i;
if (font->fontset != NULL) {
XFreeFontSet(dpy, font->fontset);
@@ -911,11 +915,11 @@ CreateDotPixmap(unsigned *widthp, unsigned *heightp)
if (!(h & 1))
h--;
*widthp = *heightp = (unsigned int) h;
- if (Scr->tbpm.delete == None) {
+ if (Scr->tbpm.remove == None) {
GC gc;
Pixmap pix;
- pix = Scr->tbpm.delete =
+ pix = Scr->tbpm.remove =
XCreatePixmap(dpy, Scr->Root, (unsigned) h, (unsigned) h, 1);
gc = XCreateGC(dpy, pix, 0L, NULL);
XSetLineAttributes(dpy, gc, (unsigned) h, LineSolid, CapRound,
@@ -926,7 +930,7 @@ CreateDotPixmap(unsigned *widthp, unsigned *heightp)
XDrawLine(dpy, pix, gc, h / 2, h / 2, h / 2, h / 2);
XFreeGC(dpy, gc);
}
- return Scr->tbpm.delete;
+ return Scr->tbpm.remove;
}
#define questionmark_width 8