aboutsummaryrefslogtreecommitdiff
path: root/include
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 /include
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 'include')
-rw-r--r--include/wlr/types/wlr_output.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index ad034982..aa3d7a18 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -88,10 +88,8 @@ struct wlr_output_state {
uint32_t render_format;
enum wl_output_subpixel subpixel;
- // only valid if WLR_OUTPUT_STATE_BUFFER
struct wlr_buffer *buffer;
- // only valid if WLR_OUTPUT_STATE_MODE
enum wlr_output_state_mode_type mode_type;
struct wlr_output_mode *mode;
struct {
@@ -99,11 +97,9 @@ struct wlr_output_state {
int32_t refresh; // mHz, may be zero
} custom_mode;
- // only valid if WLR_OUTPUT_STATE_GAMMA_LUT
uint16_t *gamma_lut;
size_t gamma_lut_size;
- // only valid if WLR_OUTPUT_STATE_LAYERS
struct wlr_output_layer_state *layers;
size_t layers_len;
};
@@ -568,6 +564,10 @@ bool wlr_output_cursor_move(struct wlr_output_cursor *cursor,
void wlr_output_cursor_destroy(struct wlr_output_cursor *cursor);
/**
+ * Initialize an output state.
+ */
+void wlr_output_state_init(struct wlr_output_state *state);
+/**
* Releases all resources associated with an output state.
*/
void wlr_output_state_finish(struct wlr_output_state *state);