-
-
Save ortango/bd104ecf29506379e250e001374b9bc5 to your computer and use it in GitHub Desktop.
maybe a simple fix?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/messages.c b/src/messages.c | |
index c3a4201..9f28a48 100644 | |
--- a/src/messages.c | |
+++ b/src/messages.c | |
@@ -949,6 +949,7 @@ void cmd_monitor(char **args, int num, FILE *rsp) | |
xcb_rectangle_t r; if (parse_rectangle(*args, &r)) { | |
update_root(trg.monitor, &r); | |
+ reorder_monitor(trg.monitor); | |
} else { | |
fail(rsp, "monitor %s: Invalid argument: '%s'.\n", *(args - 1), *args); | |
return; | |
diff --git a/src/monitor.c b/src/monitor.c | |
index 4b248bc..d8bd612 100644 | |
--- a/src/monitor.c | |
+++ b/src/monitor.c | |
@@ -67,7 +67,9 @@ void update_root(monitor_t *m, xcb_rectangle_t *rect) | |
{ | |
xcb_rectangle_t last_rect = m->rectangle; | |
m->rectangle = *rect; | |
+ bool is_new_monitor = false; | |
if (m->root == XCB_NONE) { | |
+ is_new_monitor = true; | |
uint32_t values[] = {XCB_EVENT_MASK_ENTER_WINDOW}; | |
m->root = xcb_generate_id(dpy); | |
xcb_create_window(dpy, XCB_COPY_FROM_PARENT, m->root, root, | |
@@ -93,7 +95,9 @@ void update_root(monitor_t *m, xcb_rectangle_t *rect) | |
} | |
arrange(m, d); | |
} | |
- reorder_monitor(m); | |
+ if (is_new_monitor) { | |
+ reorder_monitor(m); | |
+ } | |
} | |
void reorder_monitor(monitor_t *m) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment