mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-29 07:55:59 +01:00
Merge pull request #1200 from alexbakker/destroy-signal
Add destroy signals to types that are destroyed by wl_display_destroy
This commit is contained in:
commit
792f98c2f0
35 changed files with 68 additions and 5 deletions
|
@ -125,6 +125,7 @@ void wlr_session_destroy(struct wlr_session *session) {
|
|||
return;
|
||||
}
|
||||
|
||||
wlr_signal_emit_safe(&session->events.destroy, session);
|
||||
wl_list_remove(&session->display_destroy.link);
|
||||
|
||||
wl_event_source_remove(session->udev_event);
|
||||
|
|
|
@ -39,6 +39,10 @@ struct wlr_session {
|
|||
struct wl_list devices;
|
||||
|
||||
struct wl_listener display_destroy;
|
||||
|
||||
struct {
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -17,6 +17,10 @@ struct wlr_gamma_control_manager {
|
|||
|
||||
struct wl_listener display_destroy;
|
||||
|
||||
struct {
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
||||
|
|
|
@ -10,6 +10,10 @@ struct wlr_gamma_control_manager_v1 {
|
|||
|
||||
struct wl_listener display_destroy;
|
||||
|
||||
struct {
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ struct wlr_idle {
|
|||
struct wl_listener display_destroy;
|
||||
struct {
|
||||
struct wl_signal activity_notify;
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
|
|
|
@ -32,6 +32,7 @@ struct wlr_idle_inhibit_manager_v1 {
|
|||
|
||||
struct {
|
||||
struct wl_signal new_inhibitor;
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
|
|
|
@ -20,6 +20,7 @@ struct wlr_input_inhibit_manager {
|
|||
struct {
|
||||
struct wl_signal activate; // struct wlr_input_inhibit_manager *
|
||||
struct wl_signal deactivate; // struct wlr_input_inhibit_manager *
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
|
|
|
@ -39,6 +39,7 @@ struct wlr_layer_shell {
|
|||
// Note: the output may be NULL. In this case, it is your
|
||||
// responsibility to assign an output before returning.
|
||||
struct wl_signal new_surface;
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
|
|
|
@ -17,6 +17,10 @@ struct wlr_primary_selection_device_manager {
|
|||
|
||||
struct wl_listener display_destroy;
|
||||
|
||||
struct {
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
||||
|
|
|
@ -18,6 +18,10 @@ struct wlr_screencopy_manager_v1 {
|
|||
|
||||
struct wl_listener display_destroy;
|
||||
|
||||
struct {
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@ struct wlr_screenshooter {
|
|||
|
||||
struct wl_listener display_destroy;
|
||||
|
||||
struct {
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ struct wlr_server_decoration_manager {
|
|||
|
||||
struct {
|
||||
struct wl_signal new_decoration;
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
|
|
|
@ -29,6 +29,10 @@ struct wlr_tablet_manager_v2 {
|
|||
|
||||
struct wl_listener display_destroy;
|
||||
|
||||
struct {
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ struct wlr_virtual_keyboard_manager_v1 {
|
|||
|
||||
struct {
|
||||
struct wl_signal new_virtual_keyboard; // struct wlr_virtual_keyboard_v1*
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
};
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ struct wlr_wl_shell {
|
|||
|
||||
struct {
|
||||
struct wl_signal new_surface;
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
|
|
|
@ -19,6 +19,7 @@ struct wlr_xdg_decoration_manager_v1 {
|
|||
|
||||
struct {
|
||||
struct wl_signal new_toplevel_decoration; // struct wlr_xdg_toplevel_decoration *
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
|
|
|
@ -34,6 +34,10 @@ struct wlr_xdg_output_manager {
|
|||
struct wl_listener layout_add;
|
||||
struct wl_listener layout_change;
|
||||
struct wl_listener layout_destroy;
|
||||
|
||||
struct {
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
};
|
||||
|
||||
struct wlr_xdg_output_manager *wlr_xdg_output_manager_create(
|
||||
|
|
|
@ -29,6 +29,7 @@ struct wlr_xdg_shell {
|
|||
* surface will be ready to be managed on the `map` event.
|
||||
*/
|
||||
struct wl_signal new_surface;
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
|
|
|
@ -30,6 +30,7 @@ struct wlr_xdg_shell_v6 {
|
|||
* surface will be ready to be managed on the `map` event.
|
||||
*/
|
||||
struct wl_signal new_surface;
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <wlr/types/wlr_tablet_v2.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "tablet-unstable-v2-protocol.h"
|
||||
#include "util/signal.h"
|
||||
|
||||
#define TABLET_MANAGER_VERSION 1
|
||||
|
||||
|
@ -281,6 +282,7 @@ void wlr_tablet_v2_destroy(struct wlr_tablet_manager_v2 *manager) {
|
|||
wlr_tablet_manager_v2_destroy(pos->resource);
|
||||
}
|
||||
|
||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||
wl_global_destroy(manager->wl_global);
|
||||
free(manager);
|
||||
}
|
||||
|
|
|
@ -155,11 +155,12 @@ void wlr_gamma_control_manager_destroy(
|
|||
if (!manager) {
|
||||
return;
|
||||
}
|
||||
wl_list_remove(&manager->display_destroy.link);
|
||||
struct wlr_gamma_control *gamma_control, *tmp;
|
||||
wl_list_for_each_safe(gamma_control, tmp, &manager->controls, link) {
|
||||
gamma_control_destroy(gamma_control);
|
||||
}
|
||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||
wl_list_remove(&manager->display_destroy.link);
|
||||
wl_global_destroy(manager->global);
|
||||
free(manager);
|
||||
}
|
||||
|
|
|
@ -219,11 +219,12 @@ void wlr_gamma_control_manager_v1_destroy(
|
|||
if (!manager) {
|
||||
return;
|
||||
}
|
||||
wl_list_remove(&manager->display_destroy.link);
|
||||
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);
|
||||
|
|
|
@ -187,6 +187,7 @@ 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) {
|
||||
|
|
|
@ -144,14 +144,15 @@ void wlr_idle_inhibit_v1_destroy(struct wlr_idle_inhibit_manager_v1 *idle_inhibi
|
|||
return;
|
||||
}
|
||||
|
||||
wl_list_remove(&idle_inhibit->display_destroy.link);
|
||||
|
||||
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) {
|
||||
|
|
|
@ -112,6 +112,7 @@ void wlr_input_inhibit_manager_destroy(
|
|||
input_inhibitor_destroy(manager->active_client,
|
||||
manager->active_inhibitor);
|
||||
}
|
||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||
wl_list_remove(&manager->display_destroy.link);
|
||||
wl_global_destroy(manager->global);
|
||||
free(manager);
|
||||
|
|
|
@ -464,6 +464,7 @@ void wlr_layer_shell_destroy(struct wlr_layer_shell *layer_shell) {
|
|||
wl_resource_for_each_safe(client, tmp, &layer_shell->client_resources) {
|
||||
wl_resource_destroy(client);
|
||||
}
|
||||
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);
|
||||
|
|
|
@ -419,6 +419,7 @@ void wlr_primary_selection_device_manager_destroy(
|
|||
if (manager == NULL) {
|
||||
return;
|
||||
}
|
||||
wlr_signal_emit_safe(&manager->events.destroy, manager);
|
||||
wl_list_remove(&manager->display_destroy.link);
|
||||
// TODO: free resources
|
||||
wl_global_destroy(manager->global);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <wlr/types/wlr_screencopy_v1.h>
|
||||
#include <wlr/backend.h>
|
||||
#include "wlr-screencopy-unstable-v1-protocol.h"
|
||||
#include "util/signal.h"
|
||||
|
||||
#define SCREENCOPY_MANAGER_VERSION 1
|
||||
|
||||
|
@ -306,6 +307,7 @@ void wlr_screencopy_manager_v1_destroy(
|
|||
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) {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <wlr/types/wlr_screenshooter.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "screenshooter-protocol.h"
|
||||
#include "util/signal.h"
|
||||
|
||||
static struct wlr_screenshot *screenshot_from_resource(
|
||||
struct wl_resource *resource) {
|
||||
|
@ -177,6 +178,7 @@ void wlr_screenshooter_destroy(struct wlr_screenshooter *screenshooter) {
|
|||
wl_list_for_each_safe(screenshot, tmp, &screenshooter->screenshots, link) {
|
||||
screenshot_destroy(screenshot);
|
||||
}
|
||||
wlr_signal_emit_safe(&screenshooter->events.destroy, screenshooter);
|
||||
wl_global_destroy(screenshooter->global);
|
||||
free(screenshooter);
|
||||
}
|
||||
|
|
|
@ -167,12 +167,13 @@ void wlr_server_decoration_manager_destroy(
|
|||
if (manager == NULL) {
|
||||
return;
|
||||
}
|
||||
wl_list_remove(&manager->display_destroy.link);
|
||||
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);
|
||||
|
|
|
@ -231,6 +231,7 @@ struct wlr_virtual_keyboard_manager_v1*
|
|||
|
||||
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;
|
||||
|
|
|
@ -287,6 +287,7 @@ void wlr_xdg_decoration_manager_v1_destroy(
|
|||
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,
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <wlr/types/wlr_xdg_output.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "xdg-output-unstable-v1-protocol.h"
|
||||
#include "util/signal.h"
|
||||
|
||||
#define OUTPUT_MANAGER_VERSION 2
|
||||
|
||||
|
@ -245,6 +246,7 @@ void wlr_xdg_output_manager_destroy(struct wlr_xdg_output_manager *manager) {
|
|||
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);
|
||||
|
|
|
@ -166,6 +166,7 @@ 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);
|
||||
|
|
|
@ -167,6 +167,7 @@ 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 a new issue