output_layout: disabled outputs are just like enabled outputs

master
emersion 7 years ago
parent e56b82e896
commit 33c427a6aa
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

@ -18,7 +18,6 @@ struct wlr_output_layout_output_state {
struct wlr_box _box; // should never be read directly, use the getter struct wlr_box _box; // should never be read directly, use the getter
bool auto_configured; bool auto_configured;
struct wl_listener enable;
struct wl_listener mode; struct wl_listener mode;
struct wl_listener scale; struct wl_listener scale;
struct wl_listener transform; struct wl_listener transform;
@ -48,7 +47,6 @@ struct wlr_output_layout *wlr_output_layout_create() {
static void wlr_output_layout_output_destroy( static void wlr_output_layout_output_destroy(
struct wlr_output_layout_output *l_output) { struct wlr_output_layout_output *l_output) {
wl_signal_emit(&l_output->events.destroy, 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->mode.link);
wl_list_remove(&l_output->state->scale.link); wl_list_remove(&l_output->state->scale.link);
wl_list_remove(&l_output->state->transform.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( static struct wlr_box *wlr_output_layout_output_get_box(
struct wlr_output_layout_output *l_output) { struct wlr_output_layout_output *l_output) {
if (!l_output->output->enabled) { l_output->state->_box.x = l_output->x;
l_output->state->_box.x = 0; l_output->state->_box.y = l_output->y;
l_output->state->_box.y = 0; int width, height;
l_output->state->_box.width = 0; wlr_output_effective_resolution(l_output->output, &width, &height);
l_output->state->_box.height = 0; l_output->state->_box.width = width;
} else { 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; return &l_output->state->_box;
} }
@ -107,7 +98,7 @@ static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
// in the layout // in the layout
struct wlr_output_layout_output *l_output; struct wlr_output_layout_output *l_output;
wl_list_for_each(l_output, &layout->outputs, link) { 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; 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) { 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; continue;
} }
struct wlr_box *box = wlr_output_layout_output_get_box(l_output); 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) { 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); wlr_output_set_position(l_output->output, l_output->x, l_output->y);
} }
wl_signal_emit(&layout->events.change, layout); 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) { static void handle_output_mode(struct wl_listener *listener, void *data) {
struct wlr_output_layout_output_state *state = struct wlr_output_layout_output_state *state =
wl_container_of(listener, state, mode); 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_signal_init(&l_output->events.destroy);
wl_list_insert(&layout->outputs, &l_output->link); 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); wl_signal_add(&output->events.mode, &l_output->state->mode);
l_output->state->mode.notify = handle_output_mode; l_output->state->mode.notify = handle_output_mode;
wl_signal_add(&output->events.scale, &l_output->state->scale); wl_signal_add(&output->events.scale, &l_output->state->scale);

Loading…
Cancel
Save