From: Mark Wooding Date: Sun, 24 Apr 2022 11:13:24 +0000 (+0100) Subject: xatom.c: Switch `display' and `dpy' variables around. X-Git-Url: https://git.distorted.org.uk/~mdw/xtoys/commitdiff_plain/166194b0dbdb052c826c97987a1a037f4143c7aa xatom.c: Switch `display' and `dpy' variables around. This is consistent with the other programs. --- diff --git a/xatom.c b/xatom.c index e030021..283c7c1 100644 --- a/xatom.c +++ b/xatom.c @@ -48,7 +48,7 @@ /*----- Static variables --------------------------------------------------*/ -static Display *display = 0; +static Display *dpy = 0; static Window window = None; /*----- Command implementations -------------------------------------------*/ @@ -64,10 +64,10 @@ static int c_get(int argc, char **argv) if (argc != 2) die(EXIT_FAILURE, "Usage: get PROPERTY"); - if ((p = XInternAtom(display, argv[1], True)) == None || - (a = xatom_get(display, window, p)) == None) + if ((p = XInternAtom(dpy, argv[1], True)) == None || + (a = xatom_get(dpy, window, p)) == None) return (0); - name = XGetAtomName(display, a); + name = XGetAtomName(dpy, a); puts(name); return (0); } @@ -78,9 +78,9 @@ static int c_set(int argc, char **argv) if (argc != 3) die(EXIT_FAILURE, "Usage: set PROPERTY VALUE"); - p = XInternAtom(display, argv[1], False); - a = XInternAtom(display, argv[2], False); - xatom_set(display, window, p, a); + p = XInternAtom(dpy, argv[1], False); + a = XInternAtom(dpy, argv[2], False); + xatom_set(dpy, window, p, a); return (0); } @@ -90,9 +90,9 @@ static int c_delete(int argc, char **argv) if (argc != 2) die(EXIT_FAILURE, "Usage: delete PROPERTY"); - if ((p = XInternAtom(display, argv[1], True)) == None) + if ((p = XInternAtom(dpy, argv[1], True)) == None) return (0); - xatom_delete(display, window, p); + xatom_delete(dpy, window, p); return (0); } @@ -105,16 +105,16 @@ static int c_wait(int argc, char **argv) if (argc < 2) die(EXIT_FAILURE, "Usage: wait PROPERTY [VALUE...]"); - p = XInternAtom(display, argv[1], False); + p = XInternAtom(dpy, argv[1], False); n = argc - 2; if (n) { aa = xmalloc(n * sizeof(Atom)); - XInternAtoms(display, argv + 2, n, False, aa); + XInternAtoms(dpy, argv + 2, n, False, aa); } - a = xatom_wait(display, window, p, aa, n); + a = xatom_wait(dpy, window, p, aa, n); if (n != 1) { - name = XGetAtomName(display, a); + name = XGetAtomName(dpy, a); puts(name); XFree(name); } @@ -136,11 +136,11 @@ static int c_wait(int argc, char **argv) static Window choosewindow(void) { - Cursor cross = XCreateFontCursor(display, XC_crosshair); + Cursor cross = XCreateFontCursor(dpy, XC_crosshair); XEvent event; - XGrabPointer(display, - DefaultRootWindow(display), + XGrabPointer(dpy, + DefaultRootWindow(dpy), False, ButtonPressMask, GrabModeAsync, @@ -150,19 +150,19 @@ static Window choosewindow(void) CurrentTime); for (;;) { - XNextEvent(display, &event); + XNextEvent(dpy, &event); switch (event.type) { case ButtonPress: switch (event.xbutton.button) { case 3: - XUngrabPointer(display, event.xbutton.time); + XUngrabPointer(dpy, event.xbutton.time); die(EXIT_FAILURE, "aborted window selection"); break; case 1: window = event.xbutton.subwindow; if (window == None) window = event.xbutton.window; - XUngrabPointer(display, event.xbutton.time); + XUngrabPointer(dpy, event.xbutton.time); return (window); } break; @@ -296,7 +296,7 @@ The following subcommands are understood:\n\n", int main(int argc, char *argv[]) { - const char *dpy = 0; + const char *display = 0; const char *win = 0; unsigned f = 0; @@ -322,7 +322,7 @@ int main(int argc, char *argv[]) case 'h': help(argv + optind); exit(0); case 'u': usage(stdout); exit(0); case 'v': version(); exit(0); - case 'd': dpy = optarg; break; + case 'd': display = optarg; break; case 'w': win = optarg; break; default: f |= F_BOGUS; break; } @@ -335,13 +335,13 @@ int main(int argc, char *argv[]) /* --- Initialize --- */ autoreap(); - if ((display = XOpenDisplay(dpy)) == 0) + if ((dpy = XOpenDisplay(display)) == 0) die(EXIT_FAILURE, "couldn't open display"); /* --- Select a target window --- */ if (!win) - window = DefaultRootWindow(display); + window = DefaultRootWindow(dpy); else if (strcmp(win, "choose") == 0) window = choosewindow(); else