mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
output: handle outputs that are enabled but not yet added
output_config_apply() currently assumes that any enabled outputs have already been added to the wlr_output_layout. However, at startup, wlroots will report that outputs are enabled if they were previously in use by e.g. the Linux console - but they are not yet in the layout. output_config_apply() never encountered this case before now because the initial modeset was performed by another code path, but now with the new autoEnableOutputs option (next commit), it needs to be able to handle the initial modeset as well.
This commit is contained in:
parent
03be489eb9
commit
49eeee387b
1 changed files with 12 additions and 9 deletions
21
src/output.c
21
src/output.c
|
|
@ -565,8 +565,6 @@ output_config_apply(struct server *server,
|
|||
struct output *output = output_from_wlr_output(server, o);
|
||||
struct wlr_output_state *os = &output->pending;
|
||||
bool output_enabled = head->state.enabled && !output->leased;
|
||||
bool need_to_add = output_enabled && !o->enabled;
|
||||
bool need_to_remove = !output_enabled && o->enabled;
|
||||
|
||||
wlr_output_state_set_enabled(os, output_enabled);
|
||||
if (output_enabled) {
|
||||
|
|
@ -601,12 +599,19 @@ output_config_apply(struct server *server,
|
|||
break;
|
||||
}
|
||||
|
||||
/* Only do Layout specific actions if the commit went trough */
|
||||
if (need_to_add) {
|
||||
add_output_to_layout(server, output);
|
||||
}
|
||||
/*
|
||||
* Add or remove output from layout only if the commit went
|
||||
* through. Note that at startup, the output may have already
|
||||
* been enabled but not yet been added to the layout.
|
||||
*/
|
||||
bool was_in_layout =
|
||||
!!wlr_output_layout_get(server->output_layout, o);
|
||||
|
||||
if (output_enabled) {
|
||||
if (!was_in_layout) {
|
||||
add_output_to_layout(server, output);
|
||||
}
|
||||
|
||||
struct wlr_box pos = {0};
|
||||
wlr_output_layout_get_box(server->output_layout, o, &pos);
|
||||
if (pos.x != head->state.x || pos.y != head->state.y) {
|
||||
|
|
@ -618,9 +623,7 @@ output_config_apply(struct server *server,
|
|||
wlr_output_layout_add(server->output_layout, o,
|
||||
head->state.x, head->state.y);
|
||||
}
|
||||
}
|
||||
|
||||
if (need_to_remove) {
|
||||
} else if (was_in_layout) {
|
||||
regions_evacuate_output(output);
|
||||
|
||||
lab_cosmic_workspace_group_output_leave(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue