aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
Diffstat (limited to 'sway')
-rw-r--r--sway/config/output.c26
-rw-r--r--sway/desktop/output.c8
-rw-r--r--sway/input/cursor.c4
-rw-r--r--sway/tree/output.c7
4 files changed, 21 insertions, 24 deletions
diff --git a/sway/config/output.c b/sway/config/output.c
index 68aafbe1..b59cabd4 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -397,17 +397,8 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
struct wlr_output *wlr_output = output->wlr_output;
- bool was_enabled = output->enabled;
- if (oc && !oc->enabled) {
- // Output is configured to be disabled
- sway_log(SWAY_DEBUG, "Disabling output %s", oc->name);
- if (output->enabled) {
- output_disable(output);
- wlr_output_layout_remove(root->output_layout, wlr_output);
- }
- } else {
- output->enabled = true;
- }
+ // Flag to prevent the output mode event handler from calling us
+ output->enabling = (!oc || oc->enabled);
queue_output_config(oc, output);
@@ -421,11 +412,18 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
// Leave the output disabled for now and try again when the output gets
// the mode we asked for.
sway_log(SWAY_ERROR, "Failed to commit output %s", wlr_output->name);
- output->enabled = was_enabled;
+ output->enabling = false;
return false;
}
+ output->enabling = false;
+
if (oc && !oc->enabled) {
+ sway_log(SWAY_DEBUG, "Disabling output %s", oc->name);
+ if (output->enabled) {
+ output_disable(output);
+ wlr_output_layout_remove(root->output_layout, wlr_output);
+ }
return true;
}
@@ -468,8 +466,8 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
output->width = output_box->width;
output->height = output_box->height;
- if (!output->configured) {
- output_configure(output);
+ if (!output->enabled) {
+ output_enable(output);
}
if (oc && oc->max_render_time >= 0) {
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 4a51b5cc..5fdaba68 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -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);
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index d10ba444..0d5b076b 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -99,8 +99,8 @@ struct sway_node *node_at_coords(
return NULL;
}
struct sway_output *output = wlr_output->data;
- if (!output || !output->configured) {
- // output is being destroyed or is being configured
+ if (!output || !output->enabled) {
+ // output is being destroyed or is being enabled
return NULL;
}
double ox = lx, oy = ly;
diff --git a/sway/tree/output.c b/sway/tree/output.c
index 9a10c6a8..ae3c3abf 100644
--- a/sway/tree/output.c
+++ b/sway/tree/output.c
@@ -110,12 +110,12 @@ struct sway_output *output_create(struct wlr_output *wlr_output) {
return output;
}
-void output_configure(struct sway_output *output) {
- if (!sway_assert(!output->configured, "output is already configured")) {
+void output_enable(struct sway_output *output) {
+ if (!sway_assert(!output->enabled, "output is already enabled")) {
return;
}
struct wlr_output *wlr_output = output->wlr_output;
- output->configured = true;
+ output->enabled = true;
list_add(root->outputs, output);
restore_workspaces(output);
@@ -262,7 +262,6 @@ void output_disable(struct sway_output *output) {
list_del(root->outputs, index);
output->enabled = false;
- output->configured = false;
output->current_mode = NULL;
arrange_root();