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()
This commit is contained in:
parent
80a685ee51
commit
d9ab75721a
1 changed files with 15 additions and 15 deletions
30
dwl.c
30
dwl.c
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue