aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-01-24 10:57:35 +0100
committerGitHub <noreply@github.com>2018-01-24 10:57:35 +0100
commit7a2e9a17bae919088f4265961ad8d00fece7b870 (patch)
tree7b86d3bc1ea84513a7c777677f38241efedc7283
parentc09c2dfbc4a33aed90bf4c033a2a75e8a0cecb64 (diff)
parentf946c10cb171644e915deeaa40b5e8f8344a808c (diff)
Merge pull request #579 from Ongy/dpms_decouple
decouples outputenable state and wl_output global
-rw-r--r--include/wlr/types/wlr_output.h2
-rw-r--r--types/wlr_output.c11
-rw-r--r--types/wlr_output_layout.c3
3 files changed, 7 insertions, 9 deletions
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index 71463cb5..55431ab1 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -89,6 +89,8 @@ struct wlr_output {
struct wlr_surface;
void wlr_output_enable(struct wlr_output *output, bool enable);
+void wlr_output_create_global(struct wlr_output *output);
+void wlr_output_destroy_global(struct wlr_output *output);
bool wlr_output_set_mode(struct wlr_output *output,
struct wlr_output_mode *mode);
bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,
diff --git a/types/wlr_output.c b/types/wlr_output.c
index b47fb3a0..426926ac 100644
--- a/types/wlr_output.c
+++ b/types/wlr_output.c
@@ -113,7 +113,7 @@ static void wl_output_bind(struct wl_client *wl_client, void *data,
wl_output_send_to_resource(wl_resource);
}
-static void wlr_output_create_global(struct wlr_output *output) {
+void wlr_output_create_global(struct wlr_output *output) {
if (output->wl_global != NULL) {
return;
}
@@ -122,7 +122,7 @@ static void wlr_output_create_global(struct wlr_output *output) {
output->wl_global = wl_global;
}
-static void wlr_output_destroy_global(struct wlr_output *output) {
+void wlr_output_destroy_global(struct wlr_output *output) {
if (output->wl_global == NULL) {
return;
}
@@ -140,13 +140,6 @@ void wlr_output_update_enabled(struct wlr_output *output, bool enabled) {
}
output->enabled = enabled;
-
- if (enabled) {
- wlr_output_create_global(output);
- } else {
- wlr_output_destroy_global(output);
- }
-
wl_signal_emit(&output->events.enable, output);
}
diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c
index d1d67e7d..b01fb840 100644
--- a/types/wlr_output_layout.c
+++ b/types/wlr_output_layout.c
@@ -203,6 +203,7 @@ void wlr_output_layout_add(struct wlr_output_layout *layout,
l_output->y = y;
l_output->state->auto_configured = false;
wlr_output_layout_reconfigure(layout);
+ wlr_output_create_global(output);
wl_signal_emit(&layout->events.add, l_output);
}
@@ -289,6 +290,7 @@ void wlr_output_layout_remove(struct wlr_output_layout *layout,
wlr_output_layout_output_destroy(l_output);
wlr_output_layout_reconfigure(layout);
}
+ wlr_output_destroy_global(output);
}
void wlr_output_layout_output_coords(struct wlr_output_layout *layout,
@@ -394,6 +396,7 @@ void wlr_output_layout_add_auto(struct wlr_output_layout *layout,
l_output->state->auto_configured = true;
wlr_output_layout_reconfigure(layout);
+ wlr_output_create_global(output);
wl_signal_emit(&layout->events.add, l_output);
}