diff options
author | Simon Ser <contact@emersion.fr> | 2021-04-19 17:25:13 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-04-19 17:25:41 +0200 |
commit | fd7e565ce3ea463b725fcd5b4291411f030a4e2c (patch) | |
tree | f3ded874a6e2623f4c7b822b429821e3417e109f /examples/touch.c | |
parent | 3432ab2ba7d7c65d39c766f902ac915b60af52fd (diff) |
examples: use wlr_output_preferred_mode
Diffstat (limited to 'examples/touch.c')
-rw-r--r-- | examples/touch.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/touch.c b/examples/touch.c index 3184d8be..f53b7bb8 100644 --- a/examples/touch.c +++ b/examples/touch.c @@ -151,10 +151,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); - } sample_output->output = output; sample_output->sample = sample; wl_signal_add(&output->events.frame, &sample_output->frame); @@ -162,6 +158,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); } |