mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-12 16:35:58 +01:00
xdg-activation: Allow to submit tokens
Allows the compositor to submit tokens to the pool of currently active tokens. This can be useful when the launcher doesn't use or support xdg-activation-v1 by itself - e.g. when it is X11 based or use gtk_shell1.
This commit is contained in:
parent
31914928d2
commit
4c59f7d46a
2 changed files with 24 additions and 0 deletions
|
@ -81,4 +81,8 @@ struct wlr_xdg_activation_token_v1 *wlr_xdg_activation_v1_find_token(
|
|||
const char *wlr_xdg_activation_token_v1_get_name(
|
||||
struct wlr_xdg_activation_token_v1 *token);
|
||||
|
||||
// Add a token to the pool of known tokens
|
||||
struct wlr_xdg_activation_token_v1 *wlr_xdg_activation_v1_add_token(
|
||||
struct wlr_xdg_activation_v1 *activation, const char *token_str);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -407,3 +407,23 @@ const char *wlr_xdg_activation_token_v1_get_name(
|
|||
struct wlr_xdg_activation_token_v1 *token) {
|
||||
return token->token;
|
||||
}
|
||||
|
||||
struct wlr_xdg_activation_token_v1 *wlr_xdg_activation_v1_add_token(
|
||||
struct wlr_xdg_activation_v1 *activation, const char *token_str) {
|
||||
assert(token_str);
|
||||
|
||||
struct wlr_xdg_activation_token_v1 *token = calloc(1, sizeof(*token));
|
||||
if (token == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
wl_list_init(&token->link);
|
||||
wl_list_init(&token->seat_destroy.link);
|
||||
wl_list_init(&token->surface_destroy.link);
|
||||
|
||||
token->activation = activation;
|
||||
token->token = strdup(token_str);
|
||||
|
||||
wl_list_insert(&activation->tokens, &token->link);
|
||||
|
||||
return token;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue