From a332db862aebfa2f3c18240b6334fe63993c8140 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Wed, 27 May 2015 17:33:23 -0500 Subject: [PATCH] wmgeneral: Add support for X geometry strings to -geometry option. In particular, we can specify the offsets from the right and bottom of the screen using '-', e.g., '-geometry -64-64' places the dockapp in the lower right corner of the screen. --- wmSMPmon/wmgeneral/wmgeneral.c | 16 ++-------------- wmckgmail/wmgeneral/wmgeneral.c | 16 ++-------------- wmcpufreq/wmgeneral/wmgeneral.c | 16 ++-------------- wmfsm/wmgeneral/wmgeneral.c | 16 ++-------------- wmifs/wmgeneral/wmgeneral.c | 16 ++-------------- wmitime/wmgeneral/wmgeneral.c | 16 ++-------------- wmkeys/wmgeneral/wmgeneral.c | 16 ++-------------- wmmon/wmgeneral/wmgeneral.c | 16 ++-------------- wmppp.app/wmgeneral/wmgeneral.c | 16 ++-------------- wmsm.app/wmgeneral/wmgeneral.c | 16 ++-------------- wmtime/wmgeneral/wmgeneral.c | 16 ++-------------- wmtz/wmgeneral/wmgeneral.c | 16 ++-------------- 12 files changed, 24 insertions(+), 168 deletions(-) diff --git a/wmSMPmon/wmgeneral/wmgeneral.c b/wmSMPmon/wmgeneral/wmgeneral.c index 91635ac..f707e7f 100644 --- a/wmSMPmon/wmgeneral/wmgeneral.c +++ b/wmSMPmon/wmgeneral/wmgeneral.c @@ -81,7 +81,6 @@ int d_depth; XSizeHints mysizehints; XWMHints mywmhints; Pixel back_pix, fore_pix; -char *Geometry = ""; Window iconwin, win; GC NormalGC; XpmIcon wmgen; @@ -406,7 +405,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit char *geometry = NULL; int dummy=0; - int i, wx, wy; + int i; for (i=1; argv[i]; i++) { if (!strcmp(argv[i], "-display")) @@ -436,11 +435,8 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit back_pix = GetColor("white"); fore_pix = GetColor("black"); - XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints, + XWMGeometry(display, screen, geometry, NULL, borderwidth, &mysizehints, &mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy); - if (geometry) - XParseGeometry(geometry, &mysizehints.x, &mysizehints.y, - (unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height); mysizehints.width = 64; mysizehints.height = 64; @@ -495,12 +491,4 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit XSetCommand(display, win, argv, argc); XMapWindow(display, win); - - if (geometry) { - if (sscanf(geometry, "+%10d+%10d", &wx, &wy) != 2) { - fprintf(stderr, "Bad geometry string.\n"); - exit(1); - } - XMoveWindow(display, win, wx, wy); - } } diff --git a/wmckgmail/wmgeneral/wmgeneral.c b/wmckgmail/wmgeneral/wmgeneral.c index 91635ac..f707e7f 100644 --- a/wmckgmail/wmgeneral/wmgeneral.c +++ b/wmckgmail/wmgeneral/wmgeneral.c @@ -81,7 +81,6 @@ int d_depth; XSizeHints mysizehints; XWMHints mywmhints; Pixel back_pix, fore_pix; -char *Geometry = ""; Window iconwin, win; GC NormalGC; XpmIcon wmgen; @@ -406,7 +405,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit char *geometry = NULL; int dummy=0; - int i, wx, wy; + int i; for (i=1; argv[i]; i++) { if (!strcmp(argv[i], "-display")) @@ -436,11 +435,8 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit back_pix = GetColor("white"); fore_pix = GetColor("black"); - XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints, + XWMGeometry(display, screen, geometry, NULL, borderwidth, &mysizehints, &mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy); - if (geometry) - XParseGeometry(geometry, &mysizehints.x, &mysizehints.y, - (unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height); mysizehints.width = 64; mysizehints.height = 64; @@ -495,12 +491,4 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit XSetCommand(display, win, argv, argc); XMapWindow(display, win); - - if (geometry) { - if (sscanf(geometry, "+%10d+%10d", &wx, &wy) != 2) { - fprintf(stderr, "Bad geometry string.\n"); - exit(1); - } - XMoveWindow(display, win, wx, wy); - } } diff --git a/wmcpufreq/wmgeneral/wmgeneral.c b/wmcpufreq/wmgeneral/wmgeneral.c index 91635ac..f707e7f 100755 --- a/wmcpufreq/wmgeneral/wmgeneral.c +++ b/wmcpufreq/wmgeneral/wmgeneral.c @@ -81,7 +81,6 @@ int d_depth; XSizeHints mysizehints; XWMHints mywmhints; Pixel back_pix, fore_pix; -char *Geometry = ""; Window iconwin, win; GC NormalGC; XpmIcon wmgen; @@ -406,7 +405,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit char *geometry = NULL; int dummy=0; - int i, wx, wy; + int i; for (i=1; argv[i]; i++) { if (!strcmp(argv[i], "-display")) @@ -436,11 +435,8 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit back_pix = GetColor("white"); fore_pix = GetColor("black"); - XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints, + XWMGeometry(display, screen, geometry, NULL, borderwidth, &mysizehints, &mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy); - if (geometry) - XParseGeometry(geometry, &mysizehints.x, &mysizehints.y, - (unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height); mysizehints.width = 64; mysizehints.height = 64; @@ -495,12 +491,4 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit XSetCommand(display, win, argv, argc); XMapWindow(display, win); - - if (geometry) { - if (sscanf(geometry, "+%10d+%10d", &wx, &wy) != 2) { - fprintf(stderr, "Bad geometry string.\n"); - exit(1); - } - XMoveWindow(display, win, wx, wy); - } } diff --git a/wmfsm/wmgeneral/wmgeneral.c b/wmfsm/wmgeneral/wmgeneral.c index 91635ac..f707e7f 100644 --- a/wmfsm/wmgeneral/wmgeneral.c +++ b/wmfsm/wmgeneral/wmgeneral.c @@ -81,7 +81,6 @@ int d_depth; XSizeHints mysizehints; XWMHints mywmhints; Pixel back_pix, fore_pix; -char *Geometry = ""; Window iconwin, win; GC NormalGC; XpmIcon wmgen; @@ -406,7 +405,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit char *geometry = NULL; int dummy=0; - int i, wx, wy; + int i; for (i=1; argv[i]; i++) { if (!strcmp(argv[i], "-display")) @@ -436,11 +435,8 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit back_pix = GetColor("white"); fore_pix = GetColor("black"); - XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints, + XWMGeometry(display, screen, geometry, NULL, borderwidth, &mysizehints, &mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy); - if (geometry) - XParseGeometry(geometry, &mysizehints.x, &mysizehints.y, - (unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height); mysizehints.width = 64; mysizehints.height = 64; @@ -495,12 +491,4 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit XSetCommand(display, win, argv, argc); XMapWindow(display, win); - - if (geometry) { - if (sscanf(geometry, "+%10d+%10d", &wx, &wy) != 2) { - fprintf(stderr, "Bad geometry string.\n"); - exit(1); - } - XMoveWindow(display, win, wx, wy); - } } diff --git a/wmifs/wmgeneral/wmgeneral.c b/wmifs/wmgeneral/wmgeneral.c index 91635ac..f707e7f 100644 --- a/wmifs/wmgeneral/wmgeneral.c +++ b/wmifs/wmgeneral/wmgeneral.c @@ -81,7 +81,6 @@ int d_depth; XSizeHints mysizehints; XWMHints mywmhints; Pixel back_pix, fore_pix; -char *Geometry = ""; Window iconwin, win; GC NormalGC; XpmIcon wmgen; @@ -406,7 +405,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit char *geometry = NULL; int dummy=0; - int i, wx, wy; + int i; for (i=1; argv[i]; i++) { if (!strcmp(argv[i], "-display")) @@ -436,11 +435,8 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit back_pix = GetColor("white"); fore_pix = GetColor("black"); - XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints, + XWMGeometry(display, screen, geometry, NULL, borderwidth, &mysizehints, &mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy); - if (geometry) - XParseGeometry(geometry, &mysizehints.x, &mysizehints.y, - (unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height); mysizehints.width = 64; mysizehints.height = 64; @@ -495,12 +491,4 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit XSetCommand(display, win, argv, argc); XMapWindow(display, win); - - if (geometry) { - if (sscanf(geometry, "+%10d+%10d", &wx, &wy) != 2) { - fprintf(stderr, "Bad geometry string.\n"); - exit(1); - } - XMoveWindow(display, win, wx, wy); - } } diff --git a/wmitime/wmgeneral/wmgeneral.c b/wmitime/wmgeneral/wmgeneral.c index 91635ac..f707e7f 100644 --- a/wmitime/wmgeneral/wmgeneral.c +++ b/wmitime/wmgeneral/wmgeneral.c @@ -81,7 +81,6 @@ int d_depth; XSizeHints mysizehints; XWMHints mywmhints; Pixel back_pix, fore_pix; -char *Geometry = ""; Window iconwin, win; GC NormalGC; XpmIcon wmgen; @@ -406,7 +405,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit char *geometry = NULL; int dummy=0; - int i, wx, wy; + int i; for (i=1; argv[i]; i++) { if (!strcmp(argv[i], "-display")) @@ -436,11 +435,8 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit back_pix = GetColor("white"); fore_pix = GetColor("black"); - XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints, + XWMGeometry(display, screen, geometry, NULL, borderwidth, &mysizehints, &mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy); - if (geometry) - XParseGeometry(geometry, &mysizehints.x, &mysizehints.y, - (unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height); mysizehints.width = 64; mysizehints.height = 64; @@ -495,12 +491,4 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit XSetCommand(display, win, argv, argc); XMapWindow(display, win); - - if (geometry) { - if (sscanf(geometry, "+%10d+%10d", &wx, &wy) != 2) { - fprintf(stderr, "Bad geometry string.\n"); - exit(1); - } - XMoveWindow(display, win, wx, wy); - } } diff --git a/wmkeys/wmgeneral/wmgeneral.c b/wmkeys/wmgeneral/wmgeneral.c index 91635ac..f707e7f 100644 --- a/wmkeys/wmgeneral/wmgeneral.c +++ b/wmkeys/wmgeneral/wmgeneral.c @@ -81,7 +81,6 @@ int d_depth; XSizeHints mysizehints; XWMHints mywmhints; Pixel back_pix, fore_pix; -char *Geometry = ""; Window iconwin, win; GC NormalGC; XpmIcon wmgen; @@ -406,7 +405,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit char *geometry = NULL; int dummy=0; - int i, wx, wy; + int i; for (i=1; argv[i]; i++) { if (!strcmp(argv[i], "-display")) @@ -436,11 +435,8 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit back_pix = GetColor("white"); fore_pix = GetColor("black"); - XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints, + XWMGeometry(display, screen, geometry, NULL, borderwidth, &mysizehints, &mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy); - if (geometry) - XParseGeometry(geometry, &mysizehints.x, &mysizehints.y, - (unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height); mysizehints.width = 64; mysizehints.height = 64; @@ -495,12 +491,4 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit XSetCommand(display, win, argv, argc); XMapWindow(display, win); - - if (geometry) { - if (sscanf(geometry, "+%10d+%10d", &wx, &wy) != 2) { - fprintf(stderr, "Bad geometry string.\n"); - exit(1); - } - XMoveWindow(display, win, wx, wy); - } } diff --git a/wmmon/wmgeneral/wmgeneral.c b/wmmon/wmgeneral/wmgeneral.c index 91635ac..f707e7f 100644 --- a/wmmon/wmgeneral/wmgeneral.c +++ b/wmmon/wmgeneral/wmgeneral.c @@ -81,7 +81,6 @@ int d_depth; XSizeHints mysizehints; XWMHints mywmhints; Pixel back_pix, fore_pix; -char *Geometry = ""; Window iconwin, win; GC NormalGC; XpmIcon wmgen; @@ -406,7 +405,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit char *geometry = NULL; int dummy=0; - int i, wx, wy; + int i; for (i=1; argv[i]; i++) { if (!strcmp(argv[i], "-display")) @@ -436,11 +435,8 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit back_pix = GetColor("white"); fore_pix = GetColor("black"); - XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints, + XWMGeometry(display, screen, geometry, NULL, borderwidth, &mysizehints, &mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy); - if (geometry) - XParseGeometry(geometry, &mysizehints.x, &mysizehints.y, - (unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height); mysizehints.width = 64; mysizehints.height = 64; @@ -495,12 +491,4 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit XSetCommand(display, win, argv, argc); XMapWindow(display, win); - - if (geometry) { - if (sscanf(geometry, "+%10d+%10d", &wx, &wy) != 2) { - fprintf(stderr, "Bad geometry string.\n"); - exit(1); - } - XMoveWindow(display, win, wx, wy); - } } diff --git a/wmppp.app/wmgeneral/wmgeneral.c b/wmppp.app/wmgeneral/wmgeneral.c index 91635ac..f707e7f 100644 --- a/wmppp.app/wmgeneral/wmgeneral.c +++ b/wmppp.app/wmgeneral/wmgeneral.c @@ -81,7 +81,6 @@ int d_depth; XSizeHints mysizehints; XWMHints mywmhints; Pixel back_pix, fore_pix; -char *Geometry = ""; Window iconwin, win; GC NormalGC; XpmIcon wmgen; @@ -406,7 +405,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit char *geometry = NULL; int dummy=0; - int i, wx, wy; + int i; for (i=1; argv[i]; i++) { if (!strcmp(argv[i], "-display")) @@ -436,11 +435,8 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit back_pix = GetColor("white"); fore_pix = GetColor("black"); - XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints, + XWMGeometry(display, screen, geometry, NULL, borderwidth, &mysizehints, &mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy); - if (geometry) - XParseGeometry(geometry, &mysizehints.x, &mysizehints.y, - (unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height); mysizehints.width = 64; mysizehints.height = 64; @@ -495,12 +491,4 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit XSetCommand(display, win, argv, argc); XMapWindow(display, win); - - if (geometry) { - if (sscanf(geometry, "+%10d+%10d", &wx, &wy) != 2) { - fprintf(stderr, "Bad geometry string.\n"); - exit(1); - } - XMoveWindow(display, win, wx, wy); - } } diff --git a/wmsm.app/wmgeneral/wmgeneral.c b/wmsm.app/wmgeneral/wmgeneral.c index 91635ac..f707e7f 100644 --- a/wmsm.app/wmgeneral/wmgeneral.c +++ b/wmsm.app/wmgeneral/wmgeneral.c @@ -81,7 +81,6 @@ int d_depth; XSizeHints mysizehints; XWMHints mywmhints; Pixel back_pix, fore_pix; -char *Geometry = ""; Window iconwin, win; GC NormalGC; XpmIcon wmgen; @@ -406,7 +405,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit char *geometry = NULL; int dummy=0; - int i, wx, wy; + int i; for (i=1; argv[i]; i++) { if (!strcmp(argv[i], "-display")) @@ -436,11 +435,8 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit back_pix = GetColor("white"); fore_pix = GetColor("black"); - XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints, + XWMGeometry(display, screen, geometry, NULL, borderwidth, &mysizehints, &mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy); - if (geometry) - XParseGeometry(geometry, &mysizehints.x, &mysizehints.y, - (unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height); mysizehints.width = 64; mysizehints.height = 64; @@ -495,12 +491,4 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit XSetCommand(display, win, argv, argc); XMapWindow(display, win); - - if (geometry) { - if (sscanf(geometry, "+%10d+%10d", &wx, &wy) != 2) { - fprintf(stderr, "Bad geometry string.\n"); - exit(1); - } - XMoveWindow(display, win, wx, wy); - } } diff --git a/wmtime/wmgeneral/wmgeneral.c b/wmtime/wmgeneral/wmgeneral.c index 91635ac..f707e7f 100644 --- a/wmtime/wmgeneral/wmgeneral.c +++ b/wmtime/wmgeneral/wmgeneral.c @@ -81,7 +81,6 @@ int d_depth; XSizeHints mysizehints; XWMHints mywmhints; Pixel back_pix, fore_pix; -char *Geometry = ""; Window iconwin, win; GC NormalGC; XpmIcon wmgen; @@ -406,7 +405,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit char *geometry = NULL; int dummy=0; - int i, wx, wy; + int i; for (i=1; argv[i]; i++) { if (!strcmp(argv[i], "-display")) @@ -436,11 +435,8 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit back_pix = GetColor("white"); fore_pix = GetColor("black"); - XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints, + XWMGeometry(display, screen, geometry, NULL, borderwidth, &mysizehints, &mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy); - if (geometry) - XParseGeometry(geometry, &mysizehints.x, &mysizehints.y, - (unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height); mysizehints.width = 64; mysizehints.height = 64; @@ -495,12 +491,4 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit XSetCommand(display, win, argv, argc); XMapWindow(display, win); - - if (geometry) { - if (sscanf(geometry, "+%10d+%10d", &wx, &wy) != 2) { - fprintf(stderr, "Bad geometry string.\n"); - exit(1); - } - XMoveWindow(display, win, wx, wy); - } } diff --git a/wmtz/wmgeneral/wmgeneral.c b/wmtz/wmgeneral/wmgeneral.c index 91635ac..f707e7f 100644 --- a/wmtz/wmgeneral/wmgeneral.c +++ b/wmtz/wmgeneral/wmgeneral.c @@ -81,7 +81,6 @@ int d_depth; XSizeHints mysizehints; XWMHints mywmhints; Pixel back_pix, fore_pix; -char *Geometry = ""; Window iconwin, win; GC NormalGC; XpmIcon wmgen; @@ -406,7 +405,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit char *geometry = NULL; int dummy=0; - int i, wx, wy; + int i; for (i=1; argv[i]; i++) { if (!strcmp(argv[i], "-display")) @@ -436,11 +435,8 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit back_pix = GetColor("white"); fore_pix = GetColor("black"); - XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints, + XWMGeometry(display, screen, geometry, NULL, borderwidth, &mysizehints, &mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy); - if (geometry) - XParseGeometry(geometry, &mysizehints.x, &mysizehints.y, - (unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height); mysizehints.width = 64; mysizehints.height = 64; @@ -495,12 +491,4 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit XSetCommand(display, win, argv, argc); XMapWindow(display, win); - - if (geometry) { - if (sscanf(geometry, "+%10d+%10d", &wx, &wy) != 2) { - fprintf(stderr, "Bad geometry string.\n"); - exit(1); - } - XMoveWindow(display, win, wx, wy); - } }