xdg-activation-v1: add data field and emit token destroy events
The data field is useful to track metadata about a token. The destroy events are useful for compositors that track application startup to let them know they can stop doing that.
This commit is contained in:
parent
6ad0f819e2
commit
e2aff8a9b0
|
@ -22,6 +22,12 @@ struct wlr_xdg_activation_token_v1 {
|
||||||
char *app_id; // can be NULL
|
char *app_id; // can be NULL
|
||||||
struct wl_list link; // wlr_xdg_activation_v1.tokens
|
struct wl_list link; // wlr_xdg_activation_v1.tokens
|
||||||
|
|
||||||
|
void *data;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct wl_signal destroy;
|
||||||
|
} events;
|
||||||
|
|
||||||
// private state
|
// private state
|
||||||
|
|
||||||
char *token;
|
char *token;
|
||||||
|
|
|
@ -32,6 +32,9 @@ void wlr_xdg_activation_token_v1_destroy(
|
||||||
if (token->timeout != NULL) {
|
if (token->timeout != NULL) {
|
||||||
wl_event_source_remove(token->timeout);
|
wl_event_source_remove(token->timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wlr_signal_emit_safe(&token->events.destroy, NULL);
|
||||||
|
|
||||||
wl_list_remove(&token->link);
|
wl_list_remove(&token->link);
|
||||||
wl_list_remove(&token->seat_destroy.link);
|
wl_list_remove(&token->seat_destroy.link);
|
||||||
wl_list_remove(&token->surface_destroy.link);
|
wl_list_remove(&token->surface_destroy.link);
|
||||||
|
@ -258,6 +261,7 @@ static void activation_handle_get_activation_token(struct wl_client *client,
|
||||||
wl_list_init(&token->link);
|
wl_list_init(&token->link);
|
||||||
wl_list_init(&token->seat_destroy.link);
|
wl_list_init(&token->seat_destroy.link);
|
||||||
wl_list_init(&token->surface_destroy.link);
|
wl_list_init(&token->surface_destroy.link);
|
||||||
|
wl_signal_init(&token->events.destroy);
|
||||||
|
|
||||||
token->activation = activation;
|
token->activation = activation;
|
||||||
|
|
||||||
|
@ -376,6 +380,7 @@ struct wlr_xdg_activation_token_v1 *wlr_xdg_activation_token_v1_create(
|
||||||
// Currently no way to set seat/surface
|
// Currently no way to set seat/surface
|
||||||
wl_list_init(&token->seat_destroy.link);
|
wl_list_init(&token->seat_destroy.link);
|
||||||
wl_list_init(&token->surface_destroy.link);
|
wl_list_init(&token->surface_destroy.link);
|
||||||
|
wl_signal_init(&token->events.destroy);
|
||||||
|
|
||||||
token->activation = activation;
|
token->activation = activation;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue