diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | config.h | 8 | ||||
-rw-r--r-- | mcwm.c | 53 |
3 files changed, 36 insertions, 27 deletions
@@ -1,4 +1,4 @@ -VERSION=20180725 +VERSION=20231107 DIST=mcwm-$(VERSION) SRC=mcwm.c list.c config.h events.h list.h hidden.c DISTFILES=LICENSE Makefile NEWS README TODO WISHLIST mcwm.man hidden.man scripts $(SRC) @@ -35,10 +35,16 @@ /* * Do we allow windows to be iconified? Set to true if you want this * behaviour to be default. Can also be set by calling mcwm with -i. - */ + */ #define ALLOWICONS false /* + * Do we allow windows to be moved from outside of mcwm? Set to true if you + * want this behaviour to be default. Can also be set by calling mcwm with -m. + */ +#define ALLOWMOVE false + +/* * Start these programs when pressing MOUSEMODKEY and mouse buttons on * root window. */ @@ -285,6 +285,7 @@ struct conf uint32_t unfocuscol; /* Unfocused border colour. */ uint32_t fixedcol; /* Fixed windows border colour. */ bool allowicons; /* Allow windows to be unmapped. */ + bool allowmove; /* Obey move requests. */ } conf; xcb_atom_t atom_desktop; /* @@ -3440,37 +3441,34 @@ void configurerequest(xcb_configure_request_event_t *e) mon_height = client->monitor->height; } -#if 0 - /* - * We ignore moves the user haven't initiated, that is do - * nothing on XCB_CONFIG_WINDOW_X and XCB_CONFIG_WINDOW_Y - * ConfigureRequests. - * - * Code here if we ever change our minds or if you, dear user, - * wants this functionality. - */ + if (conf.allowmove) { + /* + * Only act on move request the user haven't initiated, in case + * explicitly opted in. I.e. do nothing on XCB_CONFIG_WINDOW_X and + * XCB_CONFIG_WINDOW_Y ConfigureRequests by default. + */ - if (e->value_mask & XCB_CONFIG_WINDOW_X) - { - /* Don't move window if maximized. Don't move off the screen. */ - if (!client->maxed && e->x > 0) + if (e->value_mask & XCB_CONFIG_WINDOW_X) { - client->x = e->x; + /* Don't move window if maximized. Don't move off the screen. */ + if (!client->maxed && e->x >= 0) + { + client->x = e->x; + } } - } - if (e->value_mask & XCB_CONFIG_WINDOW_Y) - { - /* - * Don't move window if maximized. Don't move off the - * screen. - */ - if (!client->maxed && !client->vertmaxed && e->y > 0) + if (e->value_mask & XCB_CONFIG_WINDOW_Y) { - client->y = e->y; + /* + * Don't move window if maximized. Don't move off the + * screen. + */ + if (!client->maxed && !client->vertmaxed && e->y >= 0) + { + client->y = e->y; + } } } -#endif if (e->value_mask & XCB_CONFIG_WINDOW_WIDTH) { @@ -4345,13 +4343,14 @@ int main(int argc, char **argv) conf.snapmargin = SNAPMARGIN; conf.terminal = TERMINAL; conf.allowicons = ALLOWICONS; + conf.allowmove = ALLOWMOVE; focuscol = FOCUSCOL; unfocuscol = UNFOCUSCOL; fixedcol = FIXEDCOL; while (1) { - ch = getopt(argc, argv, "b:s:it:f:u:x:"); + ch = getopt(argc, argv, "b:s:imt:f:u:x:"); if (-1 == ch) { @@ -4375,6 +4374,10 @@ int main(int argc, char **argv) conf.allowicons = true; break; + case 'm': + conf.allowmove = true; + break; + case 't': conf.terminal = optarg; break; |