aboutsummaryrefslogtreecommitdiff
path: root/examples/fullscreen-shell.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-04-19 17:25:13 +0200
committerSimon Ser <contact@emersion.fr>2021-04-19 17:25:41 +0200
commitfd7e565ce3ea463b725fcd5b4291411f030a4e2c (patch)
treef3ded874a6e2623f4c7b822b429821e3417e109f /examples/fullscreen-shell.c
parent3432ab2ba7d7c65d39c766f902ac915b60af52fd (diff)
examples: use wlr_output_preferred_mode
Diffstat (limited to 'examples/fullscreen-shell.c')
-rw-r--r--examples/fullscreen-shell.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/fullscreen-shell.c b/examples/fullscreen-shell.c
index 9a2f7d7d..52776c55 100644
--- a/examples/fullscreen-shell.c
+++ b/examples/fullscreen-shell.c
@@ -146,12 +146,6 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) {
wl_container_of(listener, server, new_output);
struct wlr_output *wlr_output = data;
- if (!wl_list_empty(&wlr_output->modes)) {
- struct wlr_output_mode *mode =
- wl_container_of(wlr_output->modes.prev, mode, link);
- wlr_output_set_mode(wlr_output, mode);
- }
-
struct fullscreen_output *output =
calloc(1, sizeof(struct fullscreen_output));
output->wlr_output = wlr_output;
@@ -163,6 +157,11 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) {
wlr_output_layout_add_auto(server->output_layout, wlr_output);
wlr_output_create_global(wlr_output);
+ struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output);
+ if (mode != NULL) {
+ wlr_output_set_mode(wlr_output, mode);
+ }
+
wlr_output_commit(wlr_output);
}