mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-28 18:12:30 +00:00
Simplify globals implementation by removing destructors
Some globals are static and it doesn't make sense to destroy them before the wl_display. For instance, wl_compositor should be created before the display is started and shouldn't be destroyed. For these globals, we can simplify the code by removing the destructor and stop keeping track of wl_resources (these will be destroyed with the wl_display by libwayland).
This commit is contained in:
parent
bcd5f7d259
commit
5cde35923c
@ -242,14 +242,12 @@ at least one struct for each interface in the protocol. For instance,
|
|||||||
### Globals
|
### Globals
|
||||||
|
|
||||||
Global interfaces generally have public constructors and destructors. Their
|
Global interfaces generally have public constructors and destructors. Their
|
||||||
struct has a field holding the `wl_global` itself, a list of resources clients
|
struct has a field holding the `wl_global` itself, a destroy signal and a
|
||||||
created by binding to the global, a destroy signal and a `wl_display` destroy
|
`wl_display` destroy listener. Example:
|
||||||
listener. Example:
|
|
||||||
|
|
||||||
```c
|
```c
|
||||||
struct wlr_compositor {
|
struct wlr_compositor {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources;
|
|
||||||
…
|
…
|
||||||
|
|
||||||
struct wl_listener display_destroy;
|
struct wl_listener display_destroy;
|
||||||
@ -262,8 +260,9 @@ struct wlr_compositor {
|
|||||||
```
|
```
|
||||||
|
|
||||||
When the destructor is called, it should emit the destroy signal, remove the
|
When the destructor is called, it should emit the destroy signal, remove the
|
||||||
display destroy listener, destroy the `wl_global`, destroy all bound resources
|
display destroy listener, destroy the `wl_global` and then destroy the struct.
|
||||||
and then destroy the struct.
|
The destructor can assume all clients and resources have been already
|
||||||
|
destroyed.
|
||||||
|
|
||||||
### Resources
|
### Resources
|
||||||
|
|
||||||
|
@ -16,16 +16,11 @@ struct wlr_surface;
|
|||||||
|
|
||||||
struct wlr_subcompositor {
|
struct wlr_subcompositor {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources;
|
|
||||||
struct wl_list subsurface_resources;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_compositor {
|
struct wlr_compositor {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources;
|
|
||||||
struct wlr_renderer *renderer;
|
struct wlr_renderer *renderer;
|
||||||
struct wl_list surface_resources;
|
|
||||||
struct wl_list region_resources;
|
|
||||||
|
|
||||||
struct wlr_subcompositor subcompositor;
|
struct wlr_subcompositor subcompositor;
|
||||||
|
|
||||||
@ -37,7 +32,6 @@ struct wlr_compositor {
|
|||||||
} events;
|
} events;
|
||||||
};
|
};
|
||||||
|
|
||||||
void wlr_compositor_destroy(struct wlr_compositor *wlr_compositor);
|
|
||||||
struct wlr_compositor *wlr_compositor_create(struct wl_display *display,
|
struct wlr_compositor *wlr_compositor_create(struct wl_display *display,
|
||||||
struct wlr_renderer *renderer);
|
struct wlr_renderer *renderer);
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
struct wlr_data_control_manager_v1 {
|
struct wlr_data_control_manager_v1 {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources; // wl_resource_get_link
|
|
||||||
struct wl_list devices; // wlr_data_control_device_v1::link
|
struct wl_list devices; // wlr_data_control_device_v1::link
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@ -41,8 +40,6 @@ struct wlr_data_control_device_v1 {
|
|||||||
|
|
||||||
struct wlr_data_control_manager_v1 *wlr_data_control_manager_v1_create(
|
struct wlr_data_control_manager_v1 *wlr_data_control_manager_v1_create(
|
||||||
struct wl_display *display);
|
struct wl_display *display);
|
||||||
void wlr_data_control_manager_v1_destroy(
|
|
||||||
struct wlr_data_control_manager_v1 *manager);
|
|
||||||
|
|
||||||
void wlr_data_control_device_v1_destroy(
|
void wlr_data_control_device_v1_destroy(
|
||||||
struct wlr_data_control_device_v1 *device);
|
struct wlr_data_control_device_v1 *device);
|
||||||
|
@ -23,7 +23,6 @@ extern const struct wlr_touch_grab_interface
|
|||||||
|
|
||||||
struct wlr_data_device_manager {
|
struct wlr_data_device_manager {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources;
|
|
||||||
struct wl_list data_sources;
|
struct wl_list data_sources;
|
||||||
|
|
||||||
struct wl_listener display_destroy;
|
struct wl_listener display_destroy;
|
||||||
@ -162,11 +161,6 @@ struct wlr_drag_drop_event {
|
|||||||
struct wlr_data_device_manager *wlr_data_device_manager_create(
|
struct wlr_data_device_manager *wlr_data_device_manager_create(
|
||||||
struct wl_display *display);
|
struct wl_display *display);
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroys a wlr_data_device_manager and removes its wl_data_device_manager global.
|
|
||||||
*/
|
|
||||||
void wlr_data_device_manager_destroy(struct wlr_data_device_manager *manager);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests a selection to be set for the seat. If the request comes from
|
* Requests a selection to be set for the seat. If the request comes from
|
||||||
* a client, then set `client` to be the matching seat client so that this
|
* a client, then set `client` to be the matching seat client so that this
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
struct wlr_export_dmabuf_manager_v1 {
|
struct wlr_export_dmabuf_manager_v1 {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources; // wl_resource_get_link
|
|
||||||
struct wl_list frames; // wlr_export_dmabuf_frame_v1::link
|
struct wl_list frames; // wlr_export_dmabuf_frame_v1::link
|
||||||
|
|
||||||
struct wl_listener display_destroy;
|
struct wl_listener display_destroy;
|
||||||
@ -40,7 +39,5 @@ struct wlr_export_dmabuf_frame_v1 {
|
|||||||
|
|
||||||
struct wlr_export_dmabuf_manager_v1 *wlr_export_dmabuf_manager_v1_create(
|
struct wlr_export_dmabuf_manager_v1 *wlr_export_dmabuf_manager_v1_create(
|
||||||
struct wl_display *display);
|
struct wl_display *display);
|
||||||
void wlr_export_dmabuf_manager_v1_destroy(
|
|
||||||
struct wlr_export_dmabuf_manager_v1 *manager);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
struct wlr_foreign_toplevel_manager_v1 {
|
struct wlr_foreign_toplevel_manager_v1 {
|
||||||
struct wl_event_loop *event_loop;
|
struct wl_event_loop *event_loop;
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources;
|
struct wl_list resources; // wl_resource_get_link
|
||||||
struct wl_list toplevels; // wlr_foreign_toplevel_handle_v1::link
|
struct wl_list toplevels; // wlr_foreign_toplevel_handle_v1::link
|
||||||
|
|
||||||
struct wl_listener display_destroy;
|
struct wl_listener display_destroy;
|
||||||
@ -101,8 +101,6 @@ struct wlr_foreign_toplevel_handle_v1_set_rectangle_event {
|
|||||||
|
|
||||||
struct wlr_foreign_toplevel_manager_v1 *wlr_foreign_toplevel_manager_v1_create(
|
struct wlr_foreign_toplevel_manager_v1 *wlr_foreign_toplevel_manager_v1_create(
|
||||||
struct wl_display *display);
|
struct wl_display *display);
|
||||||
void wlr_foreign_toplevel_manager_v1_destroy(
|
|
||||||
struct wlr_foreign_toplevel_manager_v1 *manager);
|
|
||||||
|
|
||||||
struct wlr_foreign_toplevel_handle_v1 *wlr_foreign_toplevel_handle_v1_create(
|
struct wlr_foreign_toplevel_handle_v1 *wlr_foreign_toplevel_handle_v1_create(
|
||||||
struct wlr_foreign_toplevel_manager_v1 *manager);
|
struct wlr_foreign_toplevel_manager_v1 *manager);
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
struct wlr_fullscreen_shell_v1 {
|
struct wlr_fullscreen_shell_v1 {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal destroy;
|
struct wl_signal destroy;
|
||||||
@ -36,6 +35,5 @@ struct wlr_fullscreen_shell_v1_present_surface_event {
|
|||||||
|
|
||||||
struct wlr_fullscreen_shell_v1 *wlr_fullscreen_shell_v1_create(
|
struct wlr_fullscreen_shell_v1 *wlr_fullscreen_shell_v1_create(
|
||||||
struct wl_display *display);
|
struct wl_display *display);
|
||||||
void wlr_fullscreen_shell_v1_destroy(struct wlr_fullscreen_shell_v1 *shell);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
struct wlr_gamma_control_manager_v1 {
|
struct wlr_gamma_control_manager_v1 {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources;
|
|
||||||
struct wl_list controls; // wlr_gamma_control_v1::link
|
struct wl_list controls; // wlr_gamma_control_v1::link
|
||||||
|
|
||||||
struct wl_listener display_destroy;
|
struct wl_listener display_destroy;
|
||||||
@ -29,7 +28,5 @@ struct wlr_gamma_control_v1 {
|
|||||||
|
|
||||||
struct wlr_gamma_control_manager_v1 *wlr_gamma_control_manager_v1_create(
|
struct wlr_gamma_control_manager_v1 *wlr_gamma_control_manager_v1_create(
|
||||||
struct wl_display *display);
|
struct wl_display *display);
|
||||||
void wlr_gamma_control_manager_v1_destroy(
|
|
||||||
struct wlr_gamma_control_manager_v1 *manager);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
*/
|
*/
|
||||||
struct wlr_gtk_primary_selection_device_manager {
|
struct wlr_gtk_primary_selection_device_manager {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources; // wl_resource_get_link
|
|
||||||
struct wl_list devices; // wlr_gtk_primary_selection_device::link
|
struct wl_list devices; // wlr_gtk_primary_selection_device::link
|
||||||
|
|
||||||
struct wl_listener display_destroy;
|
struct wl_listener display_destroy;
|
||||||
@ -54,7 +53,5 @@ struct wlr_gtk_primary_selection_device {
|
|||||||
|
|
||||||
struct wlr_gtk_primary_selection_device_manager *
|
struct wlr_gtk_primary_selection_device_manager *
|
||||||
wlr_gtk_primary_selection_device_manager_create(struct wl_display *display);
|
wlr_gtk_primary_selection_device_manager_create(struct wl_display *display);
|
||||||
void wlr_gtk_primary_selection_device_manager_destroy(
|
|
||||||
struct wlr_gtk_primary_selection_device_manager *manager);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -60,8 +60,6 @@ struct wlr_idle_timeout {
|
|||||||
|
|
||||||
struct wlr_idle *wlr_idle_create(struct wl_display *display);
|
struct wlr_idle *wlr_idle_create(struct wl_display *display);
|
||||||
|
|
||||||
void wlr_idle_destroy(struct wlr_idle *idle);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send notification to restart all timers for the given seat. Called by
|
* Send notification to restart all timers for the given seat. Called by
|
||||||
* compositor when there is an user activity event on that seat.
|
* compositor when there is an user activity event on that seat.
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
struct wlr_idle_inhibit_manager_v1 {
|
struct wlr_idle_inhibit_manager_v1 {
|
||||||
struct wl_list resources; // wl_resource_get_link
|
|
||||||
struct wl_list inhibitors; // wlr_idle_inhibit_inhibitor_v1::link
|
struct wl_list inhibitors; // wlr_idle_inhibit_inhibitor_v1::link
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
|
|
||||||
@ -53,6 +52,5 @@ struct wlr_idle_inhibitor_v1 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_idle_inhibit_manager_v1 *wlr_idle_inhibit_v1_create(struct wl_display *display);
|
struct wlr_idle_inhibit_manager_v1 *wlr_idle_inhibit_v1_create(struct wl_display *display);
|
||||||
void wlr_idle_inhibit_v1_destroy(struct wlr_idle_inhibit_manager_v1 *idle_inhibit);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,7 +28,5 @@ struct wlr_input_inhibit_manager {
|
|||||||
|
|
||||||
struct wlr_input_inhibit_manager *wlr_input_inhibit_manager_create(
|
struct wlr_input_inhibit_manager *wlr_input_inhibit_manager_create(
|
||||||
struct wl_display *display);
|
struct wl_display *display);
|
||||||
void wlr_input_inhibit_manager_destroy(
|
|
||||||
struct wlr_input_inhibit_manager *manager);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,7 +53,6 @@ struct wlr_input_method_v2 {
|
|||||||
|
|
||||||
struct wlr_input_method_manager_v2 {
|
struct wlr_input_method_manager_v2 {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list bound_resources; // struct wl_resource*::link
|
|
||||||
struct wl_list input_methods; // struct wlr_input_method_v2*::link
|
struct wl_list input_methods; // struct wlr_input_method_v2*::link
|
||||||
|
|
||||||
struct wl_listener display_destroy;
|
struct wl_listener display_destroy;
|
||||||
@ -66,8 +65,6 @@ struct wlr_input_method_manager_v2 {
|
|||||||
|
|
||||||
struct wlr_input_method_manager_v2 *wlr_input_method_manager_v2_create(
|
struct wlr_input_method_manager_v2 *wlr_input_method_manager_v2_create(
|
||||||
struct wl_display *display);
|
struct wl_display *display);
|
||||||
void wlr_input_method_manager_v2_destroy(
|
|
||||||
struct wlr_input_method_manager_v2 *manager);
|
|
||||||
|
|
||||||
void wlr_input_method_v2_send_activate(
|
void wlr_input_method_v2_send_activate(
|
||||||
struct wlr_input_method_v2 *input_method);
|
struct wlr_input_method_v2 *input_method);
|
||||||
@ -84,4 +81,5 @@ void wlr_input_method_v2_send_text_change_cause(
|
|||||||
void wlr_input_method_v2_send_done(struct wlr_input_method_v2 *input_method);
|
void wlr_input_method_v2_send_done(struct wlr_input_method_v2 *input_method);
|
||||||
void wlr_input_method_v2_send_unavailable(
|
void wlr_input_method_v2_send_unavailable(
|
||||||
struct wlr_input_method_v2 *input_method);
|
struct wlr_input_method_v2 *input_method);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
*/
|
*/
|
||||||
struct wlr_layer_shell_v1 {
|
struct wlr_layer_shell_v1 {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources; // wl_resource
|
|
||||||
struct wl_list surfaces; // wl_layer_surface
|
struct wl_list surfaces; // wl_layer_surface
|
||||||
|
|
||||||
struct wl_listener display_destroy;
|
struct wl_listener display_destroy;
|
||||||
@ -97,7 +96,6 @@ struct wlr_layer_surface_v1 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
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);
|
||||||
void wlr_layer_shell_v1_destroy(struct wlr_layer_shell_v1 *layer_shell);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies the layer surface to configure itself with this width/height. The
|
* Notifies the layer surface to configure itself with this width/height. The
|
||||||
|
@ -45,7 +45,6 @@ struct wlr_dmabuf_v1_buffer *wlr_dmabuf_v1_buffer_from_params_resource(
|
|||||||
struct wlr_linux_dmabuf_v1 {
|
struct wlr_linux_dmabuf_v1 {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wlr_renderer *renderer;
|
struct wlr_renderer *renderer;
|
||||||
struct wl_list resources;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal destroy;
|
struct wl_signal destroy;
|
||||||
@ -60,10 +59,6 @@ struct wlr_linux_dmabuf_v1 {
|
|||||||
*/
|
*/
|
||||||
struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create(struct wl_display *display,
|
struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create(struct wl_display *display,
|
||||||
struct wlr_renderer *renderer);
|
struct wlr_renderer *renderer);
|
||||||
/**
|
|
||||||
* Destroy the linux-dmabuf interface
|
|
||||||
*/
|
|
||||||
void wlr_linux_dmabuf_v1_destroy(struct wlr_linux_dmabuf_v1 *linux_dmabuf);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the wlr_linux_dmabuf if the given resource was created
|
* Returns the wlr_linux_dmabuf if the given resource was created
|
||||||
|
@ -64,8 +64,8 @@ struct wlr_pointer_constraint_v1 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_pointer_constraints_v1 {
|
struct wlr_pointer_constraints_v1 {
|
||||||
struct wl_list resources; // wl_resource_get_link
|
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
|
struct wl_list constraints; // wlr_pointer_constraint_v1::link
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
/**
|
/**
|
||||||
@ -76,15 +76,13 @@ struct wlr_pointer_constraints_v1 {
|
|||||||
struct wl_signal new_constraint;
|
struct wl_signal new_constraint;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
struct wl_list constraints; // wlr_pointer_constraint_v1::link
|
struct wl_listener display_destroy;
|
||||||
|
|
||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_pointer_constraints_v1 *wlr_pointer_constraints_v1_create(
|
struct wlr_pointer_constraints_v1 *wlr_pointer_constraints_v1_create(
|
||||||
struct wl_display *display);
|
struct wl_display *display);
|
||||||
void wlr_pointer_constraints_v1_destroy(
|
|
||||||
struct wlr_pointer_constraints_v1 *pointer_constraints);
|
|
||||||
|
|
||||||
struct wlr_pointer_constraint_v1 *
|
struct wlr_pointer_constraint_v1 *
|
||||||
wlr_pointer_constraints_v1_constraint_for_surface(
|
wlr_pointer_constraints_v1_constraint_for_surface(
|
||||||
|
@ -15,9 +15,8 @@
|
|||||||
|
|
||||||
struct wlr_pointer_gestures_v1 {
|
struct wlr_pointer_gestures_v1 {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources; // wl_resource_get_link
|
struct wl_list swipes; // wl_resource_get_link
|
||||||
struct wl_list swipes; // wl_resource_get_link
|
struct wl_list pinches; // wl_resource_get_link
|
||||||
struct wl_list pinches; // wl_resource_get_link
|
|
||||||
|
|
||||||
struct wl_listener display_destroy;
|
struct wl_listener display_destroy;
|
||||||
|
|
||||||
@ -67,7 +66,4 @@ void wlr_pointer_gestures_v1_send_pinch_end(
|
|||||||
uint32_t time_msec,
|
uint32_t time_msec,
|
||||||
bool cancelled);
|
bool cancelled);
|
||||||
|
|
||||||
void wlr_pointer_gestures_v1_destroy(
|
|
||||||
struct wlr_pointer_gestures_v1 *pointer_gestures_v1);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,7 +19,6 @@ struct wlr_output_event_present;
|
|||||||
|
|
||||||
struct wlr_presentation {
|
struct wlr_presentation {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources; // wl_resource_get_link
|
|
||||||
struct wl_list feedbacks; // wlr_presentation_feedback::link
|
struct wl_list feedbacks; // wlr_presentation_feedback::link
|
||||||
clockid_t clock;
|
clockid_t clock;
|
||||||
|
|
||||||
@ -71,7 +70,6 @@ struct wlr_backend;
|
|||||||
|
|
||||||
struct wlr_presentation *wlr_presentation_create(struct wl_display *display,
|
struct wlr_presentation *wlr_presentation_create(struct wl_display *display,
|
||||||
struct wlr_backend *backend);
|
struct wlr_backend *backend);
|
||||||
void wlr_presentation_destroy(struct wlr_presentation *presentation);
|
|
||||||
/**
|
/**
|
||||||
* Mark the current surface's buffer as sampled.
|
* Mark the current surface's buffer as sampled.
|
||||||
*
|
*
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
struct wlr_primary_selection_v1_device_manager {
|
struct wlr_primary_selection_v1_device_manager {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources; // wl_resource_get_link
|
|
||||||
struct wl_list devices; // wlr_primary_selection_v1_device::link
|
struct wl_list devices; // wlr_primary_selection_v1_device::link
|
||||||
|
|
||||||
struct wl_listener display_destroy;
|
struct wl_listener display_destroy;
|
||||||
@ -46,7 +45,5 @@ struct wlr_primary_selection_v1_device {
|
|||||||
|
|
||||||
struct wlr_primary_selection_v1_device_manager *
|
struct wlr_primary_selection_v1_device_manager *
|
||||||
wlr_primary_selection_v1_device_manager_create(struct wl_display *display);
|
wlr_primary_selection_v1_device_manager_create(struct wl_display *display);
|
||||||
void wlr_primary_selection_v1_device_manager_destroy(
|
|
||||||
struct wlr_primary_selection_v1_device_manager *manager);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
*/
|
*/
|
||||||
struct wlr_relative_pointer_manager_v1 {
|
struct wlr_relative_pointer_manager_v1 {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources; // wl_resource_get_link()
|
|
||||||
struct wl_list relative_pointers; // wlr_relative_pointer_v1::link
|
struct wl_list relative_pointers; // wlr_relative_pointer_v1::link
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@ -60,8 +59,6 @@ struct wlr_relative_pointer_v1 {
|
|||||||
|
|
||||||
struct wlr_relative_pointer_manager_v1 *wlr_relative_pointer_manager_v1_create(
|
struct wlr_relative_pointer_manager_v1 *wlr_relative_pointer_manager_v1_create(
|
||||||
struct wl_display *display);
|
struct wl_display *display);
|
||||||
void wlr_relative_pointer_manager_v1_destroy(
|
|
||||||
struct wlr_relative_pointer_manager_v1 *manager);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a relative motion event to the seat. Time is given in microseconds
|
* Send a relative motion event to the seat. Time is given in microseconds
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
struct wlr_screencopy_manager_v1 {
|
struct wlr_screencopy_manager_v1 {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources; // wl_resource
|
|
||||||
struct wl_list frames; // wlr_screencopy_frame_v1::link
|
struct wl_list frames; // wlr_screencopy_frame_v1::link
|
||||||
|
|
||||||
struct wl_listener display_destroy;
|
struct wl_listener display_destroy;
|
||||||
@ -59,7 +58,5 @@ struct wlr_screencopy_frame_v1 {
|
|||||||
|
|
||||||
struct wlr_screencopy_manager_v1 *wlr_screencopy_manager_v1_create(
|
struct wlr_screencopy_manager_v1 *wlr_screencopy_manager_v1_create(
|
||||||
struct wl_display *display);
|
struct wl_display *display);
|
||||||
void wlr_screencopy_manager_v1_destroy(
|
|
||||||
struct wlr_screencopy_manager_v1 *screencopy);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,7 +44,7 @@ enum wlr_server_decoration_manager_mode {
|
|||||||
*/
|
*/
|
||||||
struct wlr_server_decoration_manager {
|
struct wlr_server_decoration_manager {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources;
|
struct wl_list resources; // wl_resource_get_link
|
||||||
struct wl_list decorations; // wlr_server_decoration::link
|
struct wl_list decorations; // wlr_server_decoration::link
|
||||||
|
|
||||||
uint32_t default_mode; // enum wlr_server_decoration_manager_mode
|
uint32_t default_mode; // enum wlr_server_decoration_manager_mode
|
||||||
@ -80,7 +80,5 @@ struct wlr_server_decoration_manager *wlr_server_decoration_manager_create(
|
|||||||
struct wl_display *display);
|
struct wl_display *display);
|
||||||
void wlr_server_decoration_manager_set_default_mode(
|
void wlr_server_decoration_manager_set_default_mode(
|
||||||
struct wlr_server_decoration_manager *manager, uint32_t default_mode);
|
struct wlr_server_decoration_manager *manager, uint32_t default_mode);
|
||||||
void wlr_server_decoration_manager_destroy(
|
|
||||||
struct wlr_server_decoration_manager *manager);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -141,7 +141,6 @@ struct wlr_tablet_v2_tablet_tool *wlr_tablet_tool_create(
|
|||||||
struct wlr_tablet_tool *wlr_tool);
|
struct wlr_tablet_tool *wlr_tool);
|
||||||
|
|
||||||
struct wlr_tablet_manager_v2 *wlr_tablet_v2_create(struct wl_display *display);
|
struct wlr_tablet_manager_v2 *wlr_tablet_v2_create(struct wl_display *display);
|
||||||
void wlr_tablet_v2_destroy(struct wlr_tablet_manager_v2 *manager);
|
|
||||||
|
|
||||||
void wlr_send_tablet_v2_tablet_tool_proximity_in(
|
void wlr_send_tablet_v2_tablet_tool_proximity_in(
|
||||||
struct wlr_tablet_v2_tablet_tool *tool,
|
struct wlr_tablet_v2_tablet_tool *tool,
|
||||||
|
@ -60,8 +60,6 @@ struct wlr_text_input_v3 {
|
|||||||
|
|
||||||
struct wlr_text_input_manager_v3 {
|
struct wlr_text_input_manager_v3 {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
|
|
||||||
struct wl_list bound_resources; // struct wl_resource*::link
|
|
||||||
struct wl_list text_inputs; // struct wlr_text_input_v3::resource::link
|
struct wl_list text_inputs; // struct wlr_text_input_v3::resource::link
|
||||||
|
|
||||||
struct wl_listener display_destroy;
|
struct wl_listener display_destroy;
|
||||||
@ -74,8 +72,6 @@ struct wlr_text_input_manager_v3 {
|
|||||||
|
|
||||||
struct wlr_text_input_manager_v3 *wlr_text_input_manager_v3_create(
|
struct wlr_text_input_manager_v3 *wlr_text_input_manager_v3_create(
|
||||||
struct wl_display *wl_display);
|
struct wl_display *wl_display);
|
||||||
void wlr_text_input_manager_v3_destroy(
|
|
||||||
struct wlr_text_input_manager_v3 *manager);
|
|
||||||
|
|
||||||
// Sends enter to the surface and saves it
|
// Sends enter to the surface and saves it
|
||||||
void wlr_text_input_v3_send_enter(struct wlr_text_input_v3 *text_input,
|
void wlr_text_input_v3_send_enter(struct wlr_text_input_v3 *text_input,
|
||||||
@ -90,4 +86,5 @@ void wlr_text_input_v3_send_delete_surrounding_text(
|
|||||||
struct wlr_text_input_v3 *text_input, uint32_t before_length,
|
struct wlr_text_input_v3 *text_input, uint32_t before_length,
|
||||||
uint32_t after_length);
|
uint32_t after_length);
|
||||||
void wlr_text_input_v3_send_done(struct wlr_text_input_v3 *text_input);
|
void wlr_text_input_v3_send_done(struct wlr_text_input_v3 *text_input);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
struct wlr_virtual_keyboard_manager_v1 {
|
struct wlr_virtual_keyboard_manager_v1 {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources; // struct wl_resource*
|
|
||||||
struct wl_list virtual_keyboards; // struct wlr_virtual_keyboard_v1*
|
struct wl_list virtual_keyboards; // struct wlr_virtual_keyboard_v1*
|
||||||
|
|
||||||
struct wl_listener display_destroy;
|
struct wl_listener display_destroy;
|
||||||
@ -41,7 +40,5 @@ struct wlr_virtual_keyboard_v1 {
|
|||||||
|
|
||||||
struct wlr_virtual_keyboard_manager_v1* wlr_virtual_keyboard_manager_v1_create(
|
struct wlr_virtual_keyboard_manager_v1* wlr_virtual_keyboard_manager_v1_create(
|
||||||
struct wl_display *display);
|
struct wl_display *display);
|
||||||
void wlr_virtual_keyboard_manager_v1_destroy(
|
|
||||||
struct wlr_virtual_keyboard_manager_v1 *manager);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -12,7 +12,6 @@ enum wlr_xdg_toplevel_decoration_v1_mode {
|
|||||||
|
|
||||||
struct wlr_xdg_decoration_manager_v1 {
|
struct wlr_xdg_decoration_manager_v1 {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources;
|
|
||||||
struct wl_list decorations; // wlr_xdg_toplevel_decoration::link
|
struct wl_list decorations; // wlr_xdg_toplevel_decoration::link
|
||||||
|
|
||||||
struct wl_listener display_destroy;
|
struct wl_listener display_destroy;
|
||||||
@ -59,8 +58,6 @@ struct wlr_xdg_toplevel_decoration_v1 {
|
|||||||
|
|
||||||
struct wlr_xdg_decoration_manager_v1 *
|
struct wlr_xdg_decoration_manager_v1 *
|
||||||
wlr_xdg_decoration_manager_v1_create(struct wl_display *display);
|
wlr_xdg_decoration_manager_v1_create(struct wl_display *display);
|
||||||
void wlr_xdg_decoration_manager_v1_destroy(
|
|
||||||
struct wlr_xdg_decoration_manager_v1 *manager);
|
|
||||||
|
|
||||||
uint32_t wlr_xdg_toplevel_decoration_v1_set_mode(
|
uint32_t wlr_xdg_toplevel_decoration_v1_set_mode(
|
||||||
struct wlr_xdg_toplevel_decoration_v1 *decoration,
|
struct wlr_xdg_toplevel_decoration_v1 *decoration,
|
||||||
|
@ -26,22 +26,21 @@ struct wlr_xdg_output_v1 {
|
|||||||
|
|
||||||
struct wlr_xdg_output_manager_v1 {
|
struct wlr_xdg_output_manager_v1 {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct wl_list resources;
|
|
||||||
struct wlr_output_layout *layout;
|
struct wlr_output_layout *layout;
|
||||||
|
|
||||||
struct wl_list outputs;
|
struct wl_list outputs;
|
||||||
|
|
||||||
struct wl_listener layout_add;
|
|
||||||
struct wl_listener layout_change;
|
|
||||||
struct wl_listener layout_destroy;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal destroy;
|
struct wl_signal destroy;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
|
struct wl_listener display_destroy;
|
||||||
|
struct wl_listener layout_add;
|
||||||
|
struct wl_listener layout_change;
|
||||||
|
struct wl_listener layout_destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_xdg_output_manager_v1 *wlr_xdg_output_manager_v1_create(
|
struct wlr_xdg_output_manager_v1 *wlr_xdg_output_manager_v1_create(
|
||||||
struct wl_display *display, struct wlr_output_layout *layout);
|
struct wl_display *display, struct wlr_output_layout *layout);
|
||||||
void wlr_xdg_output_manager_v1_destroy(struct wlr_xdg_output_manager_v1 *manager);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -243,7 +243,6 @@ struct wlr_xdg_toplevel_show_window_menu_event {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_xdg_shell *wlr_xdg_shell_create(struct wl_display *display);
|
struct wlr_xdg_shell *wlr_xdg_shell_create(struct wl_display *display);
|
||||||
void wlr_xdg_shell_destroy(struct wlr_xdg_shell *xdg_shell);
|
|
||||||
|
|
||||||
struct wlr_xdg_surface *wlr_xdg_surface_from_resource(
|
struct wlr_xdg_surface *wlr_xdg_surface_from_resource(
|
||||||
struct wl_resource *resource);
|
struct wl_resource *resource);
|
||||||
|
@ -243,7 +243,6 @@ struct wlr_xdg_toplevel_v6_show_window_menu_event {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_xdg_shell_v6 *wlr_xdg_shell_v6_create(struct wl_display *display);
|
struct wlr_xdg_shell_v6 *wlr_xdg_shell_v6_create(struct wl_display *display);
|
||||||
void wlr_xdg_shell_v6_destroy(struct wlr_xdg_shell_v6 *xdg_shell);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a ping to the surface. If the surface does not respond in a reasonable
|
* Send a ping to the surface. If the surface does not respond in a reasonable
|
||||||
|
@ -262,11 +262,6 @@ static const struct wl_data_device_manager_interface
|
|||||||
.get_data_device = data_device_manager_get_data_device,
|
.get_data_device = data_device_manager_get_data_device,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void data_device_manager_handle_resource_destroy(
|
|
||||||
struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void data_device_manager_bind(struct wl_client *client,
|
static void data_device_manager_bind(struct wl_client *client,
|
||||||
void *data, uint32_t version, uint32_t id) {
|
void *data, uint32_t version, uint32_t id) {
|
||||||
struct wlr_data_device_manager *manager = data;
|
struct wlr_data_device_manager *manager = data;
|
||||||
@ -278,32 +273,16 @@ static void data_device_manager_bind(struct wl_client *client,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_resource_set_implementation(resource, &data_device_manager_impl,
|
wl_resource_set_implementation(resource, &data_device_manager_impl,
|
||||||
manager, data_device_manager_handle_resource_destroy);
|
manager, NULL);
|
||||||
|
|
||||||
wl_list_insert(&manager->resources, wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
void wlr_data_device_manager_destroy(struct wlr_data_device_manager *manager) {
|
|
||||||
if (!manager) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
|
||||||
wl_list_remove(&manager->display_destroy.link);
|
|
||||||
wl_global_destroy(manager->global);
|
|
||||||
struct wl_resource *resource, *tmp;
|
|
||||||
wl_resource_for_each_safe(resource, tmp, &manager->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
wl_resource_for_each_safe(resource, tmp, &manager->data_sources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
free(manager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_data_device_manager *manager =
|
struct wlr_data_device_manager *manager =
|
||||||
wl_container_of(listener, manager, display_destroy);
|
wl_container_of(listener, manager, display_destroy);
|
||||||
wlr_data_device_manager_destroy(manager);
|
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||||
|
wl_list_remove(&manager->display_destroy.link);
|
||||||
|
wl_global_destroy(manager->global);
|
||||||
|
free(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_data_device_manager *wlr_data_device_manager_create(
|
struct wlr_data_device_manager *wlr_data_device_manager_create(
|
||||||
@ -315,7 +294,6 @@ struct wlr_data_device_manager *wlr_data_device_manager_create(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_init(&manager->resources);
|
|
||||||
wl_list_init(&manager->data_sources);
|
wl_list_init(&manager->data_sources);
|
||||||
wl_signal_init(&manager->events.destroy);
|
wl_signal_init(&manager->events.destroy);
|
||||||
|
|
||||||
|
@ -273,22 +273,8 @@ static void tablet_v2_bind(struct wl_client *wl_client, void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_tablet_manager_v2 *tablet =
|
struct wlr_tablet_manager_v2 *manager =
|
||||||
wl_container_of(listener, tablet, display_destroy);
|
wl_container_of(listener, manager, display_destroy);
|
||||||
wlr_tablet_v2_destroy(tablet);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wlr_tablet_v2_destroy(struct wlr_tablet_manager_v2 *manager) {
|
|
||||||
struct wlr_tablet_manager_client_v2 *client, *client_tmp;
|
|
||||||
wl_list_for_each_safe(client, client_tmp, &manager->clients, link) {
|
|
||||||
wlr_tablet_manager_v2_destroy(client->resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wlr_tablet_seat_v2 *seat, *seat_tmp;
|
|
||||||
wl_list_for_each_safe(seat, seat_tmp, &manager->seats, link) {
|
|
||||||
tablet_seat_destroy(seat);
|
|
||||||
}
|
|
||||||
|
|
||||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||||
wl_list_remove(&manager->display_destroy.link);
|
wl_list_remove(&manager->display_destroy.link);
|
||||||
wl_global_destroy(manager->wl_global);
|
wl_global_destroy(manager->wl_global);
|
||||||
|
@ -22,15 +22,6 @@ struct wlr_subsurface *wlr_subsurface_from_wlr_surface(
|
|||||||
return (struct wlr_subsurface *)surface->role_data;
|
return (struct wlr_subsurface *)surface->role_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_subcompositor_interface subcompositor_impl;
|
|
||||||
|
|
||||||
static struct wlr_subcompositor *subcompositor_from_resource(
|
|
||||||
struct wl_resource *resource) {
|
|
||||||
assert(wl_resource_instance_of(resource, &wl_subcompositor_interface,
|
|
||||||
&subcompositor_impl));
|
|
||||||
return wl_resource_get_user_data(resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void subcompositor_handle_destroy(struct wl_client *client,
|
static void subcompositor_handle_destroy(struct wl_client *client,
|
||||||
struct wl_resource *resource) {
|
struct wl_resource *resource) {
|
||||||
wl_resource_destroy(resource);
|
wl_resource_destroy(resource);
|
||||||
@ -40,8 +31,6 @@ static void subcompositor_handle_get_subsurface(struct wl_client *client,
|
|||||||
struct wl_resource *resource, uint32_t id,
|
struct wl_resource *resource, uint32_t id,
|
||||||
struct wl_resource *surface_resource,
|
struct wl_resource *surface_resource,
|
||||||
struct wl_resource *parent_resource) {
|
struct wl_resource *parent_resource) {
|
||||||
struct wlr_subcompositor *subcompositor =
|
|
||||||
subcompositor_from_resource(resource);
|
|
||||||
struct wlr_surface *surface = wlr_surface_from_resource(surface_resource);
|
struct wlr_surface *surface = wlr_surface_from_resource(surface_resource);
|
||||||
struct wlr_surface *parent = wlr_surface_from_resource(parent_resource);
|
struct wlr_surface *parent = wlr_surface_from_resource(parent_resource);
|
||||||
|
|
||||||
@ -78,7 +67,7 @@ static void subcompositor_handle_get_subsurface(struct wl_client *client,
|
|||||||
}
|
}
|
||||||
|
|
||||||
wlr_subsurface_create(surface, parent, wl_resource_get_version(resource),
|
wlr_subsurface_create(surface, parent, wl_resource_get_version(resource),
|
||||||
id, &subcompositor->subsurface_resources);
|
id, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_subcompositor_interface subcompositor_impl = {
|
static const struct wl_subcompositor_interface subcompositor_impl = {
|
||||||
@ -86,10 +75,6 @@ static const struct wl_subcompositor_interface subcompositor_impl = {
|
|||||||
.get_subsurface = subcompositor_handle_get_subsurface,
|
.get_subsurface = subcompositor_handle_get_subsurface,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void subcompositor_resource_destroy(struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void subcompositor_bind(struct wl_client *client, void *data,
|
static void subcompositor_bind(struct wl_client *client, void *data,
|
||||||
uint32_t version, uint32_t id) {
|
uint32_t version, uint32_t id) {
|
||||||
struct wlr_subcompositor *subcompositor = data;
|
struct wlr_subcompositor *subcompositor = data;
|
||||||
@ -100,33 +85,24 @@ static void subcompositor_bind(struct wl_client *client, void *data,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_resource_set_implementation(resource, &subcompositor_impl,
|
wl_resource_set_implementation(resource, &subcompositor_impl,
|
||||||
subcompositor, subcompositor_resource_destroy);
|
subcompositor, NULL);
|
||||||
wl_list_insert(&subcompositor->resources, wl_resource_get_link(resource));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void subcompositor_init(struct wlr_subcompositor *subcompositor,
|
static bool subcompositor_init(struct wlr_subcompositor *subcompositor,
|
||||||
struct wl_display *display) {
|
struct wl_display *display) {
|
||||||
subcompositor->global = wl_global_create(display,
|
subcompositor->global = wl_global_create(display,
|
||||||
&wl_subcompositor_interface, SUBCOMPOSITOR_VERSION, subcompositor,
|
&wl_subcompositor_interface, SUBCOMPOSITOR_VERSION, subcompositor,
|
||||||
subcompositor_bind);
|
subcompositor_bind);
|
||||||
if (subcompositor->global == NULL) {
|
if (subcompositor->global == NULL) {
|
||||||
wlr_log_errno(WLR_ERROR, "Could not allocate subcompositor global");
|
wlr_log_errno(WLR_ERROR, "Could not allocate subcompositor global");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
wl_list_init(&subcompositor->resources);
|
|
||||||
wl_list_init(&subcompositor->subsurface_resources);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void subcompositor_finish(struct wlr_subcompositor *subcompositor) {
|
static void subcompositor_finish(struct wlr_subcompositor *subcompositor) {
|
||||||
wl_global_destroy(subcompositor->global);
|
wl_global_destroy(subcompositor->global);
|
||||||
struct wl_resource *resource, *tmp;
|
|
||||||
wl_resource_for_each_safe(resource, tmp,
|
|
||||||
&subcompositor->subsurface_resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
wl_resource_for_each_safe(resource, tmp, &subcompositor->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -144,8 +120,7 @@ static void compositor_create_surface(struct wl_client *client,
|
|||||||
struct wlr_compositor *compositor = compositor_from_resource(resource);
|
struct wlr_compositor *compositor = compositor_from_resource(resource);
|
||||||
|
|
||||||
struct wlr_surface *surface = wlr_surface_create(client,
|
struct wlr_surface *surface = wlr_surface_create(client,
|
||||||
wl_resource_get_version(resource), id, compositor->renderer,
|
wl_resource_get_version(resource), id, compositor->renderer, NULL);
|
||||||
&compositor->surface_resources);
|
|
||||||
if (surface == NULL) {
|
if (surface == NULL) {
|
||||||
wl_client_post_no_memory(client);
|
wl_client_post_no_memory(client);
|
||||||
return;
|
return;
|
||||||
@ -156,9 +131,7 @@ static void compositor_create_surface(struct wl_client *client,
|
|||||||
|
|
||||||
static void compositor_create_region(struct wl_client *client,
|
static void compositor_create_region(struct wl_client *client,
|
||||||
struct wl_resource *resource, uint32_t id) {
|
struct wl_resource *resource, uint32_t id) {
|
||||||
struct wlr_compositor *compositor = compositor_from_resource(resource);
|
wlr_region_create(client, wl_resource_get_version(resource), id, NULL);
|
||||||
|
|
||||||
wlr_region_create(client, 1, id, &compositor->region_resources);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_compositor_interface compositor_impl = {
|
static const struct wl_compositor_interface compositor_impl = {
|
||||||
@ -166,14 +139,9 @@ static const struct wl_compositor_interface compositor_impl = {
|
|||||||
.create_region = compositor_create_region,
|
.create_region = compositor_create_region,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void compositor_resource_destroy(struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void compositor_bind(struct wl_client *wl_client, void *data,
|
static void compositor_bind(struct wl_client *wl_client, void *data,
|
||||||
uint32_t version, uint32_t id) {
|
uint32_t version, uint32_t id) {
|
||||||
struct wlr_compositor *compositor = data;
|
struct wlr_compositor *compositor = data;
|
||||||
assert(wl_client && compositor);
|
|
||||||
|
|
||||||
struct wl_resource *resource =
|
struct wl_resource *resource =
|
||||||
wl_resource_create(wl_client, &wl_compositor_interface, version, id);
|
wl_resource_create(wl_client, &wl_compositor_interface, version, id);
|
||||||
@ -181,36 +149,17 @@ static void compositor_bind(struct wl_client *wl_client, void *data,
|
|||||||
wl_client_post_no_memory(wl_client);
|
wl_client_post_no_memory(wl_client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_resource_set_implementation(resource, &compositor_impl,
|
wl_resource_set_implementation(resource, &compositor_impl, compositor, NULL);
|
||||||
compositor, compositor_resource_destroy);
|
|
||||||
wl_list_insert(&compositor->resources, wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
void wlr_compositor_destroy(struct wlr_compositor *compositor) {
|
|
||||||
if (compositor == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wlr_signal_emit_safe(&compositor->events.destroy, compositor);
|
|
||||||
subcompositor_finish(&compositor->subcompositor);
|
|
||||||
wl_list_remove(&compositor->display_destroy.link);
|
|
||||||
wl_global_destroy(compositor->global);
|
|
||||||
struct wl_resource *resource, *tmp;
|
|
||||||
wl_resource_for_each_safe(resource, tmp, &compositor->surface_resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
wl_resource_for_each_safe(resource, tmp, &compositor->region_resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
wl_resource_for_each_safe(resource, tmp, &compositor->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
free(compositor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_compositor *compositor =
|
struct wlr_compositor *compositor =
|
||||||
wl_container_of(listener, compositor, display_destroy);
|
wl_container_of(listener, compositor, display_destroy);
|
||||||
wlr_compositor_destroy(compositor);
|
wlr_signal_emit_safe(&compositor->events.destroy, compositor);
|
||||||
|
subcompositor_finish(&compositor->subcompositor);
|
||||||
|
wl_list_remove(&compositor->display_destroy.link);
|
||||||
|
wl_global_destroy(compositor->global);
|
||||||
|
free(compositor);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_compositor *wlr_compositor_create(struct wl_display *display,
|
struct wlr_compositor *wlr_compositor_create(struct wl_display *display,
|
||||||
@ -231,9 +180,6 @@ struct wlr_compositor *wlr_compositor_create(struct wl_display *display,
|
|||||||
}
|
}
|
||||||
compositor->renderer = renderer;
|
compositor->renderer = renderer;
|
||||||
|
|
||||||
wl_list_init(&compositor->resources);
|
|
||||||
wl_list_init(&compositor->surface_resources);
|
|
||||||
wl_list_init(&compositor->region_resources);
|
|
||||||
wl_signal_init(&compositor->events.new_surface);
|
wl_signal_init(&compositor->events.new_surface);
|
||||||
wl_signal_init(&compositor->events.destroy);
|
wl_signal_init(&compositor->events.destroy);
|
||||||
|
|
||||||
|
@ -650,10 +650,6 @@ static const struct zwlr_data_control_manager_v1_interface manager_impl = {
|
|||||||
.destroy = manager_handle_destroy,
|
.destroy = manager_handle_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void manager_handle_resource_destroy(struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void manager_bind(struct wl_client *client, void *data, uint32_t version,
|
static void manager_bind(struct wl_client *client, void *data, uint32_t version,
|
||||||
uint32_t id) {
|
uint32_t id) {
|
||||||
struct wlr_data_control_manager_v1 *manager = data;
|
struct wlr_data_control_manager_v1 *manager = data;
|
||||||
@ -664,16 +660,16 @@ static void manager_bind(struct wl_client *client, void *data, uint32_t version,
|
|||||||
wl_client_post_no_memory(client);
|
wl_client_post_no_memory(client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_resource_set_implementation(resource, &manager_impl, manager,
|
wl_resource_set_implementation(resource, &manager_impl, manager, NULL);
|
||||||
manager_handle_resource_destroy);
|
|
||||||
|
|
||||||
wl_list_insert(&manager->resources, wl_resource_get_link(resource));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_data_control_manager_v1 *manager =
|
struct wlr_data_control_manager_v1 *manager =
|
||||||
wl_container_of(listener, manager, display_destroy);
|
wl_container_of(listener, manager, display_destroy);
|
||||||
wlr_data_control_manager_v1_destroy(manager);
|
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||||
|
wl_list_remove(&manager->display_destroy.link);
|
||||||
|
wl_global_destroy(manager->global);
|
||||||
|
free(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_data_control_manager_v1 *wlr_data_control_manager_v1_create(
|
struct wlr_data_control_manager_v1 *wlr_data_control_manager_v1_create(
|
||||||
@ -683,7 +679,6 @@ struct wlr_data_control_manager_v1 *wlr_data_control_manager_v1_create(
|
|||||||
if (manager == NULL) {
|
if (manager == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wl_list_init(&manager->resources);
|
|
||||||
wl_list_init(&manager->devices);
|
wl_list_init(&manager->devices);
|
||||||
wl_signal_init(&manager->events.destroy);
|
wl_signal_init(&manager->events.destroy);
|
||||||
wl_signal_init(&manager->events.new_device);
|
wl_signal_init(&manager->events.new_device);
|
||||||
@ -701,25 +696,3 @@ struct wlr_data_control_manager_v1 *wlr_data_control_manager_v1_create(
|
|||||||
|
|
||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_data_control_manager_v1_destroy(
|
|
||||||
struct wlr_data_control_manager_v1 *manager) {
|
|
||||||
if (manager == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
|
||||||
|
|
||||||
struct wlr_data_control_device_v1 *device, *control_tmp;
|
|
||||||
wl_list_for_each_safe(device, control_tmp, &manager->devices, link) {
|
|
||||||
wl_resource_destroy(device->resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wl_resource *resource, *resource_tmp;
|
|
||||||
wl_resource_for_each_safe(resource, resource_tmp, &manager->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_list_remove(&manager->display_destroy.link);
|
|
||||||
free(manager);
|
|
||||||
}
|
|
||||||
|
@ -165,10 +165,6 @@ static const struct zwlr_export_dmabuf_manager_v1_interface manager_impl = {
|
|||||||
.destroy = manager_handle_destroy,
|
.destroy = manager_handle_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void manager_handle_resource_destroy(struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void manager_bind(struct wl_client *client, void *data, uint32_t version,
|
static void manager_bind(struct wl_client *client, void *data, uint32_t version,
|
||||||
uint32_t id) {
|
uint32_t id) {
|
||||||
struct wlr_export_dmabuf_manager_v1 *manager = data;
|
struct wlr_export_dmabuf_manager_v1 *manager = data;
|
||||||
@ -180,15 +176,16 @@ static void manager_bind(struct wl_client *client, void *data, uint32_t version,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_resource_set_implementation(resource, &manager_impl, manager,
|
wl_resource_set_implementation(resource, &manager_impl, manager,
|
||||||
manager_handle_resource_destroy);
|
NULL);
|
||||||
|
|
||||||
wl_list_insert(&manager->resources, wl_resource_get_link(resource));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_export_dmabuf_manager_v1 *manager =
|
struct wlr_export_dmabuf_manager_v1 *manager =
|
||||||
wl_container_of(listener, manager, display_destroy);
|
wl_container_of(listener, manager, display_destroy);
|
||||||
wlr_export_dmabuf_manager_v1_destroy(manager);
|
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||||
|
wl_list_remove(&manager->display_destroy.link);
|
||||||
|
wl_global_destroy(manager->global);
|
||||||
|
free(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_export_dmabuf_manager_v1 *wlr_export_dmabuf_manager_v1_create(
|
struct wlr_export_dmabuf_manager_v1 *wlr_export_dmabuf_manager_v1_create(
|
||||||
@ -198,7 +195,6 @@ struct wlr_export_dmabuf_manager_v1 *wlr_export_dmabuf_manager_v1_create(
|
|||||||
if (manager == NULL) {
|
if (manager == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wl_list_init(&manager->resources);
|
|
||||||
wl_list_init(&manager->frames);
|
wl_list_init(&manager->frames);
|
||||||
wl_signal_init(&manager->events.destroy);
|
wl_signal_init(&manager->events.destroy);
|
||||||
|
|
||||||
@ -215,22 +211,3 @@ struct wlr_export_dmabuf_manager_v1 *wlr_export_dmabuf_manager_v1_create(
|
|||||||
|
|
||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_export_dmabuf_manager_v1_destroy(
|
|
||||||
struct wlr_export_dmabuf_manager_v1 *manager) {
|
|
||||||
if (manager == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
|
||||||
wl_list_remove(&manager->display_destroy.link);
|
|
||||||
wl_global_destroy(manager->global);
|
|
||||||
struct wl_resource *resource, *resource_tmp;
|
|
||||||
wl_resource_for_each_safe(resource, resource_tmp, &manager->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
struct wlr_export_dmabuf_frame_v1 *frame, *frame_tmp;
|
|
||||||
wl_list_for_each_safe(frame, frame_tmp, &manager->frames, link) {
|
|
||||||
wl_resource_destroy(frame->resource);
|
|
||||||
}
|
|
||||||
free(manager);
|
|
||||||
}
|
|
||||||
|
@ -568,33 +568,13 @@ static void foreign_toplevel_manager_bind(struct wl_client *client, void *data,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_foreign_toplevel_manager_v1_destroy(
|
|
||||||
struct wlr_foreign_toplevel_manager_v1 *manager) {
|
|
||||||
if (!manager) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wlr_foreign_toplevel_handle_v1 *toplevel, *tmp_toplevel;
|
|
||||||
wl_list_for_each_safe(toplevel, tmp_toplevel, &manager->toplevels, link) {
|
|
||||||
wlr_foreign_toplevel_handle_v1_destroy(toplevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wl_resource *resource, *tmp_resource;
|
|
||||||
wl_resource_for_each_safe(resource, tmp_resource, &manager->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
|
||||||
wl_list_remove(&manager->display_destroy.link);
|
|
||||||
|
|
||||||
wl_global_destroy(manager->global);
|
|
||||||
free(manager);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_foreign_toplevel_manager_v1 *manager =
|
struct wlr_foreign_toplevel_manager_v1 *manager =
|
||||||
wl_container_of(listener, manager, display_destroy);
|
wl_container_of(listener, manager, display_destroy);
|
||||||
wlr_foreign_toplevel_manager_v1_destroy(manager);
|
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||||
|
wl_list_remove(&manager->display_destroy.link);
|
||||||
|
wl_global_destroy(manager->global);
|
||||||
|
free(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_foreign_toplevel_manager_v1 *wlr_foreign_toplevel_manager_v1_create(
|
struct wlr_foreign_toplevel_manager_v1 *wlr_foreign_toplevel_manager_v1_create(
|
||||||
|
@ -63,10 +63,6 @@ static const struct zwp_fullscreen_shell_v1_interface shell_impl = {
|
|||||||
.present_surface_for_mode = shell_handle_present_surface_for_mode,
|
.present_surface_for_mode = shell_handle_present_surface_for_mode,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void shell_handle_resource_destroy(struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void shell_bind(struct wl_client *client, void *data, uint32_t version,
|
static void shell_bind(struct wl_client *client, void *data, uint32_t version,
|
||||||
uint32_t id) {
|
uint32_t id) {
|
||||||
struct wlr_fullscreen_shell_v1 *shell = data;
|
struct wlr_fullscreen_shell_v1 *shell = data;
|
||||||
@ -77,16 +73,16 @@ static void shell_bind(struct wl_client *client, void *data, uint32_t version,
|
|||||||
wl_client_post_no_memory(client);
|
wl_client_post_no_memory(client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_resource_set_implementation(resource, &shell_impl, shell,
|
wl_resource_set_implementation(resource, &shell_impl, shell, NULL);
|
||||||
shell_handle_resource_destroy);
|
|
||||||
|
|
||||||
wl_list_insert(&shell->resources, wl_resource_get_link(resource));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_fullscreen_shell_v1 *shell =
|
struct wlr_fullscreen_shell_v1 *shell =
|
||||||
wl_container_of(listener, shell, display_destroy);
|
wl_container_of(listener, shell, display_destroy);
|
||||||
wlr_fullscreen_shell_v1_destroy(shell);
|
wlr_signal_emit_safe(&shell->events.destroy, shell);
|
||||||
|
wl_list_remove(&shell->display_destroy.link);
|
||||||
|
wl_global_destroy(shell->global);
|
||||||
|
free(shell);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_fullscreen_shell_v1 *wlr_fullscreen_shell_v1_create(
|
struct wlr_fullscreen_shell_v1 *wlr_fullscreen_shell_v1_create(
|
||||||
@ -96,7 +92,6 @@ struct wlr_fullscreen_shell_v1 *wlr_fullscreen_shell_v1_create(
|
|||||||
if (shell == NULL) {
|
if (shell == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wl_list_init(&shell->resources);
|
|
||||||
wl_signal_init(&shell->events.destroy);
|
wl_signal_init(&shell->events.destroy);
|
||||||
wl_signal_init(&shell->events.present_surface);
|
wl_signal_init(&shell->events.present_surface);
|
||||||
|
|
||||||
@ -113,17 +108,3 @@ struct wlr_fullscreen_shell_v1 *wlr_fullscreen_shell_v1_create(
|
|||||||
|
|
||||||
return shell;
|
return shell;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_fullscreen_shell_v1_destroy(struct wlr_fullscreen_shell_v1 *shell) {
|
|
||||||
if (shell == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wlr_signal_emit_safe(&shell->events.destroy, shell);
|
|
||||||
wl_list_remove(&shell->display_destroy.link);
|
|
||||||
wl_global_destroy(shell->global);
|
|
||||||
struct wl_resource *resource, *resource_tmp;
|
|
||||||
wl_resource_for_each_safe(resource, resource_tmp, &shell->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
free(shell);
|
|
||||||
}
|
|
||||||
|
@ -200,11 +200,6 @@ static const struct zwlr_gamma_control_manager_v1_interface
|
|||||||
.destroy = gamma_control_manager_destroy,
|
.destroy = gamma_control_manager_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gamma_control_manager_handle_resource_destroy(
|
|
||||||
struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gamma_control_manager_bind(struct wl_client *client, void *data,
|
static void gamma_control_manager_bind(struct wl_client *client, void *data,
|
||||||
uint32_t version, uint32_t id) {
|
uint32_t version, uint32_t id) {
|
||||||
struct wlr_gamma_control_manager_v1 *manager = data;
|
struct wlr_gamma_control_manager_v1 *manager = data;
|
||||||
@ -216,33 +211,16 @@ static void gamma_control_manager_bind(struct wl_client *client, void *data,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_resource_set_implementation(resource, &gamma_control_manager_impl,
|
wl_resource_set_implementation(resource, &gamma_control_manager_impl,
|
||||||
manager, gamma_control_manager_handle_resource_destroy);
|
manager, NULL);
|
||||||
wl_list_insert(&manager->resources, wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
void wlr_gamma_control_manager_v1_destroy(
|
|
||||||
struct wlr_gamma_control_manager_v1 *manager) {
|
|
||||||
if (!manager) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
struct wlr_gamma_control_v1 *gamma_control, *tmp;
|
|
||||||
wl_list_for_each_safe(gamma_control, tmp, &manager->controls, link) {
|
|
||||||
wl_resource_destroy(gamma_control->resource);
|
|
||||||
}
|
|
||||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
|
||||||
wl_list_remove(&manager->display_destroy.link);
|
|
||||||
struct wl_resource *resource, *resource_tmp;
|
|
||||||
wl_resource_for_each_safe(resource, resource_tmp, &manager->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
wl_global_destroy(manager->global);
|
|
||||||
free(manager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_gamma_control_manager_v1 *manager =
|
struct wlr_gamma_control_manager_v1 *manager =
|
||||||
wl_container_of(listener, manager, display_destroy);
|
wl_container_of(listener, manager, display_destroy);
|
||||||
wlr_gamma_control_manager_v1_destroy(manager);
|
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||||
|
wl_list_remove(&manager->display_destroy.link);
|
||||||
|
wl_global_destroy(manager->global);
|
||||||
|
free(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_gamma_control_manager_v1 *wlr_gamma_control_manager_v1_create(
|
struct wlr_gamma_control_manager_v1 *wlr_gamma_control_manager_v1_create(
|
||||||
@ -262,7 +240,6 @@ struct wlr_gamma_control_manager_v1 *wlr_gamma_control_manager_v1_create(
|
|||||||
}
|
}
|
||||||
|
|
||||||
wl_signal_init(&manager->events.destroy);
|
wl_signal_init(&manager->events.destroy);
|
||||||
wl_list_init(&manager->resources);
|
|
||||||
wl_list_init(&manager->controls);
|
wl_list_init(&manager->controls);
|
||||||
|
|
||||||
manager->display_destroy.notify = handle_display_destroy;
|
manager->display_destroy.notify = handle_display_destroy;
|
||||||
|
@ -434,11 +434,6 @@ static const struct gtk_primary_selection_device_manager_interface
|
|||||||
.destroy = device_manager_handle_destroy,
|
.destroy = device_manager_handle_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void device_manager_handle_resource_destroy(
|
|
||||||
struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void primary_selection_device_manager_bind(struct wl_client *client,
|
static void primary_selection_device_manager_bind(struct wl_client *client,
|
||||||
void *data, uint32_t version, uint32_t id) {
|
void *data, uint32_t version, uint32_t id) {
|
||||||
@ -451,15 +446,16 @@ static void primary_selection_device_manager_bind(struct wl_client *client,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_resource_set_implementation(resource, &device_manager_impl, manager,
|
wl_resource_set_implementation(resource, &device_manager_impl, manager,
|
||||||
device_manager_handle_resource_destroy);
|
NULL);
|
||||||
|
|
||||||
wl_list_insert(&manager->resources, wl_resource_get_link(resource));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_gtk_primary_selection_device_manager *manager =
|
struct wlr_gtk_primary_selection_device_manager *manager =
|
||||||
wl_container_of(listener, manager, display_destroy);
|
wl_container_of(listener, manager, display_destroy);
|
||||||
wlr_gtk_primary_selection_device_manager_destroy(manager);
|
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||||
|
wl_list_remove(&manager->display_destroy.link);
|
||||||
|
wl_global_destroy(manager->global);
|
||||||
|
free(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_gtk_primary_selection_device_manager *
|
struct wlr_gtk_primary_selection_device_manager *
|
||||||
@ -478,7 +474,6 @@ struct wlr_gtk_primary_selection_device_manager *
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_init(&manager->resources);
|
|
||||||
wl_list_init(&manager->devices);
|
wl_list_init(&manager->devices);
|
||||||
wl_signal_init(&manager->events.destroy);
|
wl_signal_init(&manager->events.destroy);
|
||||||
|
|
||||||
@ -487,18 +482,3 @@ struct wlr_gtk_primary_selection_device_manager *
|
|||||||
|
|
||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_gtk_primary_selection_device_manager_destroy(
|
|
||||||
struct wlr_gtk_primary_selection_device_manager *manager) {
|
|
||||||
if (manager == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
|
||||||
wl_list_remove(&manager->display_destroy.link);
|
|
||||||
struct wl_resource *resource, *resource_tmp;
|
|
||||||
wl_resource_for_each_safe(resource, resource_tmp, &manager->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
wl_global_destroy(manager->global);
|
|
||||||
free(manager);
|
|
||||||
}
|
|
||||||
|
@ -210,23 +210,12 @@ static void idle_bind(struct wl_client *wl_client, void *data,
|
|||||||
wl_resource_set_implementation(wl_resource, &idle_impl, idle, NULL);
|
wl_resource_set_implementation(wl_resource, &idle_impl, idle, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_idle_destroy(struct wlr_idle *idle) {
|
|
||||||
if (!idle) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wlr_signal_emit_safe(&idle->events.destroy, idle);
|
|
||||||
wl_list_remove(&idle->display_destroy.link);
|
|
||||||
struct wlr_idle_timeout *timer, *tmp;
|
|
||||||
wl_list_for_each_safe(timer, tmp, &idle->idle_timers, link) {
|
|
||||||
wlr_idle_timeout_destroy(timer);
|
|
||||||
}
|
|
||||||
wl_global_destroy(idle->global);
|
|
||||||
free(idle);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_idle *idle = wl_container_of(listener, idle, display_destroy);
|
struct wlr_idle *idle = wl_container_of(listener, idle, display_destroy);
|
||||||
wlr_idle_destroy(idle);
|
wlr_signal_emit_safe(&idle->events.destroy, idle);
|
||||||
|
wl_list_remove(&idle->display_destroy.link);
|
||||||
|
wl_global_destroy(idle->global);
|
||||||
|
free(idle);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_idle *wlr_idle_create(struct wl_display *display) {
|
struct wlr_idle *wlr_idle_create(struct wl_display *display) {
|
||||||
@ -249,7 +238,7 @@ struct wlr_idle *wlr_idle_create(struct wl_display *display) {
|
|||||||
wl_display_add_destroy_listener(display, &idle->display_destroy);
|
wl_display_add_destroy_listener(display, &idle->display_destroy);
|
||||||
|
|
||||||
idle->global = wl_global_create(display, &org_kde_kwin_idle_interface,
|
idle->global = wl_global_create(display, &org_kde_kwin_idle_interface,
|
||||||
1, idle, idle_bind);
|
1, idle, idle_bind);
|
||||||
if (idle->global == NULL) {
|
if (idle->global == NULL) {
|
||||||
wl_list_remove(&idle->display_destroy.link);
|
wl_list_remove(&idle->display_destroy.link);
|
||||||
free(idle);
|
free(idle);
|
||||||
|
@ -98,11 +98,6 @@ static void manager_handle_create_inhibitor(struct wl_client *client,
|
|||||||
wlr_signal_emit_safe(&manager->events.new_inhibitor, inhibitor);
|
wlr_signal_emit_safe(&manager->events.new_inhibitor, inhibitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void idle_inhibit_manager_v1_handle_resource_destroy(
|
|
||||||
struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void manager_handle_destroy(struct wl_client *client,
|
static void manager_handle_destroy(struct wl_client *client,
|
||||||
struct wl_resource *manager_resource) {
|
struct wl_resource *manager_resource) {
|
||||||
wl_resource_destroy(manager_resource);
|
wl_resource_destroy(manager_resource);
|
||||||
@ -116,8 +111,10 @@ static const struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl = {
|
|||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_idle_inhibit_manager_v1 *idle_inhibit =
|
struct wlr_idle_inhibit_manager_v1 *idle_inhibit =
|
||||||
wl_container_of(listener, idle_inhibit, display_destroy);
|
wl_container_of(listener, idle_inhibit, display_destroy);
|
||||||
|
wlr_signal_emit_safe(&idle_inhibit->events.destroy, idle_inhibit);
|
||||||
wlr_idle_inhibit_v1_destroy(idle_inhibit);
|
wl_list_remove(&idle_inhibit->display_destroy.link);
|
||||||
|
wl_global_destroy(idle_inhibit->global);
|
||||||
|
free(idle_inhibit);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void idle_inhibit_bind(struct wl_client *wl_client, void *data,
|
static void idle_inhibit_bind(struct wl_client *wl_client, void *data,
|
||||||
@ -126,69 +123,36 @@ static void idle_inhibit_bind(struct wl_client *wl_client, void *data,
|
|||||||
|
|
||||||
struct wl_resource *wl_resource = wl_resource_create(wl_client,
|
struct wl_resource *wl_resource = wl_resource_create(wl_client,
|
||||||
&zwp_idle_inhibit_manager_v1_interface, version, id);
|
&zwp_idle_inhibit_manager_v1_interface, version, id);
|
||||||
|
|
||||||
if (!wl_resource) {
|
if (!wl_resource) {
|
||||||
wl_client_post_no_memory(wl_client);
|
wl_client_post_no_memory(wl_client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_insert(&idle_inhibit->resources, wl_resource_get_link(wl_resource));
|
|
||||||
|
|
||||||
wl_resource_set_implementation(wl_resource, &idle_inhibit_impl,
|
wl_resource_set_implementation(wl_resource, &idle_inhibit_impl,
|
||||||
idle_inhibit, idle_inhibit_manager_v1_handle_resource_destroy);
|
idle_inhibit, NULL);
|
||||||
wlr_log(WLR_DEBUG, "idle_inhibit bound");
|
|
||||||
}
|
|
||||||
|
|
||||||
void wlr_idle_inhibit_v1_destroy(struct wlr_idle_inhibit_manager_v1 *idle_inhibit) {
|
|
||||||
if (!idle_inhibit) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wlr_idle_inhibitor_v1 *inhibitor;
|
|
||||||
struct wlr_idle_inhibitor_v1 *tmp;
|
|
||||||
wl_list_for_each_safe(inhibitor, tmp, &idle_inhibit->inhibitors, link) {
|
|
||||||
idle_inhibitor_v1_destroy(inhibitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
wlr_signal_emit_safe(&idle_inhibit->events.destroy, idle_inhibit);
|
|
||||||
wl_list_remove(&idle_inhibit->display_destroy.link);
|
|
||||||
|
|
||||||
struct wl_resource *resource;
|
|
||||||
struct wl_resource *tmp_resource;
|
|
||||||
wl_resource_for_each_safe(resource, tmp_resource, &idle_inhibit->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_global_destroy(idle_inhibit->global);
|
|
||||||
free(idle_inhibit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_idle_inhibit_manager_v1 *wlr_idle_inhibit_v1_create(struct wl_display *display) {
|
struct wlr_idle_inhibit_manager_v1 *wlr_idle_inhibit_v1_create(struct wl_display *display) {
|
||||||
struct wlr_idle_inhibit_manager_v1 *idle_inhibit =
|
struct wlr_idle_inhibit_manager_v1 *idle_inhibit =
|
||||||
calloc(1, sizeof(struct wlr_idle_inhibit_manager_v1));
|
calloc(1, sizeof(struct wlr_idle_inhibit_manager_v1));
|
||||||
|
|
||||||
if (!idle_inhibit) {
|
if (!idle_inhibit) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_init(&idle_inhibit->resources);
|
|
||||||
wl_list_init(&idle_inhibit->inhibitors);
|
wl_list_init(&idle_inhibit->inhibitors);
|
||||||
idle_inhibit->display_destroy.notify = handle_display_destroy;
|
|
||||||
wl_display_add_destroy_listener(display, &idle_inhibit->display_destroy);
|
|
||||||
wl_signal_init(&idle_inhibit->events.new_inhibitor);
|
wl_signal_init(&idle_inhibit->events.new_inhibitor);
|
||||||
wl_signal_init(&idle_inhibit->events.destroy);
|
wl_signal_init(&idle_inhibit->events.destroy);
|
||||||
|
|
||||||
idle_inhibit->global = wl_global_create(display,
|
idle_inhibit->global = wl_global_create(display,
|
||||||
&zwp_idle_inhibit_manager_v1_interface, 1,
|
&zwp_idle_inhibit_manager_v1_interface, 1,
|
||||||
idle_inhibit, idle_inhibit_bind);
|
idle_inhibit, idle_inhibit_bind);
|
||||||
|
|
||||||
if (!idle_inhibit->global) {
|
if (!idle_inhibit->global) {
|
||||||
wl_list_remove(&idle_inhibit->display_destroy.link);
|
|
||||||
free(idle_inhibit);
|
free(idle_inhibit);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(WLR_DEBUG, "idle_inhibit manager created");
|
idle_inhibit->display_destroy.notify = handle_display_destroy;
|
||||||
|
wl_display_add_destroy_listener(display, &idle_inhibit->display_destroy);
|
||||||
|
|
||||||
return idle_inhibit;
|
return idle_inhibit;
|
||||||
}
|
}
|
||||||
|
@ -103,27 +103,15 @@ static void inhibit_manager_bind(struct wl_client *wl_client, void *data,
|
|||||||
input_manager_resource_destroy);
|
input_manager_resource_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_input_inhibit_manager_destroy(
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_input_inhibit_manager *manager) {
|
struct wlr_input_inhibit_manager *manager =
|
||||||
if (!manager) {
|
wl_container_of(listener, manager, display_destroy);
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (manager->active_client) {
|
|
||||||
input_inhibitor_destroy(manager->active_client,
|
|
||||||
manager->active_inhibitor);
|
|
||||||
}
|
|
||||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||||
wl_list_remove(&manager->display_destroy.link);
|
wl_list_remove(&manager->display_destroy.link);
|
||||||
wl_global_destroy(manager->global);
|
wl_global_destroy(manager->global);
|
||||||
free(manager);
|
free(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
|
||||||
struct wlr_input_inhibit_manager *manager =
|
|
||||||
wl_container_of(listener, manager, display_destroy);
|
|
||||||
wlr_input_inhibit_manager_destroy(manager);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wlr_input_inhibit_manager *wlr_input_inhibit_manager_create(
|
struct wlr_input_inhibit_manager *wlr_input_inhibit_manager_create(
|
||||||
struct wl_display *display) {
|
struct wl_display *display) {
|
||||||
// TODO: Client destroy
|
// TODO: Client destroy
|
||||||
@ -137,7 +125,6 @@ struct wlr_input_inhibit_manager *wlr_input_inhibit_manager_create(
|
|||||||
&zwlr_input_inhibit_manager_v1_interface,
|
&zwlr_input_inhibit_manager_v1_interface,
|
||||||
1, manager, inhibit_manager_bind);
|
1, manager, inhibit_manager_bind);
|
||||||
if (manager->global == NULL){
|
if (manager->global == NULL){
|
||||||
wl_list_remove(&manager->display_destroy.link);
|
|
||||||
free(manager);
|
free(manager);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#ifndef _POSIX_C_SOURCE
|
#ifndef _POSIX_C_SOURCE
|
||||||
#define _POSIX_C_SOURCE 200809L
|
#define _POSIX_C_SOURCE 200809L
|
||||||
#endif
|
#endif
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@ -232,10 +232,6 @@ static const struct zwp_input_method_manager_v2_interface
|
|||||||
.destroy = manager_destroy,
|
.destroy = manager_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void input_method_manager_unbind(struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void input_method_manager_bind(struct wl_client *wl_client, void *data,
|
static void input_method_manager_bind(struct wl_client *wl_client, void *data,
|
||||||
uint32_t version, uint32_t id) {
|
uint32_t version, uint32_t id) {
|
||||||
assert(wl_client);
|
assert(wl_client);
|
||||||
@ -248,15 +244,16 @@ static void input_method_manager_bind(struct wl_client *wl_client, void *data,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_resource_set_implementation(bound_resource, &input_method_manager_impl,
|
wl_resource_set_implementation(bound_resource, &input_method_manager_impl,
|
||||||
im_manager, input_method_manager_unbind);
|
im_manager, NULL);
|
||||||
wl_list_insert(&im_manager->bound_resources,
|
|
||||||
wl_resource_get_link(bound_resource));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_input_method_manager_v2 *manager =
|
struct wlr_input_method_manager_v2 *manager =
|
||||||
wl_container_of(listener, manager, display_destroy);
|
wl_container_of(listener, manager, display_destroy);
|
||||||
wlr_input_method_manager_v2_destroy(manager);
|
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||||
|
wl_list_remove(&manager->display_destroy.link);
|
||||||
|
wl_global_destroy(manager->global);
|
||||||
|
free(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_input_method_manager_v2 *wlr_input_method_manager_v2_create(
|
struct wlr_input_method_manager_v2 *wlr_input_method_manager_v2_create(
|
||||||
@ -268,32 +265,18 @@ struct wlr_input_method_manager_v2 *wlr_input_method_manager_v2_create(
|
|||||||
}
|
}
|
||||||
wl_signal_init(&im_manager->events.input_method);
|
wl_signal_init(&im_manager->events.input_method);
|
||||||
wl_signal_init(&im_manager->events.destroy);
|
wl_signal_init(&im_manager->events.destroy);
|
||||||
wl_list_init(&im_manager->bound_resources);
|
|
||||||
wl_list_init(&im_manager->input_methods);
|
wl_list_init(&im_manager->input_methods);
|
||||||
|
|
||||||
im_manager->display_destroy.notify = handle_display_destroy;
|
|
||||||
wl_display_add_destroy_listener(display, &im_manager->display_destroy);
|
|
||||||
|
|
||||||
im_manager->global = wl_global_create(display,
|
im_manager->global = wl_global_create(display,
|
||||||
&zwp_input_method_manager_v2_interface, 1, im_manager,
|
&zwp_input_method_manager_v2_interface, 1, im_manager,
|
||||||
input_method_manager_bind);
|
input_method_manager_bind);
|
||||||
|
if (!im_manager->global) {
|
||||||
|
free(im_manager);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
im_manager->display_destroy.notify = handle_display_destroy;
|
||||||
|
wl_display_add_destroy_listener(display, &im_manager->display_destroy);
|
||||||
|
|
||||||
return im_manager;
|
return im_manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_input_method_manager_v2_destroy(
|
|
||||||
struct wlr_input_method_manager_v2 *manager) {
|
|
||||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
|
||||||
wl_list_remove(&manager->display_destroy.link);
|
|
||||||
|
|
||||||
struct wl_resource *resource, *resource_tmp;
|
|
||||||
wl_resource_for_each_safe(resource, resource_tmp,
|
|
||||||
&manager->bound_resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
struct wlr_input_method_v2 *im, *im_tmp;
|
|
||||||
wl_list_for_each_safe(im, im_tmp, &manager->input_methods, link) {
|
|
||||||
wl_resource_destroy(im->resource);
|
|
||||||
}
|
|
||||||
wl_global_destroy(manager->global);
|
|
||||||
free(manager);
|
|
||||||
}
|
|
||||||
|
@ -441,18 +441,6 @@ static const struct zwlr_layer_shell_v1_interface layer_shell_implementation = {
|
|||||||
.get_layer_surface = layer_shell_handle_get_layer_surface,
|
.get_layer_surface = layer_shell_handle_get_layer_surface,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void client_handle_destroy(struct wl_resource *resource) {
|
|
||||||
struct wl_client *client = wl_resource_get_client(resource);
|
|
||||||
struct wlr_layer_shell_v1 *shell = layer_shell_from_resource(resource);
|
|
||||||
struct wlr_layer_surface_v1 *surface, *tmp = NULL;
|
|
||||||
wl_list_for_each_safe(surface, tmp, &shell->surfaces, link) {
|
|
||||||
if (wl_resource_get_client(surface->resource) == client) {
|
|
||||||
layer_surface_destroy(surface);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void layer_shell_bind(struct wl_client *wl_client, void *data,
|
static void layer_shell_bind(struct wl_client *wl_client, void *data,
|
||||||
uint32_t version, uint32_t id) {
|
uint32_t version, uint32_t id) {
|
||||||
struct wlr_layer_shell_v1 *layer_shell = data;
|
struct wlr_layer_shell_v1 *layer_shell = data;
|
||||||
@ -465,14 +453,16 @@ static void layer_shell_bind(struct wl_client *wl_client, void *data,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_resource_set_implementation(resource,
|
wl_resource_set_implementation(resource,
|
||||||
&layer_shell_implementation, layer_shell, client_handle_destroy);
|
&layer_shell_implementation, layer_shell, NULL);
|
||||||
wl_list_insert(&layer_shell->resources, wl_resource_get_link(resource));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_layer_shell_v1 *layer_shell =
|
struct wlr_layer_shell_v1 *layer_shell =
|
||||||
wl_container_of(listener, layer_shell, display_destroy);
|
wl_container_of(listener, layer_shell, display_destroy);
|
||||||
wlr_layer_shell_v1_destroy(layer_shell);
|
wlr_signal_emit_safe(&layer_shell->events.destroy, layer_shell);
|
||||||
|
wl_list_remove(&layer_shell->display_destroy.link);
|
||||||
|
wl_global_destroy(layer_shell->global);
|
||||||
|
free(layer_shell);
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
@ -482,7 +472,6 @@ struct wlr_layer_shell_v1 *wlr_layer_shell_v1_create(struct wl_display *display)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_init(&layer_shell->resources);
|
|
||||||
wl_list_init(&layer_shell->surfaces);
|
wl_list_init(&layer_shell->surfaces);
|
||||||
|
|
||||||
struct wl_global *global = wl_global_create(display,
|
struct wl_global *global = wl_global_create(display,
|
||||||
@ -502,20 +491,6 @@ struct wlr_layer_shell_v1 *wlr_layer_shell_v1_create(struct wl_display *display)
|
|||||||
return layer_shell;
|
return layer_shell;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_layer_shell_v1_destroy(struct wlr_layer_shell_v1 *layer_shell) {
|
|
||||||
if (!layer_shell) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
struct wl_resource *resource, *tmp;
|
|
||||||
wl_resource_for_each_safe(resource, tmp, &layer_shell->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
wlr_signal_emit_safe(&layer_shell->events.destroy, layer_shell);
|
|
||||||
wl_list_remove(&layer_shell->display_destroy.link);
|
|
||||||
wl_global_destroy(layer_shell->global);
|
|
||||||
free(layer_shell);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct layer_surface_iterator_data {
|
struct layer_surface_iterator_data {
|
||||||
wlr_surface_iterator_func_t user_iterator;
|
wlr_surface_iterator_func_t user_iterator;
|
||||||
void *user_data;
|
void *user_data;
|
||||||
|
@ -422,10 +422,6 @@ static void linux_dmabuf_send_formats(struct wlr_linux_dmabuf_v1 *linux_dmabuf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void linux_dmabuf_resource_destroy(struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void linux_dmabuf_bind(struct wl_client *client, void *data,
|
static void linux_dmabuf_bind(struct wl_client *client, void *data,
|
||||||
uint32_t version, uint32_t id) {
|
uint32_t version, uint32_t id) {
|
||||||
struct wlr_linux_dmabuf_v1 *linux_dmabuf = data;
|
struct wlr_linux_dmabuf_v1 *linux_dmabuf = data;
|
||||||
@ -437,26 +433,16 @@ static void linux_dmabuf_bind(struct wl_client *client, void *data,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_resource_set_implementation(resource, &linux_dmabuf_impl,
|
wl_resource_set_implementation(resource, &linux_dmabuf_impl,
|
||||||
linux_dmabuf, linux_dmabuf_resource_destroy);
|
linux_dmabuf, NULL);
|
||||||
wl_list_insert(&linux_dmabuf->resources, wl_resource_get_link(resource));
|
|
||||||
linux_dmabuf_send_formats(linux_dmabuf, resource, version);
|
linux_dmabuf_send_formats(linux_dmabuf, resource, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_linux_dmabuf_v1_destroy(struct wlr_linux_dmabuf_v1 *linux_dmabuf) {
|
static void linux_dmabuf_v1_destroy(struct wlr_linux_dmabuf_v1 *linux_dmabuf) {
|
||||||
if (!linux_dmabuf) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wlr_signal_emit_safe(&linux_dmabuf->events.destroy, linux_dmabuf);
|
wlr_signal_emit_safe(&linux_dmabuf->events.destroy, linux_dmabuf);
|
||||||
|
|
||||||
wl_list_remove(&linux_dmabuf->display_destroy.link);
|
wl_list_remove(&linux_dmabuf->display_destroy.link);
|
||||||
wl_list_remove(&linux_dmabuf->renderer_destroy.link);
|
wl_list_remove(&linux_dmabuf->renderer_destroy.link);
|
||||||
|
|
||||||
struct wl_resource *resource, *tmp;
|
|
||||||
wl_resource_for_each_safe(resource, tmp, &linux_dmabuf->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_global_destroy(linux_dmabuf->global);
|
wl_global_destroy(linux_dmabuf->global);
|
||||||
free(linux_dmabuf);
|
free(linux_dmabuf);
|
||||||
}
|
}
|
||||||
@ -464,13 +450,13 @@ void wlr_linux_dmabuf_v1_destroy(struct wlr_linux_dmabuf_v1 *linux_dmabuf) {
|
|||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_linux_dmabuf_v1 *linux_dmabuf =
|
struct wlr_linux_dmabuf_v1 *linux_dmabuf =
|
||||||
wl_container_of(listener, linux_dmabuf, display_destroy);
|
wl_container_of(listener, linux_dmabuf, display_destroy);
|
||||||
wlr_linux_dmabuf_v1_destroy(linux_dmabuf);
|
linux_dmabuf_v1_destroy(linux_dmabuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_renderer_destroy(struct wl_listener *listener, void *data) {
|
static void handle_renderer_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_linux_dmabuf_v1 *linux_dmabuf =
|
struct wlr_linux_dmabuf_v1 *linux_dmabuf =
|
||||||
wl_container_of(listener, linux_dmabuf, renderer_destroy);
|
wl_container_of(listener, linux_dmabuf, renderer_destroy);
|
||||||
wlr_linux_dmabuf_v1_destroy(linux_dmabuf);
|
linux_dmabuf_v1_destroy(linux_dmabuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create(struct wl_display *display,
|
struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create(struct wl_display *display,
|
||||||
@ -483,7 +469,6 @@ struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create(struct wl_display *displa
|
|||||||
}
|
}
|
||||||
linux_dmabuf->renderer = renderer;
|
linux_dmabuf->renderer = renderer;
|
||||||
|
|
||||||
wl_list_init(&linux_dmabuf->resources);
|
|
||||||
wl_signal_init(&linux_dmabuf->events.destroy);
|
wl_signal_init(&linux_dmabuf->events.destroy);
|
||||||
|
|
||||||
linux_dmabuf->global =
|
linux_dmabuf->global =
|
||||||
|
@ -267,10 +267,6 @@ static const struct zwp_pointer_constraints_v1_interface
|
|||||||
.confine_pointer = pointer_constraints_confine_pointer,
|
.confine_pointer = pointer_constraints_confine_pointer,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void pointer_constraints_destroy(struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pointer_constraints_bind(struct wl_client *client, void *data,
|
static void pointer_constraints_bind(struct wl_client *client, void *data,
|
||||||
uint32_t version, uint32_t id) {
|
uint32_t version, uint32_t id) {
|
||||||
struct wlr_pointer_constraints_v1 *pointer_constraints = data;
|
struct wlr_pointer_constraints_v1 *pointer_constraints = data;
|
||||||
@ -283,17 +279,22 @@ static void pointer_constraints_bind(struct wl_client *client, void *data,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_insert(&pointer_constraints->resources,
|
|
||||||
wl_resource_get_link(resource));
|
|
||||||
wl_resource_set_implementation(resource, &pointer_constraints_impl,
|
wl_resource_set_implementation(resource, &pointer_constraints_impl,
|
||||||
pointer_constraints, pointer_constraints_destroy);
|
pointer_constraints, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
|
struct wlr_pointer_constraints_v1 *pointer_constraints =
|
||||||
|
wl_container_of(listener, pointer_constraints, display_destroy);
|
||||||
|
wl_list_remove(&pointer_constraints->display_destroy.link);
|
||||||
|
wl_global_destroy(pointer_constraints->global);
|
||||||
|
free(pointer_constraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_pointer_constraints_v1 *wlr_pointer_constraints_v1_create(
|
struct wlr_pointer_constraints_v1 *wlr_pointer_constraints_v1_create(
|
||||||
struct wl_display *display) {
|
struct wl_display *display) {
|
||||||
struct wlr_pointer_constraints_v1 *pointer_constraints =
|
struct wlr_pointer_constraints_v1 *pointer_constraints =
|
||||||
calloc(1, sizeof(*pointer_constraints));
|
calloc(1, sizeof(*pointer_constraints));
|
||||||
|
|
||||||
if (!pointer_constraints) {
|
if (!pointer_constraints) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -307,31 +308,16 @@ struct wlr_pointer_constraints_v1 *wlr_pointer_constraints_v1_create(
|
|||||||
}
|
}
|
||||||
pointer_constraints->global = wl_global;
|
pointer_constraints->global = wl_global;
|
||||||
|
|
||||||
wl_list_init(&pointer_constraints->resources);
|
|
||||||
wl_list_init(&pointer_constraints->constraints);
|
wl_list_init(&pointer_constraints->constraints);
|
||||||
wl_signal_init(&pointer_constraints->events.new_constraint);
|
wl_signal_init(&pointer_constraints->events.new_constraint);
|
||||||
|
|
||||||
|
pointer_constraints->display_destroy.notify = handle_display_destroy;
|
||||||
|
wl_display_add_destroy_listener(display,
|
||||||
|
&pointer_constraints->display_destroy);
|
||||||
|
|
||||||
return pointer_constraints;
|
return pointer_constraints;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_pointer_constraints_v1_destroy(
|
|
||||||
struct wlr_pointer_constraints_v1 *pointer_constraints) {
|
|
||||||
struct wl_resource *resource, *_tmp_res;
|
|
||||||
wl_resource_for_each_safe(resource, _tmp_res,
|
|
||||||
&pointer_constraints->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wlr_pointer_constraint_v1 *constraint, *_tmp_cons;
|
|
||||||
wl_list_for_each_safe(constraint, _tmp_cons,
|
|
||||||
&pointer_constraints->constraints, link) {
|
|
||||||
wl_resource_destroy(constraint->resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_global_destroy(pointer_constraints->global);
|
|
||||||
free(pointer_constraints);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wlr_pointer_constraint_v1 *
|
struct wlr_pointer_constraint_v1 *
|
||||||
wlr_pointer_constraints_v1_constraint_for_surface(
|
wlr_pointer_constraints_v1_constraint_for_surface(
|
||||||
struct wlr_pointer_constraints_v1 *pointer_constraints,
|
struct wlr_pointer_constraints_v1 *pointer_constraints,
|
||||||
|
@ -287,27 +287,13 @@ static void pointer_gestures_v1_bind(struct wl_client *wl_client, void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
wl_resource_set_implementation(resource,
|
wl_resource_set_implementation(resource,
|
||||||
&gestures_impl, gestures, resource_remove_from_list);
|
&gestures_impl, gestures, NULL);
|
||||||
wl_list_insert(&gestures->resources, wl_resource_get_link(resource));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_pointer_gestures_v1 *tablet =
|
struct wlr_pointer_gestures_v1 *gestures =
|
||||||
wl_container_of(listener, tablet, display_destroy);
|
wl_container_of(listener, gestures, display_destroy);
|
||||||
wlr_pointer_gestures_v1_destroy(tablet);
|
wl_list_remove(&gestures->display_destroy.link);
|
||||||
}
|
|
||||||
|
|
||||||
void wlr_pointer_gestures_v1_destroy(struct wlr_pointer_gestures_v1 *gestures) {
|
|
||||||
struct wl_resource *resource, *tmp;
|
|
||||||
wl_resource_for_each_safe(resource, tmp, &gestures->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
wl_resource_for_each_safe(resource, tmp, &gestures->swipes) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
wl_resource_for_each_safe(resource, tmp, &gestures->pinches) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
wl_global_destroy(gestures->global);
|
wl_global_destroy(gestures->global);
|
||||||
free(gestures);
|
free(gestures);
|
||||||
}
|
}
|
||||||
@ -320,7 +306,6 @@ struct wlr_pointer_gestures_v1 *wlr_pointer_gestures_v1_create(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_init(&gestures->resources);
|
|
||||||
wl_list_init(&gestures->swipes);
|
wl_list_init(&gestures->swipes);
|
||||||
wl_list_init(&gestures->pinches);
|
wl_list_init(&gestures->pinches);
|
||||||
|
|
||||||
|
@ -146,10 +146,6 @@ static const struct wp_presentation_interface presentation_impl = {
|
|||||||
.destroy = presentation_handle_destroy,
|
.destroy = presentation_handle_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void presentation_handle_resource_destroy(struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void presentation_bind(struct wl_client *client, void *data,
|
static void presentation_bind(struct wl_client *client, void *data,
|
||||||
uint32_t version, uint32_t id) {
|
uint32_t version, uint32_t id) {
|
||||||
struct wlr_presentation *presentation = data;
|
struct wlr_presentation *presentation = data;
|
||||||
@ -161,8 +157,7 @@ static void presentation_bind(struct wl_client *client, void *data,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_resource_set_implementation(resource, &presentation_impl, presentation,
|
wl_resource_set_implementation(resource, &presentation_impl, presentation,
|
||||||
presentation_handle_resource_destroy);
|
NULL);
|
||||||
wl_list_insert(&presentation->resources, wl_resource_get_link(resource));
|
|
||||||
|
|
||||||
wp_presentation_send_clock_id(resource, (uint32_t)presentation->clock);
|
wp_presentation_send_clock_id(resource, (uint32_t)presentation->clock);
|
||||||
}
|
}
|
||||||
@ -170,7 +165,10 @@ static void presentation_bind(struct wl_client *client, void *data,
|
|||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_presentation *presentation =
|
struct wlr_presentation *presentation =
|
||||||
wl_container_of(listener, presentation, display_destroy);
|
wl_container_of(listener, presentation, display_destroy);
|
||||||
wlr_presentation_destroy(presentation);
|
wlr_signal_emit_safe(&presentation->events.destroy, presentation);
|
||||||
|
wl_list_remove(&presentation->display_destroy.link);
|
||||||
|
wl_global_destroy(presentation->global);
|
||||||
|
free(presentation);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_presentation *wlr_presentation_create(struct wl_display *display,
|
struct wlr_presentation *wlr_presentation_create(struct wl_display *display,
|
||||||
@ -190,7 +188,6 @@ struct wlr_presentation *wlr_presentation_create(struct wl_display *display,
|
|||||||
|
|
||||||
presentation->clock = wlr_backend_get_presentation_clock(backend);
|
presentation->clock = wlr_backend_get_presentation_clock(backend);
|
||||||
|
|
||||||
wl_list_init(&presentation->resources);
|
|
||||||
wl_list_init(&presentation->feedbacks);
|
wl_list_init(&presentation->feedbacks);
|
||||||
wl_signal_init(&presentation->events.destroy);
|
wl_signal_init(&presentation->events.destroy);
|
||||||
|
|
||||||
@ -200,31 +197,6 @@ struct wlr_presentation *wlr_presentation_create(struct wl_display *display,
|
|||||||
return presentation;
|
return presentation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_presentation_destroy(struct wlr_presentation *presentation) {
|
|
||||||
if (presentation == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wlr_signal_emit_safe(&presentation->events.destroy, presentation);
|
|
||||||
|
|
||||||
wl_global_destroy(presentation->global);
|
|
||||||
|
|
||||||
struct wlr_presentation_feedback *feedback, *feedback_tmp;
|
|
||||||
wl_list_for_each_safe(feedback, feedback_tmp, &presentation->feedbacks,
|
|
||||||
link) {
|
|
||||||
wlr_presentation_feedback_destroy(feedback);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wl_resource *resource, *resource_tmp;
|
|
||||||
wl_resource_for_each_safe(resource, resource_tmp,
|
|
||||||
&presentation->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_list_remove(&presentation->display_destroy.link);
|
|
||||||
free(presentation);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wlr_presentation_feedback_send_presented(
|
void wlr_presentation_feedback_send_presented(
|
||||||
struct wlr_presentation_feedback *feedback,
|
struct wlr_presentation_feedback *feedback,
|
||||||
struct wlr_presentation_event *event) {
|
struct wlr_presentation_event *event) {
|
||||||
|
@ -434,11 +434,6 @@ static const struct zwp_primary_selection_device_manager_v1_interface
|
|||||||
.destroy = device_manager_handle_destroy,
|
.destroy = device_manager_handle_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void device_manager_handle_resource_destroy(
|
|
||||||
struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void primary_selection_device_manager_bind(struct wl_client *client,
|
static void primary_selection_device_manager_bind(struct wl_client *client,
|
||||||
void *data, uint32_t version, uint32_t id) {
|
void *data, uint32_t version, uint32_t id) {
|
||||||
@ -451,15 +446,16 @@ static void primary_selection_device_manager_bind(struct wl_client *client,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_resource_set_implementation(resource, &device_manager_impl, manager,
|
wl_resource_set_implementation(resource, &device_manager_impl, manager,
|
||||||
device_manager_handle_resource_destroy);
|
NULL);
|
||||||
|
|
||||||
wl_list_insert(&manager->resources, wl_resource_get_link(resource));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_primary_selection_v1_device_manager *manager =
|
struct wlr_primary_selection_v1_device_manager *manager =
|
||||||
wl_container_of(listener, manager, display_destroy);
|
wl_container_of(listener, manager, display_destroy);
|
||||||
wlr_primary_selection_v1_device_manager_destroy(manager);
|
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||||
|
wl_list_remove(&manager->display_destroy.link);
|
||||||
|
wl_global_destroy(manager->global);
|
||||||
|
free(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_primary_selection_v1_device_manager *
|
struct wlr_primary_selection_v1_device_manager *
|
||||||
@ -478,7 +474,6 @@ struct wlr_primary_selection_v1_device_manager *
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_init(&manager->resources);
|
|
||||||
wl_list_init(&manager->devices);
|
wl_list_init(&manager->devices);
|
||||||
wl_signal_init(&manager->events.destroy);
|
wl_signal_init(&manager->events.destroy);
|
||||||
|
|
||||||
@ -487,18 +482,3 @@ struct wlr_primary_selection_v1_device_manager *
|
|||||||
|
|
||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_primary_selection_v1_device_manager_destroy(
|
|
||||||
struct wlr_primary_selection_v1_device_manager *manager) {
|
|
||||||
if (manager == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
|
||||||
wl_list_remove(&manager->display_destroy.link);
|
|
||||||
struct wl_resource *resource, *resource_tmp;
|
|
||||||
wl_resource_for_each_safe(resource, resource_tmp, &manager->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
wl_global_destroy(manager->global);
|
|
||||||
free(manager);
|
|
||||||
}
|
|
||||||
|
@ -88,11 +88,6 @@ static void relative_pointer_handle_pointer_destroy(struct wl_listener *listener
|
|||||||
* relative_pointer_manager handler functions
|
* relative_pointer_manager handler functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void relative_pointer_manager_v1_handle_resource_destroy(struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void relative_pointer_manager_v1_handle_destroy(struct wl_client *client,
|
static void relative_pointer_manager_v1_handle_destroy(struct wl_client *client,
|
||||||
struct wl_resource *resource) {
|
struct wl_resource *resource) {
|
||||||
wl_resource_destroy(resource);
|
wl_resource_destroy(resource);
|
||||||
@ -158,25 +153,22 @@ static void relative_pointer_manager_v1_bind(struct wl_client *wl_client, void *
|
|||||||
|
|
||||||
struct wl_resource *manager_resource = wl_resource_create(wl_client,
|
struct wl_resource *manager_resource = wl_resource_create(wl_client,
|
||||||
&zwp_relative_pointer_manager_v1_interface, version, id);
|
&zwp_relative_pointer_manager_v1_interface, version, id);
|
||||||
|
|
||||||
if (manager_resource == NULL) {
|
if (manager_resource == NULL) {
|
||||||
wl_client_post_no_memory(wl_client);
|
wl_client_post_no_memory(wl_client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_insert(&manager->resources, wl_resource_get_link(manager_resource));
|
|
||||||
|
|
||||||
wl_resource_set_implementation(manager_resource, &relative_pointer_manager_v1_impl,
|
wl_resource_set_implementation(manager_resource, &relative_pointer_manager_v1_impl,
|
||||||
manager, relative_pointer_manager_v1_handle_resource_destroy);
|
manager, NULL);
|
||||||
|
|
||||||
wlr_log(WLR_DEBUG, "relative_pointer_v1 manager bound to client %p",
|
|
||||||
wl_client);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_relative_pointer_manager_v1 *manager =
|
struct wlr_relative_pointer_manager_v1 *manager =
|
||||||
wl_container_of(listener, manager, display_destroy_listener);
|
wl_container_of(listener, manager, display_destroy_listener);
|
||||||
wlr_relative_pointer_manager_v1_destroy(manager);
|
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||||
|
wl_list_remove(&manager->display_destroy_listener.link);
|
||||||
|
wl_global_destroy(manager->global);
|
||||||
|
free(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -202,18 +194,15 @@ static const struct zwp_relative_pointer_v1_interface relative_pointer_v1_impl =
|
|||||||
struct wlr_relative_pointer_manager_v1 *wlr_relative_pointer_manager_v1_create(struct wl_display *display) {
|
struct wlr_relative_pointer_manager_v1 *wlr_relative_pointer_manager_v1_create(struct wl_display *display) {
|
||||||
struct wlr_relative_pointer_manager_v1 *manager =
|
struct wlr_relative_pointer_manager_v1 *manager =
|
||||||
calloc(1, sizeof(struct wlr_relative_pointer_manager_v1));
|
calloc(1, sizeof(struct wlr_relative_pointer_manager_v1));
|
||||||
|
|
||||||
if (manager == NULL) {
|
if (manager == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_init(&manager->resources);
|
|
||||||
wl_list_init(&manager->relative_pointers);
|
wl_list_init(&manager->relative_pointers);
|
||||||
|
|
||||||
manager->global = wl_global_create(display,
|
manager->global = wl_global_create(display,
|
||||||
&zwp_relative_pointer_manager_v1_interface, RELATIVE_POINTER_MANAGER_VERSION,
|
&zwp_relative_pointer_manager_v1_interface, RELATIVE_POINTER_MANAGER_VERSION,
|
||||||
manager, relative_pointer_manager_v1_bind);
|
manager, relative_pointer_manager_v1_bind);
|
||||||
|
|
||||||
if (manager->global == NULL) {
|
if (manager->global == NULL) {
|
||||||
free(manager);
|
free(manager);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -225,31 +214,9 @@ struct wlr_relative_pointer_manager_v1 *wlr_relative_pointer_manager_v1_create(s
|
|||||||
manager->display_destroy_listener.notify = handle_display_destroy;
|
manager->display_destroy_listener.notify = handle_display_destroy;
|
||||||
wl_display_add_destroy_listener(display, &manager->display_destroy_listener);
|
wl_display_add_destroy_listener(display, &manager->display_destroy_listener);
|
||||||
|
|
||||||
wlr_log(WLR_DEBUG, "relative_pointer_v1 manager created");
|
|
||||||
|
|
||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wlr_relative_pointer_manager_v1_destroy(struct wlr_relative_pointer_manager_v1 *manager) {
|
|
||||||
if (manager == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
|
||||||
wl_list_remove(&manager->display_destroy_listener.link);
|
|
||||||
|
|
||||||
struct wl_resource *resource;
|
|
||||||
struct wl_resource *tmp_resource;
|
|
||||||
wl_resource_for_each_safe(resource, tmp_resource, &manager->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_global_destroy(manager->global);
|
|
||||||
free(manager);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wlr_relative_pointer_manager_v1_send_relative_motion(
|
void wlr_relative_pointer_manager_v1_send_relative_motion(
|
||||||
struct wlr_relative_pointer_manager_v1 *manager, struct wlr_seat *seat,
|
struct wlr_relative_pointer_manager_v1 *manager, struct wlr_seat *seat,
|
||||||
uint64_t time_usec, double dx, double dy,
|
uint64_t time_usec, double dx, double dy,
|
||||||
|
@ -481,7 +481,6 @@ static void manager_handle_resource_destroy(struct wl_resource *resource) {
|
|||||||
struct wlr_screencopy_v1_client *client =
|
struct wlr_screencopy_v1_client *client =
|
||||||
client_from_resource(resource);
|
client_from_resource(resource);
|
||||||
client_unref(client);
|
client_unref(client);
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void manager_bind(struct wl_client *wl_client, void *data,
|
static void manager_bind(struct wl_client *wl_client, void *data,
|
||||||
@ -507,8 +506,6 @@ static void manager_bind(struct wl_client *wl_client, void *data,
|
|||||||
wl_resource_set_implementation(resource, &manager_impl, client,
|
wl_resource_set_implementation(resource, &manager_impl, client,
|
||||||
manager_handle_resource_destroy);
|
manager_handle_resource_destroy);
|
||||||
|
|
||||||
wl_list_insert(&manager->resources, wl_resource_get_link(resource));
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
failure:
|
failure:
|
||||||
free(client);
|
free(client);
|
||||||
@ -518,7 +515,10 @@ failure:
|
|||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_screencopy_manager_v1 *manager =
|
struct wlr_screencopy_manager_v1 *manager =
|
||||||
wl_container_of(listener, manager, display_destroy);
|
wl_container_of(listener, manager, display_destroy);
|
||||||
wlr_screencopy_manager_v1_destroy(manager);
|
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||||
|
wl_list_remove(&manager->display_destroy.link);
|
||||||
|
wl_global_destroy(manager->global);
|
||||||
|
free(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_screencopy_manager_v1 *wlr_screencopy_manager_v1_create(
|
struct wlr_screencopy_manager_v1 *wlr_screencopy_manager_v1_create(
|
||||||
@ -536,7 +536,6 @@ struct wlr_screencopy_manager_v1 *wlr_screencopy_manager_v1_create(
|
|||||||
free(manager);
|
free(manager);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wl_list_init(&manager->resources);
|
|
||||||
wl_list_init(&manager->frames);
|
wl_list_init(&manager->frames);
|
||||||
|
|
||||||
wl_signal_init(&manager->events.destroy);
|
wl_signal_init(&manager->events.destroy);
|
||||||
@ -546,22 +545,3 @@ struct wlr_screencopy_manager_v1 *wlr_screencopy_manager_v1_create(
|
|||||||
|
|
||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_screencopy_manager_v1_destroy(
|
|
||||||
struct wlr_screencopy_manager_v1 *manager) {
|
|
||||||
if (manager == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
|
||||||
wl_list_remove(&manager->display_destroy.link);
|
|
||||||
struct wlr_screencopy_frame_v1 *frame, *tmp_frame;
|
|
||||||
wl_list_for_each_safe(frame, tmp_frame, &manager->frames, link) {
|
|
||||||
wl_resource_destroy(frame->resource);
|
|
||||||
}
|
|
||||||
struct wl_resource *resource, *tmp_resource;
|
|
||||||
wl_resource_for_each_safe(resource, tmp_resource, &manager->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
wl_global_destroy(manager->global);
|
|
||||||
free(manager);
|
|
||||||
}
|
|
||||||
|
@ -163,30 +163,13 @@ static void server_decoration_manager_bind(struct wl_client *client, void *data,
|
|||||||
manager->default_mode);
|
manager->default_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_server_decoration_manager_destroy(
|
|
||||||
struct wlr_server_decoration_manager *manager) {
|
|
||||||
if (manager == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
struct wlr_server_decoration *decoration, *tmp_decoration;
|
|
||||||
wl_list_for_each_safe(decoration, tmp_decoration, &manager->decorations,
|
|
||||||
link) {
|
|
||||||
server_decoration_destroy(decoration);
|
|
||||||
}
|
|
||||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
|
||||||
wl_list_remove(&manager->display_destroy.link);
|
|
||||||
struct wl_resource *resource, *tmp_resource;
|
|
||||||
wl_resource_for_each_safe(resource, tmp_resource, &manager->resources) {
|
|
||||||
server_decoration_manager_destroy_resource(resource);
|
|
||||||
}
|
|
||||||
wl_global_destroy(manager->global);
|
|
||||||
free(manager);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_server_decoration_manager *manager =
|
struct wlr_server_decoration_manager *manager =
|
||||||
wl_container_of(listener, manager, display_destroy);
|
wl_container_of(listener, manager, display_destroy);
|
||||||
wlr_server_decoration_manager_destroy(manager);
|
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||||
|
wl_list_remove(&manager->display_destroy.link);
|
||||||
|
wl_global_destroy(manager->global);
|
||||||
|
free(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_server_decoration_manager *wlr_server_decoration_manager_create(
|
struct wlr_server_decoration_manager *wlr_server_decoration_manager_create(
|
||||||
|
@ -280,10 +280,6 @@ static const struct zwp_text_input_manager_v3_interface
|
|||||||
.get_text_input = text_input_manager_get_text_input,
|
.get_text_input = text_input_manager_get_text_input,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void text_input_manager_unbind(struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void text_input_manager_bind(struct wl_client *wl_client, void *data,
|
static void text_input_manager_bind(struct wl_client *wl_client, void *data,
|
||||||
uint32_t version, uint32_t id) {
|
uint32_t version, uint32_t id) {
|
||||||
struct wlr_text_input_manager_v3 *manager = data;
|
struct wlr_text_input_manager_v3 *manager = data;
|
||||||
@ -295,43 +291,40 @@ static void text_input_manager_bind(struct wl_client *wl_client, void *data,
|
|||||||
wl_client_post_no_memory(wl_client);
|
wl_client_post_no_memory(wl_client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_list_insert(&manager->bound_resources, wl_resource_get_link(resource));
|
|
||||||
wl_resource_set_implementation(resource, &text_input_manager_impl,
|
wl_resource_set_implementation(resource, &text_input_manager_impl,
|
||||||
manager, text_input_manager_unbind);
|
manager, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
|
struct wlr_text_input_manager_v3 *manager =
|
||||||
|
wl_container_of(listener, manager, display_destroy);
|
||||||
|
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||||
|
wl_list_remove(&manager->display_destroy.link);
|
||||||
|
wl_global_destroy(manager->global);
|
||||||
|
free(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_text_input_manager_v3 *wlr_text_input_manager_v3_create(
|
struct wlr_text_input_manager_v3 *wlr_text_input_manager_v3_create(
|
||||||
struct wl_display *wl_display) {
|
struct wl_display *display) {
|
||||||
struct wlr_text_input_manager_v3 *manager =
|
struct wlr_text_input_manager_v3 *manager =
|
||||||
calloc(1, sizeof(struct wlr_text_input_manager_v3));
|
calloc(1, sizeof(struct wlr_text_input_manager_v3));
|
||||||
wl_list_init(&manager->bound_resources);
|
if (!manager) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
wl_list_init(&manager->text_inputs);
|
wl_list_init(&manager->text_inputs);
|
||||||
wl_signal_init(&manager->events.text_input);
|
wl_signal_init(&manager->events.text_input);
|
||||||
manager->global = wl_global_create(wl_display,
|
|
||||||
|
manager->global = wl_global_create(display,
|
||||||
&zwp_text_input_manager_v3_interface, 1, manager,
|
&zwp_text_input_manager_v3_interface, 1, manager,
|
||||||
text_input_manager_bind);
|
text_input_manager_bind);
|
||||||
if (!manager->global) {
|
if (!manager->global) {
|
||||||
free(manager);
|
free(manager);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
manager->display_destroy.notify = handle_display_destroy;
|
||||||
|
wl_display_add_destroy_listener(display, &manager->display_destroy);
|
||||||
|
|
||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_text_input_manager_v3_destroy(
|
|
||||||
struct wlr_text_input_manager_v3 *manager) {
|
|
||||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
|
||||||
wl_list_remove(&manager->display_destroy.link);
|
|
||||||
|
|
||||||
struct wl_resource *resource, *resource_tmp;
|
|
||||||
wl_resource_for_each_safe(resource, resource_tmp,
|
|
||||||
&manager->bound_resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
struct wlr_text_input_v3 *text_input, *text_input_tmp;
|
|
||||||
wl_list_for_each_safe(text_input, text_input_tmp, &manager->text_inputs,
|
|
||||||
link) {
|
|
||||||
wl_resource_destroy(text_input->resource);
|
|
||||||
}
|
|
||||||
wl_global_destroy(manager->global);
|
|
||||||
free(manager);
|
|
||||||
}
|
|
||||||
|
@ -196,31 +196,27 @@ static const struct zwp_virtual_keyboard_manager_v1_interface manager_impl = {
|
|||||||
.create_virtual_keyboard = virtual_keyboard_manager_create_virtual_keyboard,
|
.create_virtual_keyboard = virtual_keyboard_manager_create_virtual_keyboard,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void handle_manager_unbind(struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void virtual_keyboard_manager_bind(struct wl_client *client, void *data,
|
static void virtual_keyboard_manager_bind(struct wl_client *client, void *data,
|
||||||
uint32_t version, uint32_t id) {
|
uint32_t version, uint32_t id) {
|
||||||
struct wlr_virtual_keyboard_manager_v1 *manager = data;
|
struct wlr_virtual_keyboard_manager_v1 *manager = data;
|
||||||
|
|
||||||
struct wl_resource *resource = wl_resource_create(client,
|
struct wl_resource *resource = wl_resource_create(client,
|
||||||
&zwp_virtual_keyboard_manager_v1_interface, version, id);
|
&zwp_virtual_keyboard_manager_v1_interface, version, id);
|
||||||
|
|
||||||
if (!resource) {
|
if (!resource) {
|
||||||
wl_client_post_no_memory(client);
|
wl_client_post_no_memory(client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_resource_set_implementation(resource, &manager_impl, manager,
|
wl_resource_set_implementation(resource, &manager_impl, manager, NULL);
|
||||||
handle_manager_unbind);
|
|
||||||
wl_list_insert(&manager->resources, wl_resource_get_link(resource));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_virtual_keyboard_manager_v1 *manager =
|
struct wlr_virtual_keyboard_manager_v1 *manager =
|
||||||
wl_container_of(listener, manager, display_destroy);
|
wl_container_of(listener, manager, display_destroy);
|
||||||
wlr_virtual_keyboard_manager_v1_destroy(manager);
|
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||||
|
wl_list_remove(&manager->display_destroy.link);
|
||||||
|
wl_global_destroy(manager->global);
|
||||||
|
free(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_virtual_keyboard_manager_v1*
|
struct wlr_virtual_keyboard_manager_v1*
|
||||||
@ -232,33 +228,21 @@ struct wlr_virtual_keyboard_manager_v1*
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
manager->global = wl_global_create(display,
|
||||||
|
&zwp_virtual_keyboard_manager_v1_interface, 1, manager,
|
||||||
|
virtual_keyboard_manager_bind);
|
||||||
|
if (!manager->global) {
|
||||||
|
free(manager);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
manager->display_destroy.notify = handle_display_destroy;
|
manager->display_destroy.notify = handle_display_destroy;
|
||||||
wl_display_add_destroy_listener(display, &manager->display_destroy);
|
wl_display_add_destroy_listener(display, &manager->display_destroy);
|
||||||
|
|
||||||
wl_list_init(&manager->resources);
|
|
||||||
wl_list_init(&manager->virtual_keyboards);
|
wl_list_init(&manager->virtual_keyboards);
|
||||||
|
|
||||||
wl_signal_init(&manager->events.new_virtual_keyboard);
|
wl_signal_init(&manager->events.new_virtual_keyboard);
|
||||||
wl_signal_init(&manager->events.destroy);
|
wl_signal_init(&manager->events.destroy);
|
||||||
manager->global = wl_global_create(display,
|
|
||||||
&zwp_virtual_keyboard_manager_v1_interface, 1, manager,
|
|
||||||
virtual_keyboard_manager_bind);
|
|
||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_virtual_keyboard_manager_v1_destroy(
|
|
||||||
struct wlr_virtual_keyboard_manager_v1 *manager) {
|
|
||||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
|
||||||
wl_list_remove(&manager->display_destroy.link);
|
|
||||||
wl_global_destroy(manager->global);
|
|
||||||
struct wl_resource *resource, *resource_tmp;
|
|
||||||
wl_resource_for_each_safe(resource, resource_tmp, &manager->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
struct wlr_virtual_keyboard_v1 *keyboard, *keyboard_tmp;
|
|
||||||
wl_list_for_each_safe(keyboard, keyboard_tmp, &manager->virtual_keyboards,
|
|
||||||
link) {
|
|
||||||
wl_resource_destroy(keyboard->resource);
|
|
||||||
}
|
|
||||||
free(manager);
|
|
||||||
}
|
|
||||||
|
@ -238,11 +238,6 @@ static const struct zxdg_decoration_manager_v1_interface
|
|||||||
.get_toplevel_decoration = decoration_manager_handle_get_toplevel_decoration,
|
.get_toplevel_decoration = decoration_manager_handle_get_toplevel_decoration,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void decoration_manager_handle_resource_destroy(
|
|
||||||
struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void decoration_manager_bind(struct wl_client *client, void *data,
|
static void decoration_manager_bind(struct wl_client *client, void *data,
|
||||||
uint32_t version, uint32_t id) {
|
uint32_t version, uint32_t id) {
|
||||||
struct wlr_xdg_decoration_manager_v1 *manager = data;
|
struct wlr_xdg_decoration_manager_v1 *manager = data;
|
||||||
@ -254,15 +249,16 @@ static void decoration_manager_bind(struct wl_client *client, void *data,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_resource_set_implementation(resource, &decoration_manager_impl,
|
wl_resource_set_implementation(resource, &decoration_manager_impl,
|
||||||
manager, decoration_manager_handle_resource_destroy);
|
manager, NULL);
|
||||||
|
|
||||||
wl_list_insert(&manager->resources, wl_resource_get_link(resource));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_xdg_decoration_manager_v1 *manager =
|
struct wlr_xdg_decoration_manager_v1 *manager =
|
||||||
wl_container_of(listener, manager, display_destroy);
|
wl_container_of(listener, manager, display_destroy);
|
||||||
wlr_xdg_decoration_manager_v1_destroy(manager);
|
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||||
|
wl_list_remove(&manager->display_destroy.link);
|
||||||
|
wl_global_destroy(manager->global);
|
||||||
|
free(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_xdg_decoration_manager_v1 *
|
struct wlr_xdg_decoration_manager_v1 *
|
||||||
@ -279,7 +275,6 @@ struct wlr_xdg_decoration_manager_v1 *
|
|||||||
free(manager);
|
free(manager);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wl_list_init(&manager->resources);
|
|
||||||
wl_list_init(&manager->decorations);
|
wl_list_init(&manager->decorations);
|
||||||
wl_signal_init(&manager->events.new_toplevel_decoration);
|
wl_signal_init(&manager->events.new_toplevel_decoration);
|
||||||
wl_signal_init(&manager->events.destroy);
|
wl_signal_init(&manager->events.destroy);
|
||||||
@ -289,23 +284,3 @@ struct wlr_xdg_decoration_manager_v1 *
|
|||||||
|
|
||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_xdg_decoration_manager_v1_destroy(
|
|
||||||
struct wlr_xdg_decoration_manager_v1 *manager) {
|
|
||||||
if (manager == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
|
||||||
wl_list_remove(&manager->display_destroy.link);
|
|
||||||
struct wlr_xdg_toplevel_decoration_v1 *decoration, *tmp_decoration;
|
|
||||||
wl_list_for_each_safe(decoration, tmp_decoration, &manager->decorations,
|
|
||||||
link) {
|
|
||||||
wl_resource_destroy(decoration->resource);
|
|
||||||
}
|
|
||||||
struct wl_resource *resource, *tmp_resource;
|
|
||||||
wl_resource_for_each_safe(resource, tmp_resource, &manager->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
wl_global_destroy(manager->global);
|
|
||||||
free(manager);
|
|
||||||
}
|
|
||||||
|
@ -142,11 +142,6 @@ static const struct zxdg_output_manager_v1_interface
|
|||||||
.get_xdg_output = output_manager_handle_get_xdg_output,
|
.get_xdg_output = output_manager_handle_get_xdg_output,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void output_manager_handle_resource_destroy(
|
|
||||||
struct wl_resource *resource) {
|
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void output_manager_bind(struct wl_client *wl_client, void *data,
|
static void output_manager_bind(struct wl_client *wl_client, void *data,
|
||||||
uint32_t version, uint32_t id) {
|
uint32_t version, uint32_t id) {
|
||||||
struct wlr_xdg_output_manager_v1 *manager = data;
|
struct wlr_xdg_output_manager_v1 *manager = data;
|
||||||
@ -158,8 +153,7 @@ static void output_manager_bind(struct wl_client *wl_client, void *data,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_resource_set_implementation(resource, &output_manager_implementation,
|
wl_resource_set_implementation(resource, &output_manager_implementation,
|
||||||
manager, output_manager_handle_resource_destroy);
|
manager, NULL);
|
||||||
wl_list_insert(&manager->resources, wl_resource_get_link(resource));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_output_destroy(struct wl_listener *listener, void *data) {
|
static void handle_output_destroy(struct wl_listener *listener, void *data) {
|
||||||
@ -203,16 +197,29 @@ static void handle_layout_change(struct wl_listener *listener, void *data) {
|
|||||||
output_manager_send_details(manager);
|
output_manager_send_details(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void manager_destroy(struct wlr_xdg_output_manager_v1 *manager) {
|
||||||
|
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||||
|
wl_list_remove(&manager->display_destroy.link);
|
||||||
|
wl_list_remove(&manager->layout_add.link);
|
||||||
|
wl_list_remove(&manager->layout_change.link);
|
||||||
|
wl_list_remove(&manager->layout_destroy.link);
|
||||||
|
free(manager);
|
||||||
|
}
|
||||||
|
|
||||||
static void handle_layout_destroy(struct wl_listener *listener, void *data) {
|
static void handle_layout_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_xdg_output_manager_v1 *manager =
|
struct wlr_xdg_output_manager_v1 *manager =
|
||||||
wl_container_of(listener, manager, layout_destroy);
|
wl_container_of(listener, manager, layout_destroy);
|
||||||
wlr_xdg_output_manager_v1_destroy(manager);
|
manager_destroy(manager);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
|
struct wlr_xdg_output_manager_v1 *manager =
|
||||||
|
wl_container_of(listener, manager, display_destroy);
|
||||||
|
manager_destroy(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_xdg_output_manager_v1 *wlr_xdg_output_manager_v1_create(
|
struct wlr_xdg_output_manager_v1 *wlr_xdg_output_manager_v1_create(
|
||||||
struct wl_display *display, struct wlr_output_layout *layout) {
|
struct wl_display *display, struct wlr_output_layout *layout) {
|
||||||
assert(display && layout);
|
|
||||||
|
|
||||||
// TODO: require wayland-protocols 1.18 and remove this condition
|
// TODO: require wayland-protocols 1.18 and remove this condition
|
||||||
int version = OUTPUT_MANAGER_VERSION;
|
int version = OUTPUT_MANAGER_VERSION;
|
||||||
if (version > zxdg_output_manager_v1_interface.version) {
|
if (version > zxdg_output_manager_v1_interface.version) {
|
||||||
@ -233,7 +240,6 @@ struct wlr_xdg_output_manager_v1 *wlr_xdg_output_manager_v1_create(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_init(&manager->resources);
|
|
||||||
wl_list_init(&manager->outputs);
|
wl_list_init(&manager->outputs);
|
||||||
struct wlr_output_layout_output *layout_output;
|
struct wlr_output_layout_output *layout_output;
|
||||||
wl_list_for_each(layout_output, &layout->outputs, link) {
|
wl_list_for_each(layout_output, &layout->outputs, link) {
|
||||||
@ -248,21 +254,9 @@ struct wlr_xdg_output_manager_v1 *wlr_xdg_output_manager_v1_create(
|
|||||||
wl_signal_add(&layout->events.change, &manager->layout_change);
|
wl_signal_add(&layout->events.change, &manager->layout_change);
|
||||||
manager->layout_destroy.notify = handle_layout_destroy;
|
manager->layout_destroy.notify = handle_layout_destroy;
|
||||||
wl_signal_add(&layout->events.destroy, &manager->layout_destroy);
|
wl_signal_add(&layout->events.destroy, &manager->layout_destroy);
|
||||||
|
|
||||||
|
manager->display_destroy.notify = handle_display_destroy;
|
||||||
|
wl_display_add_destroy_listener(display, &manager->display_destroy);
|
||||||
|
|
||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_xdg_output_manager_v1_destroy(struct wlr_xdg_output_manager_v1 *manager) {
|
|
||||||
struct wlr_xdg_output_v1 *output, *output_tmp;
|
|
||||||
wl_list_for_each_safe(output, output_tmp, &manager->outputs, link) {
|
|
||||||
output_destroy(output);
|
|
||||||
}
|
|
||||||
struct wl_resource *resource, *resource_tmp;
|
|
||||||
wl_resource_for_each_safe(resource, resource_tmp, &manager->resources) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
|
||||||
wl_list_remove(&manager->layout_add.link);
|
|
||||||
wl_list_remove(&manager->layout_change.link);
|
|
||||||
wl_list_remove(&manager->layout_destroy.link);
|
|
||||||
free(manager);
|
|
||||||
}
|
|
||||||
|
@ -131,7 +131,10 @@ static void xdg_shell_bind(struct wl_client *wl_client, void *data,
|
|||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_xdg_shell *xdg_shell =
|
struct wlr_xdg_shell *xdg_shell =
|
||||||
wl_container_of(listener, xdg_shell, display_destroy);
|
wl_container_of(listener, xdg_shell, display_destroy);
|
||||||
wlr_xdg_shell_destroy(xdg_shell);
|
wlr_signal_emit_safe(&xdg_shell->events.destroy, xdg_shell);
|
||||||
|
wl_list_remove(&xdg_shell->display_destroy.link);
|
||||||
|
wl_global_destroy(xdg_shell->global);
|
||||||
|
free(xdg_shell);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_xdg_shell *wlr_xdg_shell_create(struct wl_display *display) {
|
struct wlr_xdg_shell *wlr_xdg_shell_create(struct wl_display *display) {
|
||||||
@ -162,13 +165,3 @@ struct wlr_xdg_shell *wlr_xdg_shell_create(struct wl_display *display) {
|
|||||||
|
|
||||||
return xdg_shell;
|
return xdg_shell;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_xdg_shell_destroy(struct wlr_xdg_shell *xdg_shell) {
|
|
||||||
if (!xdg_shell) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wlr_signal_emit_safe(&xdg_shell->events.destroy, xdg_shell);
|
|
||||||
wl_list_remove(&xdg_shell->display_destroy.link);
|
|
||||||
wl_global_destroy(xdg_shell->global);
|
|
||||||
free(xdg_shell);
|
|
||||||
}
|
|
||||||
|
@ -132,7 +132,10 @@ static void xdg_shell_bind(struct wl_client *wl_client, void *data,
|
|||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_xdg_shell_v6 *xdg_shell =
|
struct wlr_xdg_shell_v6 *xdg_shell =
|
||||||
wl_container_of(listener, xdg_shell, display_destroy);
|
wl_container_of(listener, xdg_shell, display_destroy);
|
||||||
wlr_xdg_shell_v6_destroy(xdg_shell);
|
wlr_signal_emit_safe(&xdg_shell->events.destroy, xdg_shell);
|
||||||
|
wl_list_remove(&xdg_shell->display_destroy.link);
|
||||||
|
wl_global_destroy(xdg_shell->global);
|
||||||
|
free(xdg_shell);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_xdg_shell_v6 *wlr_xdg_shell_v6_create(struct wl_display *display) {
|
struct wlr_xdg_shell_v6 *wlr_xdg_shell_v6_create(struct wl_display *display) {
|
||||||
@ -163,13 +166,3 @@ struct wlr_xdg_shell_v6 *wlr_xdg_shell_v6_create(struct wl_display *display) {
|
|||||||
|
|
||||||
return xdg_shell;
|
return xdg_shell;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_xdg_shell_v6_destroy(struct wlr_xdg_shell_v6 *xdg_shell) {
|
|
||||||
if (!xdg_shell) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wlr_signal_emit_safe(&xdg_shell->events.destroy, xdg_shell);
|
|
||||||
wl_list_remove(&xdg_shell->display_destroy.link);
|
|
||||||
wl_global_destroy(xdg_shell->global);
|
|
||||||
free(xdg_shell);
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user