diff options
author | Stivvo <stivvo01@gmail.com> | 2020-10-31 18:29:33 +0100 |
---|---|---|
committer | Stivvo <stivvo01@gmail.com> | 2020-10-31 18:29:33 +0100 |
commit | d9ab75721af57ad6b19cb167d7e762b5496a275b (patch) | |
tree | ee7290675d700a09725dbb0618ab5794fa31fd81 | |
parent | 80a685ee51da69ae0a7bae11620c5f33c3cd2de2 (diff) |
Don't switch to another disabled monitors
Since wlr_output_enable doesn't have any effect before finishing all the
procedure, a little hack allows to make use of focusmon(), which must
know the latest in about which output is currently disabled
Also improve performance in focusmon() and cleaner code in
outputmgrapplyortest()
-rw-r--r-- | dwl.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -1092,11 +1092,11 @@ void focusmon(const Arg *arg) { Client *sel; - do { - sel = selclient(); + do selmon = dirtomon(arg->i); - focusclient(sel, focustop(selmon), 1); - } while (!selmon->wlr_output->enabled); + while (!selmon->wlr_output->enabled); + sel = selclient(); + focusclient(sel, focustop(selmon), 1); } void @@ -1466,19 +1466,8 @@ outputmgrapplyortest(struct wlr_output_configuration_v1 *config, bool test) wl_list_for_each(config_head, &config->heads, link) { struct wlr_output *wlr_output = config_head->state.output; - Monitor *m; wlr_output_enable(wlr_output, config_head->state.enabled); - if (!config_head->state.enabled) { - wl_list_for_each(m, &mons, link) { - if (m->wlr_output->name == wlr_output->name) { - // focus the left monitor (relative to the current focus) - focusmon(&ar); - closemon(m); - } - } - } - if (config_head->state.enabled) { if (config_head->state.mode) wlr_output_set_mode(wlr_output, config_head->state.mode); @@ -1492,6 +1481,17 @@ outputmgrapplyortest(struct wlr_output_configuration_v1 *config, bool test) config_head->state.x, config_head->state.y); wlr_output_set_transform(wlr_output, config_head->state.transform); wlr_output_set_scale(wlr_output, config_head->state.scale); + } else { + Monitor *m; + wl_list_for_each(m, &mons, link) { + if (m->wlr_output->name == wlr_output->name) { + // focus the left monitor (relative to the current focus) + m->wlr_output->enabled = !m->wlr_output->enabled; + focusmon(&ar); + closemon(m); + m->wlr_output->enabled = !m->wlr_output->enabled; + } + } } if (test) { |