mirror of
https://github.com/swaywm/sway.git
synced 2026-04-23 06:46:27 -04:00
config/output: don't change output state before commit
Previously, we called output_disable prior to wlr_output_commit. This mutates Sway's output state before the output commit actually succeeds. This results in Sway's state getting out-of-sync with wlroots'. An alternative fix [1] was to revert the changes made by output_disable in case of failure. This is a little complicated. Instead, this patch makes it so Sway's internal state is never changed before a successful wlr_output commit. We had two output flags: enabled and configured. However enabled was set prior to the output becoming enabled, and was used to prevent the output event handlers (specifically, the mode handler) from calling apply_output_config again (infinite loop). Rename enabled to enabling and use it exclusively for this purpose. Rename configure to enabled, because that's what it really means. [1]: https://github.com/swaywm/sway/pull/5521 Closes: https://github.com/swaywm/sway/issues/5483
This commit is contained in:
parent
ea3ba203cc
commit
5432f00adf
5 changed files with 23 additions and 26 deletions
|
|
@ -844,7 +844,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
|
|||
|
||||
static void handle_mode(struct wl_listener *listener, void *data) {
|
||||
struct sway_output *output = wl_container_of(listener, output, mode);
|
||||
if (!output->configured && !output->enabled) {
|
||||
if (!output->enabled && !output->enabling) {
|
||||
struct output_config *oc = find_output_config(output);
|
||||
if (output->wlr_output->current_mode != NULL &&
|
||||
(!oc || oc->enabled)) {
|
||||
|
|
@ -857,7 +857,7 @@ static void handle_mode(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (!output->enabled || !output->configured) {
|
||||
if (!output->enabled) {
|
||||
return;
|
||||
}
|
||||
arrange_layers(output);
|
||||
|
|
@ -869,7 +869,7 @@ static void handle_mode(struct wl_listener *listener, void *data) {
|
|||
|
||||
static void handle_transform(struct wl_listener *listener, void *data) {
|
||||
struct sway_output *output = wl_container_of(listener, output, transform);
|
||||
if (!output->enabled || !output->configured) {
|
||||
if (!output->enabled) {
|
||||
return;
|
||||
}
|
||||
arrange_layers(output);
|
||||
|
|
@ -886,7 +886,7 @@ static void update_textures(struct sway_container *con, void *data) {
|
|||
|
||||
static void handle_scale(struct wl_listener *listener, void *data) {
|
||||
struct sway_output *output = wl_container_of(listener, output, scale);
|
||||
if (!output->enabled || !output->configured) {
|
||||
if (!output->enabled) {
|
||||
return;
|
||||
}
|
||||
arrange_layers(output);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue