-
Notifications
You must be signed in to change notification settings - Fork 341
xdg-activation-v1: new protocol implementation #2718
Conversation
c38cf54
to
f04ed15
Compare
77757e9
to
42cf571
Compare
Getting a crash when I set a surface on the token, but nothing else: struct xdg_activation_token_v1 *token = xdg_activation_v1_get_activation_token(term->wl->xdg_activation);
xassert(token != NULL);
xdg_activation_token_v1_add_listener(token, &activation_token_listener, term);
xdg_activation_token_v1_set_surface(token, term->window->surface);
xdg_activation_token_v1_commit(token); Backtrace:
if (token->surface != token->seat->keyboard_state.focused_surface) {
wlr_log(WLR_DEBUG, "Rejecting token commit request: "
"surface doesn't have keyboard focus");
goto error;
} The reason I did this was because without setting a surface, I got:
I was under the impression setting the surface was optional? What am I missing?
|
Should be fixed now. I've tested with foot's xdg-activation branch and it seems to work as expected. Setting the surface is optional, but is recommended so that the compositor can better track where the request comes from. A compositor might reject requests without a surface coming from clients which have surfaces opened, for instance. |
Thanks, works for me as well now. I've updated foot's xdg-activation branch to set the token surface to the top-level surface, and everything appears to (still) be working as expected. |
Compositors should probably:
|
I'm trying to implement urgency in dwl using foot as a testcase, but I'm getting a null dereference in if (token->surface != token->seat->keyboard_state.focused_surface) { with |
It looks kind of like it (the xdg-activation) branch has been reverted to the original version, where Sway also crashed. 677d6a2 is the last version I tested (and found working) with foot. It looks vastly different. |
Hm, sorry, I probably messed up a rebase. I restored the branch. |
Added a token timeout to avoid these dangling token issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
This implements the new xdg-activation-v1 protocol [1]. [1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/50
There isn't always a good time to prune old tokens. Compositors which only implement a "give focus on activation" logic can prune tokens on focus change. However other compositors might want to implement other semantics, e.g. "mark urgent on activation". In this case a focus change shouldn't invalidate other tokens. Additionally, some tokens aren't necessarily tied to a seat. To avoid ending up with an ever-growing list of tokens, add a timeout.
See https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/50