aboutsummaryrefslogtreecommitdiff
path: root/examples/output-layout.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/output-layout.c')
-rw-r--r--examples/output-layout.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/output-layout.c b/examples/output-layout.c
index cacee014..d8643168 100644
--- a/examples/output-layout.c
+++ b/examples/output-layout.c
@@ -159,10 +159,6 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
- if (!wl_list_empty(&output->modes)) {
- struct wlr_output_mode *mode = wl_container_of(output->modes.prev, mode, link);
- wlr_output_set_mode(output, mode);
- }
wlr_output_layout_add_auto(sample->layout, output);
sample_output->output = output;
sample_output->sample = sample;
@@ -171,6 +167,11 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
wl_signal_add(&output->events.destroy, &sample_output->destroy);
sample_output->destroy.notify = output_remove_notify;
+ struct wlr_output_mode *mode = wlr_output_preferred_mode(output);
+ if (mode != NULL) {
+ wlr_output_set_mode(output, mode);
+ }
+
wlr_output_commit(output);
}