commit 7f560c0b678c2f4480f13ccf69001658d2dd8fc7
parent 6d76af998c00e9b945f7eb172a5b44f52fc01e78
Author: phillbush <phillbush@cock.li>
Date: Fri, 1 Oct 2021 20:21:38 -0300
ignore configure requests; add -c option
Diffstat:
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/shod.1 b/shod.1
@@ -4,6 +4,7 @@
\- mouse-focused window manager
.SH SYNOPSIS
.B shod
+.RB [ \-c ]
.RB [ \-D
.IR dockspec ]
.RB [ \-f
@@ -70,6 +71,24 @@ to control shod).
.PP
The options are as follows:
.TP
+.B \-c
+Honor configure requests.
+By default,
+.B shod
+ignore requests to configure a window size or position after the window is mapped.
+A client may request the window manager to reconfigure (ie', resize or replace) its own window.
+For example,
+.IR xterm (1)
+sends a configure request for the window manager to expand or shrink its window
+when the user changes its font size.
+Clients requesting to change its size may be annoying,
+so configure requests are ignored by defaul;
+but they can be honored by invoking
+.B shod
+with the
+.B \-c
+command-line option.
+.TP
.BI \-D " dockspec"
Specify the position and width of the dock.
If dockspec is
diff --git a/shod.c b/shod.c
@@ -510,13 +510,14 @@ static struct Visual visual;
static struct WM wm;
static struct Dock dock = {.pix = None, .win = None, .pos = DEF_DOCKPOS, .width = DEF_DOCKWIDTH, .space = DEF_DOCKSPACE};
static struct Config config;
+static int cflag = 0;
volatile sig_atomic_t running = 1;
/* show usage and exit */
static void
usage(void)
{
- (void)fprintf(stderr, "usage: shod [-D dockspec] [-f buttons] [-m modifier]\n");
+ (void)fprintf(stderr, "usage: shod [-c] [-D dockspec] [-f buttons] [-m modifier]\n");
(void)fprintf(stderr, " [-N notificationspec] [-n ndesks] [-r buttons]\n");
exit(1);
}
@@ -716,8 +717,11 @@ getoptions(int argc, char *argv[])
config.focusbuttons = FOCUS_BUTTONS;
config.raisebuttons = RAISE_BUTTONS;
- while ((c = getopt(argc, argv, "D:f:m:N:n:r:")) != -1) {
+ while ((c = getopt(argc, argv, "cD:f:m:N:n:r:")) != -1) {
switch (c) {
+ case 'c':
+ cflag = 1;
+ break;
case 'D':
parsedock(optarg);
break;
@@ -5326,7 +5330,11 @@ xeventconfigurerequest(XEvent *e)
if (res.d != NULL) {
dialogconfigure(res.d, ev->value_mask, &wc);
} else if (res.c != NULL) {
- containerconfigure(res.c, ev->value_mask, &wc);
+ if (cflag) {
+ containerconfigure(res.c, ev->value_mask, &wc);
+ } else {
+ containermoveresize(res.c);
+ }
} else if (res.c == NULL){
XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
}