From 33c427a6aaf472577dcde7ab85ff2cf0e379b4c3 Mon Sep 17 00:00:00 2001 From: emersion Date: Sun, 7 Jan 2018 18:40:58 +0100 Subject: [PATCH] output_layout: disabled outputs are just like enabled outputs --- types/wlr_output_layout.c | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c index 9b9b0c68..d1d67e7d 100644 --- a/types/wlr_output_layout.c +++ b/types/wlr_output_layout.c @@ -18,7 +18,6 @@ struct wlr_output_layout_output_state { struct wlr_box _box; // should never be read directly, use the getter bool auto_configured; - struct wl_listener enable; struct wl_listener mode; struct wl_listener scale; struct wl_listener transform; @@ -48,7 +47,6 @@ struct wlr_output_layout *wlr_output_layout_create() { static void wlr_output_layout_output_destroy( struct wlr_output_layout_output *l_output) { wl_signal_emit(&l_output->events.destroy, l_output); - wl_list_remove(&l_output->state->enable.link); wl_list_remove(&l_output->state->mode.link); wl_list_remove(&l_output->state->scale.link); wl_list_remove(&l_output->state->transform.link); @@ -76,19 +74,12 @@ void wlr_output_layout_destroy(struct wlr_output_layout *layout) { static struct wlr_box *wlr_output_layout_output_get_box( struct wlr_output_layout_output *l_output) { - if (!l_output->output->enabled) { - l_output->state->_box.x = 0; - l_output->state->_box.y = 0; - l_output->state->_box.width = 0; - l_output->state->_box.height = 0; - } else { - l_output->state->_box.x = l_output->x; - l_output->state->_box.y = l_output->y; - int width, height; - wlr_output_effective_resolution(l_output->output, &width, &height); - l_output->state->_box.width = width; - l_output->state->_box.height = height; - } + l_output->state->_box.x = l_output->x; + l_output->state->_box.y = l_output->y; + int width, height; + wlr_output_effective_resolution(l_output->output, &width, &height); + l_output->state->_box.width = width; + l_output->state->_box.height = height; return &l_output->state->_box; } @@ -107,7 +98,7 @@ static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) { // in the layout struct wlr_output_layout_output *l_output; wl_list_for_each(l_output, &layout->outputs, link) { - if (l_output->state->auto_configured || !l_output->output->enabled) { + if (l_output->state->auto_configured) { continue; } @@ -125,7 +116,7 @@ static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) { } wl_list_for_each(l_output, &layout->outputs, link) { - if (!l_output->state->auto_configured || !l_output->output->enabled) { + if (!l_output->state->auto_configured) { continue; } struct wlr_box *box = wlr_output_layout_output_get_box(l_output); @@ -135,21 +126,12 @@ static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) { } wl_list_for_each(l_output, &layout->outputs, link) { - if (!l_output->output->enabled) { - continue; - } wlr_output_set_position(l_output->output, l_output->x, l_output->y); } wl_signal_emit(&layout->events.change, layout); } -static void handle_output_enable(struct wl_listener *listener, void *data) { - struct wlr_output_layout_output_state *state = - wl_container_of(listener, state, enable); - wlr_output_layout_reconfigure(state->layout); -} - static void handle_output_mode(struct wl_listener *listener, void *data) { struct wlr_output_layout_output_state *state = wl_container_of(listener, state, mode); @@ -194,8 +176,6 @@ static struct wlr_output_layout_output *wlr_output_layout_output_create( wl_signal_init(&l_output->events.destroy); wl_list_insert(&layout->outputs, &l_output->link); - wl_signal_add(&output->events.enable, &l_output->state->enable); - l_output->state->enable.notify = handle_output_enable; wl_signal_add(&output->events.mode, &l_output->state->mode); l_output->state->mode.notify = handle_output_mode; wl_signal_add(&output->events.scale, &l_output->state->scale);