Merge pull request #1246 from emersion/output-layout-no-mode
output-layout: don't expose outputs without a mode
This commit is contained in:
commit
8b112730ca
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -500,4 +510,3 @@ struct wlr_output *wlr_output_layout_farthest_output(
|
|||
return wlr_output_layout_output_in_direction(layout, direction,
|
||||
reference, ref_lx, ref_ly, FARTHEST);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue