diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3d13f5fb..f740c935 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -237,6 +237,13 @@ used and `#undef` them after. * Document the contents and container of a `struct wl_list` with a `// 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 * 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_listener display_destroy; - struct { struct wl_signal new_surface; struct wl_signal destroy; } events; + + struct { + struct wl_listener display_destroy; + } WLR_PRIVATE; }; ``` diff --git a/include/wlr/render/drm_syncobj.h b/include/wlr/render/drm_syncobj.h index bf406d87..b847dbd2 100644 --- a/include/wlr/render/drm_syncobj.h +++ b/include/wlr/render/drm_syncobj.h @@ -29,9 +29,9 @@ struct wlr_drm_syncobj_timeline { int drm_fd; uint32_t handle; - // private state - - size_t n_refs; + struct { + size_t n_refs; + } WLR_PRIVATE; }; struct wlr_drm_syncobj_timeline_waiter { @@ -39,10 +39,10 @@ struct wlr_drm_syncobj_timeline_waiter { struct wl_signal ready; } events; - // private state - - int ev_fd; - struct wl_event_source *event_source; + struct { + int ev_fd; + struct wl_event_source *event_source; + } WLR_PRIVATE; }; /** diff --git a/include/wlr/render/wlr_renderer.h b/include/wlr/render/wlr_renderer.h index 4a8ccd39..debeb4e2 100644 --- a/include/wlr/render/wlr_renderer.h +++ b/include/wlr/render/wlr_renderer.h @@ -53,9 +53,9 @@ struct wlr_renderer { bool timeline; } features; - // private state - - const struct wlr_renderer_impl *impl; + struct { + const struct wlr_renderer_impl *impl; + } WLR_PRIVATE; }; /** diff --git a/include/wlr/types/wlr_alpha_modifier_v1.h b/include/wlr/types/wlr_alpha_modifier_v1.h index e400f4e5..f70191bb 100644 --- a/include/wlr/types/wlr_alpha_modifier_v1.h +++ b/include/wlr/types/wlr_alpha_modifier_v1.h @@ -20,9 +20,9 @@ struct wlr_alpha_modifier_surface_v1_state { struct wlr_alpha_modifier_v1 { struct wl_global *global; - // private state - - struct wl_listener display_destroy; + struct { + struct wl_listener display_destroy; + } WLR_PRIVATE; }; struct wlr_alpha_modifier_v1 *wlr_alpha_modifier_v1_create(struct wl_display *display); diff --git a/include/wlr/types/wlr_buffer.h b/include/wlr/types/wlr_buffer.h index 9a655dd2..874edf82 100644 --- a/include/wlr/types/wlr_buffer.h +++ b/include/wlr/types/wlr_buffer.h @@ -148,12 +148,12 @@ struct wlr_client_buffer { */ struct wlr_buffer *source; - // private state - - struct wl_listener source_destroy; - struct wl_listener renderer_destroy; + struct { + struct wl_listener source_destroy; + struct wl_listener renderer_destroy; - size_t n_ignore_locks; + size_t n_ignore_locks; + } WLR_PRIVATE; }; /** diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h index 6ba8d8a0..291e470c 100644 --- a/include/wlr/types/wlr_compositor.h +++ b/include/wlr/types/wlr_compositor.h @@ -236,33 +236,33 @@ struct wlr_surface { struct wlr_addon_set addons; void *data; - // private state - - struct wl_listener role_resource_destroy; - struct { - int32_t scale; - enum wl_output_transform transform; - int width, height; - int buffer_width, buffer_height; - } previous; + struct wl_listener role_resource_destroy; + + struct { + int32_t scale; + enum wl_output_transform transform; + int width, height; + int buffer_width, buffer_height; + } previous; - bool unmap_commit; + bool unmap_commit; - bool opaque; + bool opaque; - bool handling_commit; - bool pending_rejected; + bool handling_commit; + bool pending_rejected; - int32_t preferred_buffer_scale; - bool preferred_buffer_transform_sent; - enum wl_output_transform preferred_buffer_transform; + int32_t preferred_buffer_scale; + bool preferred_buffer_transform_sent; + enum wl_output_transform preferred_buffer_transform; - struct wl_list synced; // wlr_surface_synced.link - size_t synced_len; + struct wl_list synced; // wlr_surface_synced.link + size_t synced_len; - struct wl_resource *pending_buffer_resource; - struct wl_listener pending_buffer_resource_destroy; + struct wl_resource *pending_buffer_resource; + struct wl_listener pending_buffer_resource_destroy; + } WLR_PRIVATE; }; struct wlr_renderer; diff --git a/include/wlr/types/wlr_content_type_v1.h b/include/wlr/types/wlr_content_type_v1.h index 6fa13d9b..31c51ac4 100644 --- a/include/wlr/types/wlr_content_type_v1.h +++ b/include/wlr/types/wlr_content_type_v1.h @@ -23,9 +23,9 @@ struct wlr_content_type_manager_v1 { void *data; - // private state - - struct wl_listener display_destroy; + struct { + struct wl_listener display_destroy; + } WLR_PRIVATE; }; struct wlr_content_type_manager_v1 *wlr_content_type_manager_v1_create( diff --git a/include/wlr/types/wlr_cursor_shape_v1.h b/include/wlr/types/wlr_cursor_shape_v1.h index 55818c86..26048a52 100644 --- a/include/wlr/types/wlr_cursor_shape_v1.h +++ b/include/wlr/types/wlr_cursor_shape_v1.h @@ -28,9 +28,9 @@ struct wlr_cursor_shape_manager_v1 { void *data; - // private state - - struct wl_listener display_destroy; + struct { + struct wl_listener display_destroy; + } WLR_PRIVATE; }; enum wlr_cursor_shape_manager_v1_device_type { diff --git a/include/wlr/types/wlr_damage_ring.h b/include/wlr/types/wlr_damage_ring.h index 17f5bfe8..feb64777 100644 --- a/include/wlr/types/wlr_damage_ring.h +++ b/include/wlr/types/wlr_damage_ring.h @@ -30,9 +30,9 @@ struct wlr_damage_ring { // Difference between the current buffer and the previous one pixman_region32_t current; - // private state - - struct wl_list buffers; // wlr_damage_ring_buffer.link + struct { + struct wl_list buffers; // wlr_damage_ring_buffer.link + } WLR_PRIVATE; }; void wlr_damage_ring_init(struct wlr_damage_ring *ring); diff --git a/include/wlr/types/wlr_drm.h b/include/wlr/types/wlr_drm.h index b2a5ce5a..a256a8de 100644 --- a/include/wlr/types/wlr_drm.h +++ b/include/wlr/types/wlr_drm.h @@ -40,12 +40,12 @@ struct wlr_drm { struct wl_signal destroy; } events; - // private state - - char *node_name; - struct wlr_drm_format_set formats; + struct { + char *node_name; + struct wlr_drm_format_set formats; - struct wl_listener display_destroy; + struct wl_listener display_destroy; + } WLR_PRIVATE; }; struct wlr_drm_buffer *wlr_drm_buffer_try_from_resource( diff --git a/include/wlr/types/wlr_foreign_toplevel_management_v1.h b/include/wlr/types/wlr_foreign_toplevel_management_v1.h index c4abcb3d..499d4038 100644 --- a/include/wlr/types/wlr_foreign_toplevel_management_v1.h +++ b/include/wlr/types/wlr_foreign_toplevel_management_v1.h @@ -39,10 +39,10 @@ struct wlr_foreign_toplevel_handle_v1_output { struct wlr_output *output; struct wlr_foreign_toplevel_handle_v1 *toplevel; - // private state - - struct wl_listener output_bind; - struct wl_listener output_destroy; + struct { + struct wl_listener output_bind; + struct wl_listener output_destroy; + } WLR_PRIVATE; }; struct wlr_foreign_toplevel_handle_v1 { diff --git a/include/wlr/types/wlr_fractional_scale_v1.h b/include/wlr/types/wlr_fractional_scale_v1.h index 9126360d..09214eb8 100644 --- a/include/wlr/types/wlr_fractional_scale_v1.h +++ b/include/wlr/types/wlr_fractional_scale_v1.h @@ -20,9 +20,9 @@ struct wlr_fractional_scale_manager_v1 { struct wl_signal destroy; } events; - // private state - - struct wl_listener display_destroy; + struct { + struct wl_listener display_destroy; + } WLR_PRIVATE; }; void wlr_fractional_scale_v1_notify_scale( diff --git a/include/wlr/types/wlr_idle_notify_v1.h b/include/wlr/types/wlr_idle_notify_v1.h index 8dea0804..508c0cb7 100644 --- a/include/wlr/types/wlr_idle_notify_v1.h +++ b/include/wlr/types/wlr_idle_notify_v1.h @@ -19,12 +19,12 @@ struct wlr_seat; struct wlr_idle_notifier_v1 { struct wl_global *global; - // private state + struct { + bool inhibited; + struct wl_list notifications; // wlr_idle_notification_v1.link - bool inhibited; - struct wl_list notifications; // wlr_idle_notification_v1.link - - struct wl_listener display_destroy; + struct wl_listener display_destroy; + } WLR_PRIVATE; }; diff --git a/include/wlr/types/wlr_layer_shell_v1.h b/include/wlr/types/wlr_layer_shell_v1.h index 9be246e1..d46f9b9c 100644 --- a/include/wlr/types/wlr_layer_shell_v1.h +++ b/include/wlr/types/wlr_layer_shell_v1.h @@ -114,9 +114,9 @@ struct wlr_layer_surface_v1 { void *data; - // private state - - struct wlr_surface_synced synced; + struct { + struct wlr_surface_synced synced; + } WLR_PRIVATE; }; struct wlr_layer_shell_v1 *wlr_layer_shell_v1_create(struct wl_display *display, diff --git a/include/wlr/types/wlr_linux_dmabuf_v1.h b/include/wlr/types/wlr_linux_dmabuf_v1.h index cf967f95..2193f914 100644 --- a/include/wlr/types/wlr_linux_dmabuf_v1.h +++ b/include/wlr/types/wlr_linux_dmabuf_v1.h @@ -24,9 +24,9 @@ struct wlr_dmabuf_v1_buffer { struct wl_resource *resource; // can be NULL if the client destroyed it struct wlr_dmabuf_attributes attributes; - // private state - - struct wl_listener release; + struct { + struct wl_listener release; + } WLR_PRIVATE; }; /** @@ -55,18 +55,18 @@ struct wlr_linux_dmabuf_v1 { struct wl_signal destroy; } events; - // private state - - 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 { + 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 - int main_device_fd; // to sanity check FDs sent by clients, -1 if unavailable + 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); + void *check_dmabuf_callback_data; + } WLR_PRIVATE; }; /** diff --git a/include/wlr/types/wlr_linux_drm_syncobj_v1.h b/include/wlr/types/wlr_linux_drm_syncobj_v1.h index 02cdb42a..73335041 100644 --- a/include/wlr/types/wlr_linux_drm_syncobj_v1.h +++ b/include/wlr/types/wlr_linux_drm_syncobj_v1.h @@ -26,11 +26,11 @@ struct wlr_linux_drm_syncobj_surface_v1_state { struct wlr_linux_drm_syncobj_manager_v1 { struct wl_global *global; - // private state + struct { + int drm_fd; - int drm_fd; - - struct wl_listener display_destroy; + struct wl_listener display_destroy; + } WLR_PRIVATE; }; /** diff --git a/include/wlr/types/wlr_output_layer.h b/include/wlr/types/wlr_output_layer.h index 461e13dd..af59ab8d 100644 --- a/include/wlr/types/wlr_output_layer.h +++ b/include/wlr/types/wlr_output_layer.h @@ -50,10 +50,10 @@ struct wlr_output_layer { void *data; - // private state - - struct wlr_fbox src_box; - struct wlr_box dst_box; + struct { + struct wlr_fbox src_box; + struct wlr_box dst_box; + } WLR_PRIVATE; }; /** diff --git a/include/wlr/types/wlr_output_layout.h b/include/wlr/types/wlr_output_layout.h index 40c7fb93..f2cbc637 100644 --- a/include/wlr/types/wlr_output_layout.h +++ b/include/wlr/types/wlr_output_layout.h @@ -36,9 +36,9 @@ struct wlr_output_layout { void *data; - // private state - - struct wl_listener display_destroy; + struct { + struct wl_listener display_destroy; + } WLR_PRIVATE; }; struct wlr_output_layout_output { @@ -55,11 +55,11 @@ struct wlr_output_layout_output { struct wl_signal destroy; } events; - // private state - - struct wlr_addon addon; + struct { + struct wlr_addon addon; - struct wl_listener commit; + struct wl_listener commit; + } WLR_PRIVATE; }; struct wlr_output_layout *wlr_output_layout_create(struct wl_display *display); diff --git a/include/wlr/types/wlr_output_swapchain_manager.h b/include/wlr/types/wlr_output_swapchain_manager.h index 24a5578e..3ea9c49b 100644 --- a/include/wlr/types/wlr_output_swapchain_manager.h +++ b/include/wlr/types/wlr_output_swapchain_manager.h @@ -30,9 +30,9 @@ struct wlr_backend_output_state; struct wlr_output_swapchain_manager { struct wlr_backend *backend; - // private state - - struct wl_array outputs; // struct wlr_output_swapchain_manager_output + struct { + struct wl_array outputs; // struct wlr_output_swapchain_manager_output + } WLR_PRIVATE; }; /** diff --git a/include/wlr/types/wlr_pointer_constraints_v1.h b/include/wlr/types/wlr_pointer_constraints_v1.h index 2b4722f7..75dddb81 100644 --- a/include/wlr/types/wlr_pointer_constraints_v1.h +++ b/include/wlr/types/wlr_pointer_constraints_v1.h @@ -64,13 +64,13 @@ struct wlr_pointer_constraint_v1 { void *data; - // private state - - struct wl_listener surface_commit; - struct wl_listener surface_destroy; - struct wl_listener seat_destroy; + struct { + struct wl_listener surface_commit; + struct wl_listener surface_destroy; + struct wl_listener seat_destroy; - struct wlr_surface_synced synced; + struct wlr_surface_synced synced; + } WLR_PRIVATE; }; struct wlr_pointer_constraints_v1 { diff --git a/include/wlr/types/wlr_scene.h b/include/wlr/types/wlr_scene.h index bcfbc72f..dbca35e7 100644 --- a/include/wlr/types/wlr_scene.h +++ b/include/wlr/types/wlr_scene.h @@ -75,9 +75,9 @@ struct wlr_scene_node { struct wlr_addon_set addons; - // private state - - pixman_region32_t visible; + struct { + pixman_region32_t visible; + } WLR_PRIVATE; }; enum wlr_scene_debug_damage_option { @@ -103,16 +103,16 @@ struct wlr_scene { struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1; struct wlr_gamma_control_manager_v1 *gamma_control_manager_v1; - // private state - - struct wl_listener linux_dmabuf_v1_destroy; - struct wl_listener gamma_control_manager_v1_destroy; - struct wl_listener gamma_control_manager_v1_set_gamma; - - enum wlr_scene_debug_damage_option debug_damage_option; - bool direct_scanout; - bool calculate_visibility; - bool highlight_transparent_region; + 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; + + enum wlr_scene_debug_damage_option debug_damage_option; + bool direct_scanout; + bool calculate_visibility; + bool highlight_transparent_region; + } WLR_PRIVATE; }; /** A scene-graph node displaying a single surface. */ @@ -120,19 +120,19 @@ struct wlr_scene_surface { struct wlr_scene_buffer *buffer; struct wlr_surface *surface; - // private state - - struct wlr_box clip; - - struct wlr_addon addon; - - struct wl_listener outputs_update; - struct wl_listener output_enter; - struct wl_listener output_leave; - struct wl_listener output_sample; - struct wl_listener frame_done; - struct wl_listener surface_destroy; - struct wl_listener surface_commit; + struct { + struct wlr_box clip; + + struct wlr_addon addon; + + struct wl_listener outputs_update; + struct wl_listener output_enter; + struct wl_listener output_leave; + struct wl_listener output_sample; + struct wl_listener frame_done; + struct wl_listener surface_destroy; + struct wl_listener surface_commit; + } WLR_PRIVATE; }; /** A scene-graph node displaying a solid-colored rectangle */ @@ -185,21 +185,21 @@ struct wlr_scene_buffer { enum wl_output_transform transform; pixman_region32_t opaque_region; - // private state - - uint64_t active_outputs; - struct wlr_texture *texture; - struct wlr_linux_dmabuf_feedback_v1_init_options prev_feedback_options; + struct { + uint64_t active_outputs; + struct wlr_texture *texture; + struct wlr_linux_dmabuf_feedback_v1_init_options prev_feedback_options; - bool own_buffer; - int buffer_width, buffer_height; - bool buffer_is_opaque; + bool own_buffer; + int buffer_width, buffer_height; + bool buffer_is_opaque; - struct wlr_drm_syncobj_timeline *wait_timeline; - uint64_t wait_point; + struct wlr_drm_syncobj_timeline *wait_timeline; + uint64_t wait_point; - struct wl_listener buffer_release; - struct wl_listener renderer_destroy; + struct wl_listener buffer_release; + struct wl_listener renderer_destroy; + } WLR_PRIVATE; }; /** A viewport for an output in the scene-graph */ @@ -217,26 +217,26 @@ struct wlr_scene_output { struct wl_signal destroy; } events; - // private state - - pixman_region32_t pending_commit_damage; + struct { + pixman_region32_t pending_commit_damage; - uint8_t index; - bool prev_scanout; + uint8_t index; + bool prev_scanout; - bool gamma_lut_changed; - struct wlr_gamma_control_v1 *gamma_lut; + bool gamma_lut_changed; + struct wlr_gamma_control_v1 *gamma_lut; - struct wl_listener output_commit; - struct wl_listener output_damage; - struct wl_listener output_needs_frame; + struct wl_listener output_commit; + struct wl_listener output_damage; + struct wl_listener output_needs_frame; - struct wl_list damage_highlight_regions; + 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; + uint64_t in_point; + } WLR_PRIVATE; }; struct wlr_scene_timer { @@ -249,12 +249,12 @@ struct wlr_scene_layer_surface_v1 { struct wlr_scene_tree *tree; struct wlr_layer_surface_v1 *layer_surface; - // private state - - struct wl_listener tree_destroy; - struct wl_listener layer_surface_destroy; - struct wl_listener layer_surface_map; - struct wl_listener layer_surface_unmap; + struct { + struct wl_listener tree_destroy; + struct wl_listener layer_surface_destroy; + struct wl_listener layer_surface_map; + struct wl_listener layer_surface_unmap; + } WLR_PRIVATE; }; /** diff --git a/include/wlr/types/wlr_security_context_v1.h b/include/wlr/types/wlr_security_context_v1.h index f932a2b1..40bb7a29 100644 --- a/include/wlr/types/wlr_security_context_v1.h +++ b/include/wlr/types/wlr_security_context_v1.h @@ -28,11 +28,11 @@ struct wlr_security_context_manager_v1 { void *data; - // private state - - struct wl_list contexts; // wlr_security_context_v1.link + struct { + struct wl_list contexts; // wlr_security_context_v1.link - struct wl_listener display_destroy; + struct wl_listener display_destroy; + } WLR_PRIVATE; }; struct wlr_security_context_v1_state { diff --git a/include/wlr/types/wlr_session_lock_v1.h b/include/wlr/types/wlr_session_lock_v1.h index 058bf0d7..2e9d80a9 100644 --- a/include/wlr/types/wlr_session_lock_v1.h +++ b/include/wlr/types/wlr_session_lock_v1.h @@ -24,9 +24,9 @@ struct wlr_session_lock_manager_v1 { void *data; - // private state - - struct wl_listener display_destroy; + struct { + struct wl_listener display_destroy; + } WLR_PRIVATE; }; struct wlr_session_lock_v1 { @@ -42,9 +42,9 @@ struct wlr_session_lock_v1 { void *data; - // private state - - bool locked_sent; + struct { + bool locked_sent; + } WLR_PRIVATE; }; struct wlr_session_lock_surface_v1_state { @@ -79,11 +79,11 @@ struct wlr_session_lock_surface_v1 { void *data; - // private state - - struct wlr_surface_synced synced; + struct { + struct wlr_surface_synced synced; - struct wl_listener output_destroy; + struct wl_listener output_destroy; + } WLR_PRIVATE; }; struct wlr_session_lock_manager_v1 *wlr_session_lock_manager_v1_create( diff --git a/include/wlr/types/wlr_shm.h b/include/wlr/types/wlr_shm.h index 13a5ca5c..650b7ffd 100644 --- a/include/wlr/types/wlr_shm.h +++ b/include/wlr/types/wlr_shm.h @@ -25,12 +25,12 @@ struct wlr_renderer; struct wlr_shm { struct wl_global *global; - // private state + struct { + uint32_t *formats; + size_t formats_len; - uint32_t *formats; - size_t formats_len; - - struct wl_listener display_destroy; + struct wl_listener display_destroy; + } WLR_PRIVATE; }; /** diff --git a/include/wlr/types/wlr_single_pixel_buffer_v1.h b/include/wlr/types/wlr_single_pixel_buffer_v1.h index 3836203f..64018a86 100644 --- a/include/wlr/types/wlr_single_pixel_buffer_v1.h +++ b/include/wlr/types/wlr_single_pixel_buffer_v1.h @@ -14,9 +14,9 @@ struct wlr_single_pixel_buffer_manager_v1 { struct wl_global *global; - // private state - - struct wl_listener display_destroy; + struct { + struct wl_listener display_destroy; + } WLR_PRIVATE; }; diff --git a/include/wlr/types/wlr_subcompositor.h b/include/wlr/types/wlr_subcompositor.h index 61a2cccc..26be0295 100644 --- a/include/wlr/types/wlr_subcompositor.h +++ b/include/wlr/types/wlr_subcompositor.h @@ -23,9 +23,9 @@ struct wlr_subsurface_parent_state { int32_t x, y; struct wl_list link; - // private state - - struct wlr_surface_synced *synced; + struct { + struct wlr_surface_synced *synced; + } WLR_PRIVATE; }; struct wlr_subsurface { @@ -50,9 +50,9 @@ struct wlr_subsurface { void *data; - // private state - - struct wlr_surface_synced parent_synced; + struct { + struct wlr_surface_synced parent_synced; + } WLR_PRIVATE; }; struct wlr_subcompositor { diff --git a/include/wlr/types/wlr_tearing_control_v1.h b/include/wlr/types/wlr_tearing_control_v1.h index 76c5c600..ddcb22bc 100644 --- a/include/wlr/types/wlr_tearing_control_v1.h +++ b/include/wlr/types/wlr_tearing_control_v1.h @@ -30,13 +30,13 @@ struct wlr_tearing_control_v1 { struct wlr_surface *surface; - // private state - - enum wp_tearing_control_v1_presentation_hint previous; - struct wlr_addon addon; - struct wlr_surface_synced synced; + struct { + enum wp_tearing_control_v1_presentation_hint previous; + struct wlr_addon addon; + struct wlr_surface_synced synced; - struct wl_listener surface_commit; + struct wl_listener surface_commit; + } WLR_PRIVATE; }; struct wlr_tearing_control_manager_v1 { diff --git a/include/wlr/types/wlr_transient_seat_v1.h b/include/wlr/types/wlr_transient_seat_v1.h index 84d419bc..b0d329fd 100644 --- a/include/wlr/types/wlr_transient_seat_v1.h +++ b/include/wlr/types/wlr_transient_seat_v1.h @@ -17,8 +17,9 @@ struct wlr_transient_seat_v1 { struct wl_resource *resource; struct wlr_seat *seat; - // private state - struct wl_listener seat_destroy; + struct { + struct wl_listener seat_destroy; + } WLR_PRIVATE; }; struct wlr_transient_seat_manager_v1 { diff --git a/include/wlr/types/wlr_xdg_activation_v1.h b/include/wlr/types/wlr_xdg_activation_v1.h index f7b038b8..6c1d5b8a 100644 --- a/include/wlr/types/wlr_xdg_activation_v1.h +++ b/include/wlr/types/wlr_xdg_activation_v1.h @@ -28,14 +28,14 @@ struct wlr_xdg_activation_token_v1 { struct wl_signal destroy; } events; - // private state - - char *token; - struct wl_resource *resource; // can be NULL - struct wl_event_source *timeout; // can be NULL + struct { + char *token; + struct wl_resource *resource; // can be NULL + struct wl_event_source *timeout; // can be NULL - struct wl_listener seat_destroy; - struct wl_listener surface_destroy; + struct wl_listener seat_destroy; + struct wl_listener surface_destroy; + } WLR_PRIVATE; }; 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 } events; - // private state - - struct wl_display *display; - - struct wl_global *global; + struct { + struct wl_display *display; + struct wl_global *global; - struct wl_listener display_destroy; + struct wl_listener display_destroy; + } WLR_PRIVATE; }; struct wlr_xdg_activation_v1_request_activate_event { diff --git a/include/wlr/types/wlr_xdg_decoration_v1.h b/include/wlr/types/wlr_xdg_decoration_v1.h index f1a8bc5b..24928e91 100644 --- a/include/wlr/types/wlr_xdg_decoration_v1.h +++ b/include/wlr/types/wlr_xdg_decoration_v1.h @@ -54,13 +54,13 @@ struct wlr_xdg_toplevel_decoration_v1 { void *data; - // private state - - struct wl_listener toplevel_destroy; - struct wl_listener surface_configure; - struct wl_listener surface_ack_configure; + struct { + struct wl_listener toplevel_destroy; + struct wl_listener surface_configure; + struct wl_listener surface_ack_configure; - struct wlr_surface_synced synced; + struct wlr_surface_synced synced; + } WLR_PRIVATE; }; struct wlr_xdg_decoration_manager_v1 * diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index 900d504c..723f8adf 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -110,9 +110,9 @@ struct wlr_xdg_popup { struct wl_list grab_link; // wlr_xdg_popup_grab.popups - // private state - - struct wlr_surface_synced synced; + struct { + struct wlr_surface_synced synced; + } WLR_PRIVATE; }; // each seat gets a popup grab @@ -221,9 +221,9 @@ struct wlr_xdg_toplevel { struct wl_signal set_app_id; } events; - // private state - - struct wlr_surface_synced synced; + struct { + struct wlr_surface_synced synced; + } WLR_PRIVATE; }; struct wlr_xdg_surface_configure { @@ -304,11 +304,11 @@ struct wlr_xdg_surface { void *data; - // private state - - struct wlr_surface_synced synced; + struct { + struct wlr_surface_synced synced; - struct wl_listener role_resource_destroy; + struct wl_listener role_resource_destroy; + } WLR_PRIVATE; }; struct wlr_xdg_toplevel_move_event { diff --git a/include/wlr/util/addon.h b/include/wlr/util/addon.h index c64200cf..8819acce 100644 --- a/include/wlr/util/addon.h +++ b/include/wlr/util/addon.h @@ -12,8 +12,9 @@ #include struct wlr_addon_set { - // private state - struct wl_list addons; + struct { + struct wl_list addons; + } WLR_PRIVATE; }; struct wlr_addon; @@ -26,9 +27,11 @@ struct wlr_addon_interface { struct wlr_addon { const struct wlr_addon_interface *impl; - // private state - const void *owner; - struct wl_list link; + + struct { + const void *owner; + struct wl_list link; + } WLR_PRIVATE; }; void wlr_addon_set_init(struct wlr_addon_set *set); diff --git a/include/wlr/xwayland/shell.h b/include/wlr/xwayland/shell.h index da5cb990..344ac220 100644 --- a/include/wlr/xwayland/shell.h +++ b/include/wlr/xwayland/shell.h @@ -25,13 +25,13 @@ struct wlr_xwayland_shell_v1 { struct wl_signal new_surface; // struct wlr_xwayland_surface_v1 } events; - // private state - - struct wl_client *client; - struct wl_list surfaces; // wlr_xwayland_surface_v1.link + struct { + struct wl_client *client; + struct wl_list surfaces; // wlr_xwayland_surface_v1.link - struct wl_listener display_destroy; - struct wl_listener client_destroy; + struct wl_listener display_destroy; + struct wl_listener client_destroy; + } WLR_PRIVATE; }; /** @@ -41,12 +41,12 @@ struct wlr_xwayland_surface_v1 { struct wlr_surface *surface; uint64_t serial; - // private state - - struct wl_resource *resource; - struct wl_list link; - struct wlr_xwayland_shell_v1 *shell; - bool added; + struct { + struct wl_resource *resource; + struct wl_list link; + struct wlr_xwayland_shell_v1 *shell; + bool added; + } WLR_PRIVATE; }; /** diff --git a/include/wlr/xwayland/xwayland.h b/include/wlr/xwayland/xwayland.h index c10ce4cd..339aef0e 100644 --- a/include/wlr/xwayland/xwayland.h +++ b/include/wlr/xwayland/xwayland.h @@ -65,13 +65,13 @@ struct wlr_xwayland { void *data; - // private state - - struct wl_listener server_start; - struct wl_listener server_ready; - struct wl_listener server_destroy; - struct wl_listener seat_destroy; - struct wl_listener shell_destroy; + struct { + struct wl_listener server_start; + struct wl_listener server_ready; + struct wl_listener server_destroy; + struct wl_listener seat_destroy; + struct wl_listener shell_destroy; + } WLR_PRIVATE; }; enum wlr_xwayland_surface_decorations { diff --git a/meson.build b/meson.build index fcc562c8..caee73a4 100644 --- a/meson.build +++ b/meson.build @@ -22,6 +22,7 @@ big_endian = target_machine.endian() == 'big' add_project_arguments([ '-D_POSIX_C_SOURCE=200809L', '-DWLR_USE_UNSTABLE', + '-DWLR_PRIVATE=', '-DWLR_LITTLE_ENDIAN=@0@'.format(little_endian.to_int()), '-DWLR_BIG_ENDIAN=@0@'.format(big_endian.to_int()), ], language: 'c')