From 495bcbeedde21eaa9d68ceef1fba5109d5d50dee Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Mon, 12 Jun 2023 20:16:25 -0400 Subject: examples: Drop usage of wlr_output.pending --- examples/fullscreen-shell.c | 7 ++++--- examples/output-layers.c | 10 ++++++---- examples/output-layout.c | 7 ++++--- examples/pointer.c | 7 ++++--- examples/rotation.c | 9 ++++++--- examples/scene-graph.c | 10 ++++++---- examples/simple.c | 7 ++++--- examples/tablet.c | 7 ++++--- examples/touch.c | 7 ++++--- 9 files changed, 42 insertions(+), 29 deletions(-) diff --git a/examples/fullscreen-shell.c b/examples/fullscreen-shell.c index cf6023b0..9800a4c2 100644 --- a/examples/fullscreen-shell.c +++ b/examples/fullscreen-shell.c @@ -166,10 +166,11 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) { struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output); if (mode != NULL) { - wlr_output_set_mode(wlr_output, mode); + struct wlr_output_state state = {0}; + wlr_output_state_set_mode(&state, mode); + wlr_output_commit_state(wlr_output, &state); + wlr_output_state_finish(&state); } - - wlr_output_commit(wlr_output); } static void server_handle_present_surface(struct wl_listener *listener, diff --git a/examples/output-layers.c b/examples/output-layers.c index 535b9f5f..973633d4 100644 --- a/examples/output-layers.c +++ b/examples/output-layers.c @@ -175,10 +175,12 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) { wl_signal_add(&wlr_output->events.frame, &output->frame); wl_list_insert(&server->outputs, &output->link); - if (!wl_list_empty(&wlr_output->modes)) { - struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output); - wlr_output_set_mode(wlr_output, mode); - wlr_output_commit(wlr_output); + struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output); + if (mode != NULL) { + struct wlr_output_state state = {0}; + wlr_output_state_set_mode(&state, mode); + wlr_output_commit_state(wlr_output, &state); + wlr_output_state_finish(&state); } wlr_output_create_global(wlr_output); diff --git a/examples/output-layout.c b/examples/output-layout.c index 1094141c..ee45c9c2 100644 --- a/examples/output-layout.c +++ b/examples/output-layout.c @@ -178,10 +178,11 @@ static void new_output_notify(struct wl_listener *listener, void *data) { struct wlr_output_mode *mode = wlr_output_preferred_mode(output); if (mode != NULL) { - wlr_output_set_mode(output, mode); + struct wlr_output_state state = {0}; + wlr_output_state_set_mode(&state, mode); + wlr_output_commit_state(output, &state); + wlr_output_state_finish(&state); } - - wlr_output_commit(output); } static void keyboard_key_notify(struct wl_listener *listener, void *data) { diff --git a/examples/pointer.c b/examples/pointer.c index 2e116b88..c67ce1ca 100644 --- a/examples/pointer.c +++ b/examples/pointer.c @@ -280,10 +280,11 @@ static void new_output_notify(struct wl_listener *listener, void *data) { struct wlr_output_mode *mode = wlr_output_preferred_mode(output); if (mode != NULL) { - wlr_output_set_mode(output, mode); + struct wlr_output_state state = {0}; + wlr_output_state_set_mode(&state, mode); + wlr_output_commit_state(output, &state); + wlr_output_state_finish(&state); } - - wlr_output_commit(output); } diff --git a/examples/rotation.c b/examples/rotation.c index 31768886..c7bd85ae 100644 --- a/examples/rotation.c +++ b/examples/rotation.c @@ -122,7 +122,9 @@ static void new_output_notify(struct wl_listener *listener, void *data) { sample_output->x_offs = sample_output->y_offs = 0; sample_output->x_vel = sample_output->y_vel = 128; - wlr_output_set_transform(output, sample->transform); + struct wlr_output_state state = {0}; + wlr_output_state_set_transform(&state, sample->transform); + sample_output->output = output; sample_output->sample = sample; wl_signal_add(&output->events.frame, &sample_output->frame); @@ -133,10 +135,11 @@ static void new_output_notify(struct wl_listener *listener, void *data) { struct wlr_output_mode *mode = wlr_output_preferred_mode(output); if (mode != NULL) { - wlr_output_set_mode(output, mode); + wlr_output_state_set_mode(&state, mode); } - wlr_output_commit(output); + wlr_output_commit_state(output, &state); + wlr_output_state_finish(&state); } static void keyboard_key_notify(struct wl_listener *listener, void *data) { diff --git a/examples/scene-graph.c b/examples/scene-graph.c index 3d75164b..68441c11 100644 --- a/examples/scene-graph.c +++ b/examples/scene-graph.c @@ -81,10 +81,12 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) { output->scene_output = wlr_scene_output_create(server->scene, wlr_output); - if (!wl_list_empty(&wlr_output->modes)) { - struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output); - wlr_output_set_mode(wlr_output, mode); - wlr_output_commit(wlr_output); + struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output); + if (mode != NULL) { + struct wlr_output_state state = {0}; + wlr_output_state_set_mode(&state, mode); + wlr_output_commit_state(wlr_output, &state); + wlr_output_state_finish(&state); } wlr_output_create_global(wlr_output); diff --git a/examples/simple.c b/examples/simple.c index 0c737106..fa52bce5 100644 --- a/examples/simple.c +++ b/examples/simple.c @@ -107,10 +107,11 @@ static void new_output_notify(struct wl_listener *listener, void *data) { struct wlr_output_mode *mode = wlr_output_preferred_mode(output); if (mode != NULL) { - wlr_output_set_mode(output, mode); + struct wlr_output_state state = {0}; + wlr_output_state_set_mode(&state, mode); + wlr_output_commit_state(sample_output->output, &state); + wlr_output_state_finish(&state); } - - wlr_output_commit(sample_output->output); } static void keyboard_key_notify(struct wl_listener *listener, void *data) { diff --git a/examples/tablet.c b/examples/tablet.c index 85970685..ee6712b1 100644 --- a/examples/tablet.c +++ b/examples/tablet.c @@ -285,10 +285,11 @@ static void new_output_notify(struct wl_listener *listener, void *data) { struct wlr_output_mode *mode = wlr_output_preferred_mode(output); if (mode != NULL) { - wlr_output_set_mode(output, mode); + struct wlr_output_state state = {0}; + wlr_output_state_set_mode(&state, mode); + wlr_output_commit_state(output, &state); + wlr_output_state_finish(&state); } - - wlr_output_commit(output); } static void keyboard_key_notify(struct wl_listener *listener, void *data) { diff --git a/examples/touch.c b/examples/touch.c index 4eea2bd5..ab2e80ce 100644 --- a/examples/touch.c +++ b/examples/touch.c @@ -184,10 +184,11 @@ static void new_output_notify(struct wl_listener *listener, void *data) { struct wlr_output_mode *mode = wlr_output_preferred_mode(output); if (mode != NULL) { - wlr_output_set_mode(output, mode); + struct wlr_output_state state = {0}; + wlr_output_state_set_mode(&state, mode); + wlr_output_commit_state(output, &state); + wlr_output_state_finish(&state); } - - wlr_output_commit(output); } static void keyboard_key_notify(struct wl_listener *listener, void *data) { -- cgit v1.2.3