-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
activation_token: Provide GTK 4 helper #224
activation_token: Provide GTK 4 helper #224
Conversation
4c98558
to
4c83a24
Compare
4c83a24
to
f6d8103
Compare
Should this add the v2_76 feature to glib? |
fe7eeb2
to
63cc4ed
Compare
We will need to figure out a way to expose that, yes. Enabling it by default is a no-no |
I'm not sure having a helper like this is helpful. That your helper introduces more confusion. I have the worry that users may think they can keep the Maybe a better way would be to hide the activation token from the user all together and call For context have a look on how the token is generated: https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/wayland/gdkapplaunchcontext-wayland.c#L65 |
Alternatively, one can make the token non-clonable+require ownership, hence single use. But yeah, this is something to take into account. |
It could be an option to get the activation token from the launch context only on Would be good to have some usage examples. |
63cc4ed
to
ff0fbf6
Compare
Well, one can make all the methods that takes an ActivationToken not take a reference.
That assumes the library is targetting gtk only, which is not.
Well, it seems there is no way to destroy the xdg-activation? so what would make it invalid per your sentence above? Imho, we are already doing exactly this for the WindowIdentifier. Except in those cases, we have a proper way to unexport the handle under wayland which we are properly handling under wayland. |
2cf7ff6
to
0af9f06
Compare
If we want to be strict:
I feel we can get away with just removing the |
It's not that the token gets invalidated. But it may not be accepted any more for activation from Mutter. The token is tight to the user interaction. See: https://wayland.app/protocols/xdg-activation-v1 |
Yeah, i saw how you handle WindowIdentifier and it matches the suggestion here. But activation token works differently.
I didn't mend that we shouldn't remove the current way of setting the activation token. |
What are the differences?
Understood that
I don't see where in the spec it says anything like that? |
The activation token should be created with a recent serial (generally obtained from an input event). The window handle on the other side is constant and valid till it's unexported.
https://wayland.app/protocols/xdg-activation-v1#xdg_activation_token_v1:request:set_serial |
Sure, but nothing in the currently suggested API makes it sound like you can keep it around. We can just make any API that takes an ActivationToken takes it by value instead of by ref, remove Clone implementation and you are done? Basically what @A6GibKm suggested above. |
I think consuming and not allowing clones of My concern is that the developer gets the impression that the Also we really don't want developers to call I'm not sure that good documentation is enough. |
Wait what, you would call the portal the moment the user clicks on a button. Why would you create it beforehand ? I am not sure about your worry here. People would just copy paste the examples, so if the examples are correct I don't see what more we could do here. |
Yes, that's how focus stealing prevention works. I really need to finish my blogpost about this. |
I understand what you are saying here, but your "requirements" can not be worked around by a "better API", it is the programmer's job. If you think this could be documented a bit better, sure. |
As the required glib patch have made it to a release, can we get this updated please? thanks! |
The bindings still don't accept an option https://gtk-rs.org/gtk-rs-core/git/docs/gio/prelude/trait.AppLaunchContextExt.html#method.startup_notify_id. One option is to use the method via ffi and the other is to wait for bindings and implement it then. EDIT: it seems the |
dc0983a
to
68981e6
Compare
We have not updated gir-files in a long time. I will try to take care of that this weekend |
it is there now |
a15e235
to
cd4cf45
Compare
Unfortunately, `startup_notify_id` is not nullable so we do the same as GTK. See https://gitlab.gnome.org/GNOME/gtk/-/commit/6efd1a9dad49b42db778bdc07020dfcf8845e2c8
cd4cf45
to
8f44129
Compare
cc @jsparber
I noticed that
cargo clippy --features=gtk4 -- -W clippy::pedantic
will complain: