From 2aabaf88096864f4a9c534f94c909968d0b62b19 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 26 Jun 2023 20:07:36 +0200 Subject: examples: enable new outputs --- examples/fullscreen-shell.c | 9 +++++---- examples/output-layers.c | 9 +++++---- examples/output-layout.c | 9 +++++---- examples/pointer.c | 9 +++++---- examples/rotation.c | 9 ++++----- examples/scene-graph.c | 9 +++++---- examples/simple.c | 9 +++++---- examples/tablet.c | 9 +++++---- examples/touch.c | 9 +++++---- 9 files changed, 44 insertions(+), 37 deletions(-) (limited to 'examples') diff --git a/examples/fullscreen-shell.c b/examples/fullscreen-shell.c index 22053493..aa55adb8 100644 --- a/examples/fullscreen-shell.c +++ b/examples/fullscreen-shell.c @@ -165,14 +165,15 @@ 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_state state; + wlr_output_state_init(&state); + wlr_output_state_set_enabled(&state, true); struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output); if (mode != NULL) { - struct wlr_output_state state; - wlr_output_state_init(&state); wlr_output_state_set_mode(&state, mode); - wlr_output_commit_state(wlr_output, &state); - wlr_output_state_finish(&state); } + wlr_output_commit_state(wlr_output, &state); + wlr_output_state_finish(&state); } static void server_handle_present_surface(struct wl_listener *listener, diff --git a/examples/output-layers.c b/examples/output-layers.c index 092394f5..cec3b50b 100644 --- a/examples/output-layers.c +++ b/examples/output-layers.c @@ -174,14 +174,15 @@ 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); + struct wlr_output_state state; + wlr_output_state_init(&state); + wlr_output_state_set_enabled(&state, true); struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output); if (mode != NULL) { - struct wlr_output_state state; - wlr_output_state_init(&state); wlr_output_state_set_mode(&state, mode); - wlr_output_commit_state(wlr_output, &state); - wlr_output_state_finish(&state); } + 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 1cd7d6e9..99d403e0 100644 --- a/examples/output-layout.c +++ b/examples/output-layout.c @@ -177,14 +177,15 @@ 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_state state; + wlr_output_state_init(&state); + wlr_output_state_set_enabled(&state, true); struct wlr_output_mode *mode = wlr_output_preferred_mode(output); if (mode != NULL) { - struct wlr_output_state state; - wlr_output_state_init(&state); wlr_output_state_set_mode(&state, mode); - wlr_output_commit_state(output, &state); - wlr_output_state_finish(&state); } + 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/pointer.c b/examples/pointer.c index 127b77f3..f6ae30b4 100644 --- a/examples/pointer.c +++ b/examples/pointer.c @@ -279,14 +279,15 @@ static void new_output_notify(struct wl_listener *listener, void *data) { wlr_xcursor_manager_set_cursor_image(sample->xcursor_manager, "default", sample->cursor); + struct wlr_output_state state; + wlr_output_state_init(&state); + wlr_output_state_set_enabled(&state, true); struct wlr_output_mode *mode = wlr_output_preferred_mode(output); if (mode != NULL) { - struct wlr_output_state state; - wlr_output_state_init(&state); wlr_output_state_set_mode(&state, mode); - wlr_output_commit_state(output, &state); - wlr_output_state_finish(&state); } + wlr_output_commit_state(output, &state); + wlr_output_state_finish(&state); } diff --git a/examples/rotation.c b/examples/rotation.c index 2770529f..e092a363 100644 --- a/examples/rotation.c +++ b/examples/rotation.c @@ -123,10 +123,6 @@ 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; - struct wlr_output_state state; - wlr_output_state_init(&state); - 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); @@ -135,11 +131,14 @@ 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_state state; + wlr_output_state_init(&state); + wlr_output_state_set_transform(&state, sample->transform); + wlr_output_state_set_enabled(&state, true); struct wlr_output_mode *mode = wlr_output_preferred_mode(output); if (mode != NULL) { wlr_output_state_set_mode(&state, mode); } - wlr_output_commit_state(output, &state); wlr_output_state_finish(&state); } diff --git a/examples/scene-graph.c b/examples/scene-graph.c index 0ea61c28..3cf150d0 100644 --- a/examples/scene-graph.c +++ b/examples/scene-graph.c @@ -81,14 +81,15 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) { output->scene_output = wlr_scene_output_create(server->scene, wlr_output); + struct wlr_output_state state; + wlr_output_state_init(&state); + wlr_output_state_set_enabled(&state, true); struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output); if (mode != NULL) { - struct wlr_output_state state; - wlr_output_state_init(&state); wlr_output_state_set_mode(&state, mode); - wlr_output_commit_state(wlr_output, &state); - wlr_output_state_finish(&state); } + 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 533e42b5..781ee0e9 100644 --- a/examples/simple.c +++ b/examples/simple.c @@ -106,14 +106,15 @@ 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_state state; + wlr_output_state_init(&state); + wlr_output_state_set_enabled(&state, true); struct wlr_output_mode *mode = wlr_output_preferred_mode(output); if (mode != NULL) { - struct wlr_output_state state; - wlr_output_state_init(&state); wlr_output_state_set_mode(&state, mode); - wlr_output_commit_state(sample_output->output, &state); - wlr_output_state_finish(&state); } + 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/tablet.c b/examples/tablet.c index fc2094f5..c992e0a4 100644 --- a/examples/tablet.c +++ b/examples/tablet.c @@ -278,14 +278,15 @@ 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_state state; + wlr_output_state_init(&state); + wlr_output_state_set_enabled(&state, true); struct wlr_output_mode *mode = wlr_output_preferred_mode(output); if (mode != NULL) { - struct wlr_output_state state; - wlr_output_state_init(&state); wlr_output_state_set_mode(&state, mode); - wlr_output_commit_state(output, &state); - wlr_output_state_finish(&state); } + 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/touch.c b/examples/touch.c index c054fea9..f32b5bba 100644 --- a/examples/touch.c +++ b/examples/touch.c @@ -183,14 +183,15 @@ 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_state state; + wlr_output_state_init(&state); + wlr_output_state_set_enabled(&state, true); struct wlr_output_mode *mode = wlr_output_preferred_mode(output); if (mode != NULL) { - struct wlr_output_state state; - wlr_output_state_init(&state); wlr_output_state_set_mode(&state, mode); - wlr_output_commit_state(output, &state); - wlr_output_state_finish(&state); } + wlr_output_commit_state(output, &state); + wlr_output_state_finish(&state); } static void keyboard_key_notify(struct wl_listener *listener, void *data) { -- cgit v1.2.3