From fd7e565ce3ea463b725fcd5b4291411f030a4e2c Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 19 Apr 2021 17:25:13 +0200 Subject: examples: use wlr_output_preferred_mode --- examples/simple.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'examples/simple.c') diff --git a/examples/simple.c b/examples/simple.c index 34ca46c7..20d80096 100644 --- a/examples/simple.c +++ b/examples/simple.c @@ -86,11 +86,6 @@ static void new_output_notify(struct wl_listener *listener, void *data) { wl_container_of(listener, sample, new_output); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); - - struct wlr_output_mode *mode = wlr_output_preferred_mode(output); - if (mode != NULL) { - wlr_output_set_mode(output, mode); - } sample_output->output = output; sample_output->sample = sample; wl_signal_add(&output->events.frame, &sample_output->frame); @@ -98,6 +93,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(sample_output->output); } -- cgit v1.2.3