aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-09-17 12:47:00 -0400
committerGitHub <noreply@github.com>2018-09-17 12:47:00 -0400
commit8b112730ca8f6abeb3f941dc578b3598878e5480 (patch)
tree0e759451da8ad18759c01361153fd7e0e4aa904b
parent83397e69992aa407e3eae559fb41a991f1a68752 (diff)
parent9f76263404dded6575b7aa0993a6282646b8e0ea (diff)
Merge pull request #1246 from emersion/output-layout-no-mode
output-layout: don't expose outputs without a mode
-rw-r--r--types/wlr_output_layout.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c
index e634d2b2..b51153ae 100644
--- a/types/wlr_output_layout.c
+++ b/types/wlr_output_layout.c
@@ -134,10 +134,20 @@ static void output_layout_reconfigure(struct wlr_output_layout *layout) {
wlr_signal_emit_safe(&layout->events.change, layout);
}
+static void output_update_global(struct wlr_output *output) {
+ // Don't expose the output if it doesn't have a current mode
+ if (wl_list_empty(&output->modes) || output->current_mode != NULL) {
+ wlr_output_create_global(output);
+ } else {
+ wlr_output_destroy_global(output);
+ }
+}
+
static void handle_output_mode(struct wl_listener *listener, void *data) {
struct wlr_output_layout_output_state *state =
wl_container_of(listener, state, mode);
output_layout_reconfigure(state->layout);
+ output_update_global(state->l_output->output);
}
static void handle_output_scale(struct wl_listener *listener, void *data) {
@@ -205,7 +215,7 @@ void wlr_output_layout_add(struct wlr_output_layout *layout,
l_output->y = ly;
l_output->state->auto_configured = false;
output_layout_reconfigure(layout);
- wlr_output_create_global(output);
+ output_update_global(output);
wlr_signal_emit_safe(&layout->events.add, l_output);
}
@@ -409,7 +419,7 @@ void wlr_output_layout_add_auto(struct wlr_output_layout *layout,
l_output->state->auto_configured = true;
output_layout_reconfigure(layout);
- wlr_output_create_global(output);
+ output_update_global(output);
wlr_signal_emit_safe(&layout->events.add, l_output);
}
@@ -437,7 +447,7 @@ enum distance_selection_method {
struct wlr_output *wlr_output_layout_output_in_direction(
struct wlr_output_layout *layout, enum wlr_direction direction,
- struct wlr_output *reference, double ref_lx, double ref_ly,
+ struct wlr_output *reference, double ref_lx, double ref_ly,
enum distance_selection_method distance_method) {
assert(reference);
@@ -490,14 +500,13 @@ struct wlr_output *wlr_output_layout_output_in_direction(
struct wlr_output *wlr_output_layout_adjacent_output(
struct wlr_output_layout *layout, enum wlr_direction direction,
struct wlr_output *reference, double ref_lx, double ref_ly) {
- return wlr_output_layout_output_in_direction(layout, direction,
+ return wlr_output_layout_output_in_direction(layout, direction,
reference, ref_lx, ref_ly, NEAREST);
}
struct wlr_output *wlr_output_layout_farthest_output(
struct wlr_output_layout *layout, enum wlr_direction direction,
struct wlr_output *reference, double ref_lx, double ref_ly) {
- return wlr_output_layout_output_in_direction(layout, direction,
+ return wlr_output_layout_output_in_direction(layout, direction,
reference, ref_lx, ref_ly, FARTHEST);
}
-