mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
examples: use wlr_output_preferred_mode
This commit is contained in:
parent
3432ab2ba7
commit
fd7e565ce3
8 changed files with 40 additions and 36 deletions
|
|
@ -109,10 +109,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->x_offs = sample_output->y_offs = 0;
|
||||
sample_output->x_vel = sample_output->y_vel = 128;
|
||||
|
||||
|
|
@ -125,6 +121,11 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
|
|||
sample_output->destroy.notify = output_remove_notify;
|
||||
wl_list_insert(&sample->outputs, &sample_output->link);
|
||||
|
||||
struct wlr_output_mode *mode = wlr_output_preferred_mode(output);
|
||||
if (mode != NULL) {
|
||||
wlr_output_set_mode(output, mode);
|
||||
}
|
||||
|
||||
wlr_output_commit(output);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue