Merge pull request #579 from Ongy/dpms_decouple

decouples outputenable state and wl_output global
This commit is contained in:
emersion 2018-01-24 10:57:35 +01:00 committed by GitHub
commit 7a2e9a17ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 9 deletions

View File

@ -89,6 +89,8 @@ struct wlr_output {
struct wlr_surface; struct wlr_surface;
void wlr_output_enable(struct wlr_output *output, bool enable); 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, bool wlr_output_set_mode(struct wlr_output *output,
struct wlr_output_mode *mode); struct wlr_output_mode *mode);
bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width, bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,

View File

@ -113,7 +113,7 @@ static void wl_output_bind(struct wl_client *wl_client, void *data,
wl_output_send_to_resource(wl_resource); 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) { if (output->wl_global != NULL) {
return; return;
} }
@ -122,7 +122,7 @@ static void wlr_output_create_global(struct wlr_output *output) {
output->wl_global = wl_global; 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) { if (output->wl_global == NULL) {
return; return;
} }
@ -140,13 +140,6 @@ void wlr_output_update_enabled(struct wlr_output *output, bool enabled) {
} }
output->enabled = enabled; output->enabled = enabled;
if (enabled) {
wlr_output_create_global(output);
} else {
wlr_output_destroy_global(output);
}
wl_signal_emit(&output->events.enable, output); wl_signal_emit(&output->events.enable, output);
} }

View File

@ -203,6 +203,7 @@ void wlr_output_layout_add(struct wlr_output_layout *layout,
l_output->y = y; l_output->y = y;
l_output->state->auto_configured = false; l_output->state->auto_configured = false;
wlr_output_layout_reconfigure(layout); wlr_output_layout_reconfigure(layout);
wlr_output_create_global(output);
wl_signal_emit(&layout->events.add, l_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_output_destroy(l_output);
wlr_output_layout_reconfigure(layout); wlr_output_layout_reconfigure(layout);
} }
wlr_output_destroy_global(output);
} }
void wlr_output_layout_output_coords(struct wlr_output_layout *layout, 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; l_output->state->auto_configured = true;
wlr_output_layout_reconfigure(layout); wlr_output_layout_reconfigure(layout);
wlr_output_create_global(output);
wl_signal_emit(&layout->events.add, l_output); wl_signal_emit(&layout->events.add, l_output);
} }