Use WLR_PRIVATE for private fields

This commit is contained in:
Kirill Primak 2024-10-05 11:37:22 +03:00
parent e51ce333bc
commit 6006023a37
35 changed files with 262 additions and 249 deletions

View File

@ -237,6 +237,13 @@ used and `#undef` them after.
* Document the contents and container of a `struct wl_list` with a * Document the contents and container of a `struct wl_list` with a
`// content.link` and `// container.list` comment. `// content.link` and `// container.list` comment.
### Private fields
Wrap private fields of public structures with `struct { … } WLR_PRIVATE`. This
ensures that compositor authors don't use them by accident. Within wlroots
`WLR_PRIVATE` is expanded to nothing, so private fields are accessed in the same
way as public ones.
### Safety ### Safety
* Avoid string manipulation functions which don't take the size of the * Avoid string manipulation functions which don't take the size of the
@ -325,12 +332,14 @@ struct wlr_compositor {
struct wl_global *global; struct wl_global *global;
struct wl_listener display_destroy;
struct { struct {
struct wl_signal new_surface; struct wl_signal new_surface;
struct wl_signal destroy; struct wl_signal destroy;
} events; } events;
struct {
struct wl_listener display_destroy;
} WLR_PRIVATE;
}; };
``` ```

View File

@ -29,9 +29,9 @@ struct wlr_drm_syncobj_timeline {
int drm_fd; int drm_fd;
uint32_t handle; uint32_t handle;
// private state struct {
size_t n_refs;
size_t n_refs; } WLR_PRIVATE;
}; };
struct wlr_drm_syncobj_timeline_waiter { struct wlr_drm_syncobj_timeline_waiter {
@ -39,10 +39,10 @@ struct wlr_drm_syncobj_timeline_waiter {
struct wl_signal ready; struct wl_signal ready;
} events; } events;
// private state struct {
int ev_fd;
int ev_fd; struct wl_event_source *event_source;
struct wl_event_source *event_source; } WLR_PRIVATE;
}; };
/** /**

View File

@ -53,9 +53,9 @@ struct wlr_renderer {
bool timeline; bool timeline;
} features; } features;
// private state struct {
const struct wlr_renderer_impl *impl;
const struct wlr_renderer_impl *impl; } WLR_PRIVATE;
}; };
/** /**

View File

@ -20,9 +20,9 @@ struct wlr_alpha_modifier_surface_v1_state {
struct wlr_alpha_modifier_v1 { struct wlr_alpha_modifier_v1 {
struct wl_global *global; struct wl_global *global;
// private state struct {
struct wl_listener display_destroy;
struct wl_listener display_destroy; } WLR_PRIVATE;
}; };
struct wlr_alpha_modifier_v1 *wlr_alpha_modifier_v1_create(struct wl_display *display); struct wlr_alpha_modifier_v1 *wlr_alpha_modifier_v1_create(struct wl_display *display);

View File

@ -148,12 +148,12 @@ struct wlr_client_buffer {
*/ */
struct wlr_buffer *source; struct wlr_buffer *source;
// private state struct {
struct wl_listener source_destroy;
struct wl_listener renderer_destroy;
struct wl_listener source_destroy; size_t n_ignore_locks;
struct wl_listener renderer_destroy; } WLR_PRIVATE;
size_t n_ignore_locks;
}; };
/** /**

View File

@ -236,33 +236,33 @@ struct wlr_surface {
struct wlr_addon_set addons; struct wlr_addon_set addons;
void *data; void *data;
// private state
struct wl_listener role_resource_destroy;
struct { struct {
int32_t scale; struct wl_listener role_resource_destroy;
enum wl_output_transform transform;
int width, height;
int buffer_width, buffer_height;
} previous;
bool unmap_commit; struct {
int32_t scale;
enum wl_output_transform transform;
int width, height;
int buffer_width, buffer_height;
} previous;
bool opaque; bool unmap_commit;
bool handling_commit; bool opaque;
bool pending_rejected;
int32_t preferred_buffer_scale; bool handling_commit;
bool preferred_buffer_transform_sent; bool pending_rejected;
enum wl_output_transform preferred_buffer_transform;
struct wl_list synced; // wlr_surface_synced.link int32_t preferred_buffer_scale;
size_t synced_len; bool preferred_buffer_transform_sent;
enum wl_output_transform preferred_buffer_transform;
struct wl_resource *pending_buffer_resource; struct wl_list synced; // wlr_surface_synced.link
struct wl_listener pending_buffer_resource_destroy; size_t synced_len;
struct wl_resource *pending_buffer_resource;
struct wl_listener pending_buffer_resource_destroy;
} WLR_PRIVATE;
}; };
struct wlr_renderer; struct wlr_renderer;

View File

@ -23,9 +23,9 @@ struct wlr_content_type_manager_v1 {
void *data; void *data;
// private state struct {
struct wl_listener display_destroy;
struct wl_listener display_destroy; } WLR_PRIVATE;
}; };
struct wlr_content_type_manager_v1 *wlr_content_type_manager_v1_create( struct wlr_content_type_manager_v1 *wlr_content_type_manager_v1_create(

View File

@ -28,9 +28,9 @@ struct wlr_cursor_shape_manager_v1 {
void *data; void *data;
// private state struct {
struct wl_listener display_destroy;
struct wl_listener display_destroy; } WLR_PRIVATE;
}; };
enum wlr_cursor_shape_manager_v1_device_type { enum wlr_cursor_shape_manager_v1_device_type {

View File

@ -30,9 +30,9 @@ struct wlr_damage_ring {
// Difference between the current buffer and the previous one // Difference between the current buffer and the previous one
pixman_region32_t current; pixman_region32_t current;
// private state struct {
struct wl_list buffers; // wlr_damage_ring_buffer.link
struct wl_list buffers; // wlr_damage_ring_buffer.link } WLR_PRIVATE;
}; };
void wlr_damage_ring_init(struct wlr_damage_ring *ring); void wlr_damage_ring_init(struct wlr_damage_ring *ring);

View File

@ -40,12 +40,12 @@ struct wlr_drm {
struct wl_signal destroy; struct wl_signal destroy;
} events; } events;
// private state struct {
char *node_name;
struct wlr_drm_format_set formats;
char *node_name; struct wl_listener display_destroy;
struct wlr_drm_format_set formats; } WLR_PRIVATE;
struct wl_listener display_destroy;
}; };
struct wlr_drm_buffer *wlr_drm_buffer_try_from_resource( struct wlr_drm_buffer *wlr_drm_buffer_try_from_resource(

View File

@ -39,10 +39,10 @@ struct wlr_foreign_toplevel_handle_v1_output {
struct wlr_output *output; struct wlr_output *output;
struct wlr_foreign_toplevel_handle_v1 *toplevel; struct wlr_foreign_toplevel_handle_v1 *toplevel;
// private state struct {
struct wl_listener output_bind;
struct wl_listener output_bind; struct wl_listener output_destroy;
struct wl_listener output_destroy; } WLR_PRIVATE;
}; };
struct wlr_foreign_toplevel_handle_v1 { struct wlr_foreign_toplevel_handle_v1 {

View File

@ -20,9 +20,9 @@ struct wlr_fractional_scale_manager_v1 {
struct wl_signal destroy; struct wl_signal destroy;
} events; } events;
// private state struct {
struct wl_listener display_destroy;
struct wl_listener display_destroy; } WLR_PRIVATE;
}; };
void wlr_fractional_scale_v1_notify_scale( void wlr_fractional_scale_v1_notify_scale(

View File

@ -19,12 +19,12 @@ struct wlr_seat;
struct wlr_idle_notifier_v1 { struct wlr_idle_notifier_v1 {
struct wl_global *global; struct wl_global *global;
// private state struct {
bool inhibited;
struct wl_list notifications; // wlr_idle_notification_v1.link
bool inhibited; struct wl_listener display_destroy;
struct wl_list notifications; // wlr_idle_notification_v1.link } WLR_PRIVATE;
struct wl_listener display_destroy;
}; };

View File

@ -114,9 +114,9 @@ struct wlr_layer_surface_v1 {
void *data; void *data;
// private state struct {
struct wlr_surface_synced synced;
struct wlr_surface_synced synced; } WLR_PRIVATE;
}; };
struct wlr_layer_shell_v1 *wlr_layer_shell_v1_create(struct wl_display *display, struct wlr_layer_shell_v1 *wlr_layer_shell_v1_create(struct wl_display *display,

View File

@ -24,9 +24,9 @@ struct wlr_dmabuf_v1_buffer {
struct wl_resource *resource; // can be NULL if the client destroyed it struct wl_resource *resource; // can be NULL if the client destroyed it
struct wlr_dmabuf_attributes attributes; struct wlr_dmabuf_attributes attributes;
// private state struct {
struct wl_listener release;
struct wl_listener release; } WLR_PRIVATE;
}; };
/** /**
@ -55,18 +55,18 @@ struct wlr_linux_dmabuf_v1 {
struct wl_signal destroy; struct wl_signal destroy;
} events; } events;
// private state struct {
struct wlr_linux_dmabuf_feedback_v1_compiled *default_feedback;
struct wlr_drm_format_set default_formats; // for legacy clients
struct wl_list surfaces; // wlr_linux_dmabuf_v1_surface.link
struct wlr_linux_dmabuf_feedback_v1_compiled *default_feedback; int main_device_fd; // to sanity check FDs sent by clients, -1 if unavailable
struct wlr_drm_format_set default_formats; // for legacy clients
struct wl_list surfaces; // wlr_linux_dmabuf_v1_surface.link
int main_device_fd; // to sanity check FDs sent by clients, -1 if unavailable struct wl_listener display_destroy;
struct wl_listener display_destroy; bool (*check_dmabuf_callback)(struct wlr_dmabuf_attributes *attribs, void *data);
void *check_dmabuf_callback_data;
bool (*check_dmabuf_callback)(struct wlr_dmabuf_attributes *attribs, void *data); } WLR_PRIVATE;
void *check_dmabuf_callback_data;
}; };
/** /**

View File

@ -26,11 +26,11 @@ struct wlr_linux_drm_syncobj_surface_v1_state {
struct wlr_linux_drm_syncobj_manager_v1 { struct wlr_linux_drm_syncobj_manager_v1 {
struct wl_global *global; struct wl_global *global;
// private state struct {
int drm_fd;
int drm_fd; struct wl_listener display_destroy;
} WLR_PRIVATE;
struct wl_listener display_destroy;
}; };
/** /**

View File

@ -50,10 +50,10 @@ struct wlr_output_layer {
void *data; void *data;
// private state struct {
struct wlr_fbox src_box;
struct wlr_fbox src_box; struct wlr_box dst_box;
struct wlr_box dst_box; } WLR_PRIVATE;
}; };
/** /**

View File

@ -36,9 +36,9 @@ struct wlr_output_layout {
void *data; void *data;
// private state struct {
struct wl_listener display_destroy;
struct wl_listener display_destroy; } WLR_PRIVATE;
}; };
struct wlr_output_layout_output { struct wlr_output_layout_output {
@ -55,11 +55,11 @@ struct wlr_output_layout_output {
struct wl_signal destroy; struct wl_signal destroy;
} events; } events;
// private state struct {
struct wlr_addon addon;
struct wlr_addon addon; struct wl_listener commit;
} WLR_PRIVATE;
struct wl_listener commit;
}; };
struct wlr_output_layout *wlr_output_layout_create(struct wl_display *display); struct wlr_output_layout *wlr_output_layout_create(struct wl_display *display);

View File

@ -30,9 +30,9 @@ struct wlr_backend_output_state;
struct wlr_output_swapchain_manager { struct wlr_output_swapchain_manager {
struct wlr_backend *backend; struct wlr_backend *backend;
// private state struct {
struct wl_array outputs; // struct wlr_output_swapchain_manager_output
struct wl_array outputs; // struct wlr_output_swapchain_manager_output } WLR_PRIVATE;
}; };
/** /**

View File

@ -64,13 +64,13 @@ struct wlr_pointer_constraint_v1 {
void *data; void *data;
// private state struct {
struct wl_listener surface_commit;
struct wl_listener surface_destroy;
struct wl_listener seat_destroy;
struct wl_listener surface_commit; struct wlr_surface_synced synced;
struct wl_listener surface_destroy; } WLR_PRIVATE;
struct wl_listener seat_destroy;
struct wlr_surface_synced synced;
}; };
struct wlr_pointer_constraints_v1 { struct wlr_pointer_constraints_v1 {

View File

@ -75,9 +75,9 @@ struct wlr_scene_node {
struct wlr_addon_set addons; struct wlr_addon_set addons;
// private state struct {
pixman_region32_t visible;
pixman_region32_t visible; } WLR_PRIVATE;
}; };
enum wlr_scene_debug_damage_option { enum wlr_scene_debug_damage_option {
@ -103,16 +103,16 @@ struct wlr_scene {
struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1; struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1;
struct wlr_gamma_control_manager_v1 *gamma_control_manager_v1; struct wlr_gamma_control_manager_v1 *gamma_control_manager_v1;
// private state struct {
struct wl_listener linux_dmabuf_v1_destroy;
struct wl_listener gamma_control_manager_v1_destroy;
struct wl_listener gamma_control_manager_v1_set_gamma;
struct wl_listener linux_dmabuf_v1_destroy; enum wlr_scene_debug_damage_option debug_damage_option;
struct wl_listener gamma_control_manager_v1_destroy; bool direct_scanout;
struct wl_listener gamma_control_manager_v1_set_gamma; bool calculate_visibility;
bool highlight_transparent_region;
enum wlr_scene_debug_damage_option debug_damage_option; } WLR_PRIVATE;
bool direct_scanout;
bool calculate_visibility;
bool highlight_transparent_region;
}; };
/** A scene-graph node displaying a single surface. */ /** A scene-graph node displaying a single surface. */
@ -120,19 +120,19 @@ struct wlr_scene_surface {
struct wlr_scene_buffer *buffer; struct wlr_scene_buffer *buffer;
struct wlr_surface *surface; struct wlr_surface *surface;
// private state struct {
struct wlr_box clip;
struct wlr_box clip; struct wlr_addon addon;
struct wlr_addon addon; struct wl_listener outputs_update;
struct wl_listener output_enter;
struct wl_listener outputs_update; struct wl_listener output_leave;
struct wl_listener output_enter; struct wl_listener output_sample;
struct wl_listener output_leave; struct wl_listener frame_done;
struct wl_listener output_sample; struct wl_listener surface_destroy;
struct wl_listener frame_done; struct wl_listener surface_commit;
struct wl_listener surface_destroy; } WLR_PRIVATE;
struct wl_listener surface_commit;
}; };
/** A scene-graph node displaying a solid-colored rectangle */ /** A scene-graph node displaying a solid-colored rectangle */
@ -185,21 +185,21 @@ struct wlr_scene_buffer {
enum wl_output_transform transform; enum wl_output_transform transform;
pixman_region32_t opaque_region; pixman_region32_t opaque_region;
// private state struct {
uint64_t active_outputs;
struct wlr_texture *texture;
struct wlr_linux_dmabuf_feedback_v1_init_options prev_feedback_options;
uint64_t active_outputs; bool own_buffer;
struct wlr_texture *texture; int buffer_width, buffer_height;
struct wlr_linux_dmabuf_feedback_v1_init_options prev_feedback_options; bool buffer_is_opaque;
bool own_buffer; struct wlr_drm_syncobj_timeline *wait_timeline;
int buffer_width, buffer_height; uint64_t wait_point;
bool buffer_is_opaque;
struct wlr_drm_syncobj_timeline *wait_timeline; struct wl_listener buffer_release;
uint64_t wait_point; struct wl_listener renderer_destroy;
} WLR_PRIVATE;
struct wl_listener buffer_release;
struct wl_listener renderer_destroy;
}; };
/** A viewport for an output in the scene-graph */ /** A viewport for an output in the scene-graph */
@ -217,26 +217,26 @@ struct wlr_scene_output {
struct wl_signal destroy; struct wl_signal destroy;
} events; } events;
// private state struct {
pixman_region32_t pending_commit_damage;
pixman_region32_t pending_commit_damage; uint8_t index;
bool prev_scanout;
uint8_t index; bool gamma_lut_changed;
bool prev_scanout; struct wlr_gamma_control_v1 *gamma_lut;
bool gamma_lut_changed; struct wl_listener output_commit;
struct wlr_gamma_control_v1 *gamma_lut; struct wl_listener output_damage;
struct wl_listener output_needs_frame;
struct wl_listener output_commit; struct wl_list damage_highlight_regions;
struct wl_listener output_damage;
struct wl_listener output_needs_frame;
struct wl_list damage_highlight_regions; struct wl_array render_list;
struct wl_array render_list; struct wlr_drm_syncobj_timeline *in_timeline;
uint64_t in_point;
struct wlr_drm_syncobj_timeline *in_timeline; } WLR_PRIVATE;
uint64_t in_point;
}; };
struct wlr_scene_timer { struct wlr_scene_timer {
@ -249,12 +249,12 @@ struct wlr_scene_layer_surface_v1 {
struct wlr_scene_tree *tree; struct wlr_scene_tree *tree;
struct wlr_layer_surface_v1 *layer_surface; struct wlr_layer_surface_v1 *layer_surface;
// private state struct {
struct wl_listener tree_destroy;
struct wl_listener tree_destroy; struct wl_listener layer_surface_destroy;
struct wl_listener layer_surface_destroy; struct wl_listener layer_surface_map;
struct wl_listener layer_surface_map; struct wl_listener layer_surface_unmap;
struct wl_listener layer_surface_unmap; } WLR_PRIVATE;
}; };
/** /**

View File

@ -28,11 +28,11 @@ struct wlr_security_context_manager_v1 {
void *data; void *data;
// private state struct {
struct wl_list contexts; // wlr_security_context_v1.link
struct wl_list contexts; // wlr_security_context_v1.link struct wl_listener display_destroy;
} WLR_PRIVATE;
struct wl_listener display_destroy;
}; };
struct wlr_security_context_v1_state { struct wlr_security_context_v1_state {

View File

@ -24,9 +24,9 @@ struct wlr_session_lock_manager_v1 {
void *data; void *data;
// private state struct {
struct wl_listener display_destroy;
struct wl_listener display_destroy; } WLR_PRIVATE;
}; };
struct wlr_session_lock_v1 { struct wlr_session_lock_v1 {
@ -42,9 +42,9 @@ struct wlr_session_lock_v1 {
void *data; void *data;
// private state struct {
bool locked_sent;
bool locked_sent; } WLR_PRIVATE;
}; };
struct wlr_session_lock_surface_v1_state { struct wlr_session_lock_surface_v1_state {
@ -79,11 +79,11 @@ struct wlr_session_lock_surface_v1 {
void *data; void *data;
// private state struct {
struct wlr_surface_synced synced;
struct wlr_surface_synced synced; struct wl_listener output_destroy;
} WLR_PRIVATE;
struct wl_listener output_destroy;
}; };
struct wlr_session_lock_manager_v1 *wlr_session_lock_manager_v1_create( struct wlr_session_lock_manager_v1 *wlr_session_lock_manager_v1_create(

View File

@ -25,12 +25,12 @@ struct wlr_renderer;
struct wlr_shm { struct wlr_shm {
struct wl_global *global; struct wl_global *global;
// private state struct {
uint32_t *formats;
size_t formats_len;
uint32_t *formats; struct wl_listener display_destroy;
size_t formats_len; } WLR_PRIVATE;
struct wl_listener display_destroy;
}; };
/** /**

View File

@ -14,9 +14,9 @@
struct wlr_single_pixel_buffer_manager_v1 { struct wlr_single_pixel_buffer_manager_v1 {
struct wl_global *global; struct wl_global *global;
// private state struct {
struct wl_listener display_destroy;
struct wl_listener display_destroy; } WLR_PRIVATE;
}; };

View File

@ -23,9 +23,9 @@ struct wlr_subsurface_parent_state {
int32_t x, y; int32_t x, y;
struct wl_list link; struct wl_list link;
// private state struct {
struct wlr_surface_synced *synced;
struct wlr_surface_synced *synced; } WLR_PRIVATE;
}; };
struct wlr_subsurface { struct wlr_subsurface {
@ -50,9 +50,9 @@ struct wlr_subsurface {
void *data; void *data;
// private state struct {
struct wlr_surface_synced parent_synced;
struct wlr_surface_synced parent_synced; } WLR_PRIVATE;
}; };
struct wlr_subcompositor { struct wlr_subcompositor {

View File

@ -30,13 +30,13 @@ struct wlr_tearing_control_v1 {
struct wlr_surface *surface; struct wlr_surface *surface;
// private state struct {
enum wp_tearing_control_v1_presentation_hint previous;
struct wlr_addon addon;
struct wlr_surface_synced synced;
enum wp_tearing_control_v1_presentation_hint previous; struct wl_listener surface_commit;
struct wlr_addon addon; } WLR_PRIVATE;
struct wlr_surface_synced synced;
struct wl_listener surface_commit;
}; };
struct wlr_tearing_control_manager_v1 { struct wlr_tearing_control_manager_v1 {

View File

@ -17,8 +17,9 @@ struct wlr_transient_seat_v1 {
struct wl_resource *resource; struct wl_resource *resource;
struct wlr_seat *seat; struct wlr_seat *seat;
// private state struct {
struct wl_listener seat_destroy; struct wl_listener seat_destroy;
} WLR_PRIVATE;
}; };
struct wlr_transient_seat_manager_v1 { struct wlr_transient_seat_manager_v1 {

View File

@ -28,14 +28,14 @@ struct wlr_xdg_activation_token_v1 {
struct wl_signal destroy; struct wl_signal destroy;
} events; } events;
// private state struct {
char *token;
struct wl_resource *resource; // can be NULL
struct wl_event_source *timeout; // can be NULL
char *token; struct wl_listener seat_destroy;
struct wl_resource *resource; // can be NULL struct wl_listener surface_destroy;
struct wl_event_source *timeout; // can be NULL } WLR_PRIVATE;
struct wl_listener seat_destroy;
struct wl_listener surface_destroy;
}; };
struct wlr_xdg_activation_v1 { struct wlr_xdg_activation_v1 {
@ -49,13 +49,12 @@ struct wlr_xdg_activation_v1 {
struct wl_signal new_token; // struct wlr_xdg_activation_token_v1 struct wl_signal new_token; // struct wlr_xdg_activation_token_v1
} events; } events;
// private state struct {
struct wl_display *display;
struct wl_global *global;
struct wl_display *display; struct wl_listener display_destroy;
} WLR_PRIVATE;
struct wl_global *global;
struct wl_listener display_destroy;
}; };
struct wlr_xdg_activation_v1_request_activate_event { struct wlr_xdg_activation_v1_request_activate_event {

View File

@ -54,13 +54,13 @@ struct wlr_xdg_toplevel_decoration_v1 {
void *data; void *data;
// private state struct {
struct wl_listener toplevel_destroy;
struct wl_listener surface_configure;
struct wl_listener surface_ack_configure;
struct wl_listener toplevel_destroy; struct wlr_surface_synced synced;
struct wl_listener surface_configure; } WLR_PRIVATE;
struct wl_listener surface_ack_configure;
struct wlr_surface_synced synced;
}; };
struct wlr_xdg_decoration_manager_v1 * struct wlr_xdg_decoration_manager_v1 *

View File

@ -110,9 +110,9 @@ struct wlr_xdg_popup {
struct wl_list grab_link; // wlr_xdg_popup_grab.popups struct wl_list grab_link; // wlr_xdg_popup_grab.popups
// private state struct {
struct wlr_surface_synced synced;
struct wlr_surface_synced synced; } WLR_PRIVATE;
}; };
// each seat gets a popup grab // each seat gets a popup grab
@ -221,9 +221,9 @@ struct wlr_xdg_toplevel {
struct wl_signal set_app_id; struct wl_signal set_app_id;
} events; } events;
// private state struct {
struct wlr_surface_synced synced;
struct wlr_surface_synced synced; } WLR_PRIVATE;
}; };
struct wlr_xdg_surface_configure { struct wlr_xdg_surface_configure {
@ -304,11 +304,11 @@ struct wlr_xdg_surface {
void *data; void *data;
// private state struct {
struct wlr_surface_synced synced;
struct wlr_surface_synced synced; struct wl_listener role_resource_destroy;
} WLR_PRIVATE;
struct wl_listener role_resource_destroy;
}; };
struct wlr_xdg_toplevel_move_event { struct wlr_xdg_toplevel_move_event {

View File

@ -12,8 +12,9 @@
#include <wayland-server-core.h> #include <wayland-server-core.h>
struct wlr_addon_set { struct wlr_addon_set {
// private state struct {
struct wl_list addons; struct wl_list addons;
} WLR_PRIVATE;
}; };
struct wlr_addon; struct wlr_addon;
@ -26,9 +27,11 @@ struct wlr_addon_interface {
struct wlr_addon { struct wlr_addon {
const struct wlr_addon_interface *impl; const struct wlr_addon_interface *impl;
// private state
const void *owner; struct {
struct wl_list link; const void *owner;
struct wl_list link;
} WLR_PRIVATE;
}; };
void wlr_addon_set_init(struct wlr_addon_set *set); void wlr_addon_set_init(struct wlr_addon_set *set);

View File

@ -25,13 +25,13 @@ struct wlr_xwayland_shell_v1 {
struct wl_signal new_surface; // struct wlr_xwayland_surface_v1 struct wl_signal new_surface; // struct wlr_xwayland_surface_v1
} events; } events;
// private state struct {
struct wl_client *client;
struct wl_list surfaces; // wlr_xwayland_surface_v1.link
struct wl_client *client; struct wl_listener display_destroy;
struct wl_list surfaces; // wlr_xwayland_surface_v1.link struct wl_listener client_destroy;
} WLR_PRIVATE;
struct wl_listener display_destroy;
struct wl_listener client_destroy;
}; };
/** /**
@ -41,12 +41,12 @@ struct wlr_xwayland_surface_v1 {
struct wlr_surface *surface; struct wlr_surface *surface;
uint64_t serial; uint64_t serial;
// private state struct {
struct wl_resource *resource;
struct wl_resource *resource; struct wl_list link;
struct wl_list link; struct wlr_xwayland_shell_v1 *shell;
struct wlr_xwayland_shell_v1 *shell; bool added;
bool added; } WLR_PRIVATE;
}; };
/** /**

View File

@ -65,13 +65,13 @@ struct wlr_xwayland {
void *data; void *data;
// private state struct {
struct wl_listener server_start;
struct wl_listener server_start; struct wl_listener server_ready;
struct wl_listener server_ready; struct wl_listener server_destroy;
struct wl_listener server_destroy; struct wl_listener seat_destroy;
struct wl_listener seat_destroy; struct wl_listener shell_destroy;
struct wl_listener shell_destroy; } WLR_PRIVATE;
}; };
enum wlr_xwayland_surface_decorations { enum wlr_xwayland_surface_decorations {

View File

@ -22,6 +22,7 @@ big_endian = target_machine.endian() == 'big'
add_project_arguments([ add_project_arguments([
'-D_POSIX_C_SOURCE=200809L', '-D_POSIX_C_SOURCE=200809L',
'-DWLR_USE_UNSTABLE', '-DWLR_USE_UNSTABLE',
'-DWLR_PRIVATE=',
'-DWLR_LITTLE_ENDIAN=@0@'.format(little_endian.to_int()), '-DWLR_LITTLE_ENDIAN=@0@'.format(little_endian.to_int()),
'-DWLR_BIG_ENDIAN=@0@'.format(big_endian.to_int()), '-DWLR_BIG_ENDIAN=@0@'.format(big_endian.to_int()),
], language: 'c') ], language: 'c')