aboutsummaryrefslogtreecommitdiff
path: root/examples/fullscreen-shell.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-06-22 15:48:35 +0200
committerAlexander Orzechowski <alex@ozal.ski>2023-06-23 18:07:26 +0000
commitbe050979684ae8779a56e4b0166cfb21d1935d35 (patch)
treec4a77ff1363875abb59508b3b3a5cdff28dbb895 /examples/fullscreen-shell.c
parent8a5b5e6f28dae650df36a271213655b8bdf52dbf (diff)
output: add wlr_output_state_init()
This changes the semantics of wlr_output_state. Instead of having fields with uninitialized memory when missing from the committed bitflag, all fields are always initialized (and maybe NULL/empty), just like we do in wlr_surface_state. This reduces the chances of footguns when reading a field, and removes the need to check for the committed bitfield everywhere. A new wlr_output_state_init() function takes care of initializing the Pixman region.
Diffstat (limited to 'examples/fullscreen-shell.c')
-rw-r--r--examples/fullscreen-shell.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/fullscreen-shell.c b/examples/fullscreen-shell.c
index 9800a4c2..22053493 100644
--- a/examples/fullscreen-shell.c
+++ b/examples/fullscreen-shell.c
@@ -89,7 +89,8 @@ static void output_handle_frame(struct wl_listener *listener, void *data) {
int width, height;
wlr_output_effective_resolution(output->wlr_output, &width, &height);
- struct wlr_output_state state = {0};
+ struct wlr_output_state state;
+ wlr_output_state_init(&state);
struct wlr_render_pass *pass = wlr_output_begin_render_pass(output->wlr_output, &state, NULL,
NULL);
if (pass == NULL) {
@@ -166,7 +167,8 @@ 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) {
- struct wlr_output_state state = {0};
+ 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);