aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-06-26 15:54:57 +0200
committerAlexander Orzechowski <alex@ozal.ski>2023-06-27 16:26:30 +0000
commit9e6431dc3bd121b1994961c68374b4e17db29444 (patch)
tree43d6b2f68289732f13a1b6c333f9ae29597729bf
parent611ce136251503477554d18f00766a77a1dbe7de (diff)
tinywl: enable new outputs
-rw-r--r--tinywl/tinywl.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/tinywl/tinywl.c b/tinywl/tinywl.c
index 80f08e70..8324c500 100644
--- a/tinywl/tinywl.c
+++ b/tinywl/tinywl.c
@@ -596,6 +596,11 @@ static void server_new_output(struct wl_listener *listener, void *data) {
* and our renderer. Must be done once, before commiting the output */
wlr_output_init_render(wlr_output, server->allocator, server->renderer);
+ /* The output may be disabled, switch it on. */
+ struct wlr_output_state state;
+ wlr_output_state_init(&state);
+ wlr_output_state_set_enabled(&state, true);
+
/* Some backends don't have modes. DRM+KMS does, and we need to set a mode
* before we can use the output. The mode is a tuple of (width, height,
* refresh rate), and each monitor supports only a specific set of modes. We
@@ -603,17 +608,13 @@ static void server_new_output(struct wl_listener *listener, void *data) {
* would let the user configure it. */
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_state_set_enabled(&state, true);
- if (!wlr_output_commit_state(wlr_output, &state)) {
- wlr_output_state_finish(&state);
- return;
- }
- wlr_output_state_finish(&state);
}
+ /* Atomically applies the new output state. */
+ wlr_output_commit_state(wlr_output, &state);
+ wlr_output_state_finish(&state);
+
/* Allocates and configures our state for this output */
struct tinywl_output *output =
calloc(1, sizeof(struct tinywl_output));