summaryrefslogtreecommitdiff
path: root/mcwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'mcwm.c')
-rw-r--r--mcwm.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/mcwm.c b/mcwm.c
index 4cd773f..98b3963 100644
--- a/mcwm.c
+++ b/mcwm.c
@@ -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;