-
Notifications
You must be signed in to change notification settings - Fork 46
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
fix barrier_id=0 in input-capture example #215
fix barrier_id=0 in input-capture example #215
Conversation
Apparently, I missed this when writing the example. |
And GNOME does not seem to verify this, but the plasma portal does. So that is probably, why I missed it. |
Can we make the BarriedId type an alias of NonZeroU32 as well to avoid such issues ? |
There is this:
in the activated signal. Idk if it would be possible to convert this to an Option? But just using NonZeroU32 would break here. |
I see, I think |
I'm also just realizing, that this is not 100% correct in it's current state. It should really be an According to the documentation, zero means "the barrier could not be determined" and for the future, when eventually a capture can be started manually without barriers, there is no barrier id at all. Currently, by the looks of things we always assume that a barrier id is passed. |
cc @whot, would you mind clarifying this bit
|
it's basically a cop-out behavior, sorry :) But it basically means "yes, you have pointer barriers configured somewhere, yes, having those caused the input capture, no, it's not clear which barrier triggered it". It distinguishes between InputCapture being activated through other means (which admittedly don't yet exist). Possible use-case may be a partial barrier on a screen edge where the compositor decides to activate IC on the whole screen edge anyway. But yeah, it's mostly cop-out and tbh I forgot this was in there :( So unfortunately |
I still find it a bit weird from a barrier usecase perspective. But this is more of a discussion for xdg-desktop-portal in general I guess. |
the portal interaction is always with one client anyway, so "what client" is not really a question, or am I misunderstanding something here? A slightly contrived use-case: client has an input capture, gets disabled (e.g. a local password prompt). Once that's done and the client calls Enable it immediately gets the capture again despite this not being triggered by a barrier, merely because the client has barriers and we want to provide this continuity. |
I am referring to barrier-clients in a barrier use case. You would need some sort of |
The case you describe makes sense but it would also be possible to just report the previous barrier_id imo. |
I feel like I'm being dense: the barrier id is just a number, there's no guarantee they're unique (except within the client). So you already cannot rely on the barrier id identifying a client anyway. Signals are (supposed to be) only sent to the session so the session handle is the thing that identifies the client. What am I getting wrong here? |
If you configure two barriers " So if there is no |
yes, but that's the "feature" of the whole missing/zero/number: in the future we will have other triggers than pointer barriers (e.g. keyboard shortcuts) and that's where the barrier_id will be missing altogether so that had to be worked into version 1 of the portal. zero is for the case of activated because you have barriers, not because of any specific barrier. Which would imply things like pointer motion is not necessary (depends on the use-case) and it may serve as distinction for a future client that has barriers and keyboard shortcuts. We don't have a use-case for it and I'd probably not add it if I were to re-implement this today but the interface is what it is now, removing that could be considered an API break. |
so what is the tldr here? |
Sorry for the late reply TLDR is: We want I can check later whether or not this is possible. |
I would suggest to do a proper |
yeah that probably makes most sense. |
How should we proceed here? given that I am planning an API break release the upcoming weeks, it would be nice to get this on in as well. |
Sorry for being inactive on this one, I prioritized other things. I will try to get a draft for the Enum serialization suggestion ready this weekend. |
No worries, take the time you need! thank you :) |
According to the documentation, barrier-ids must be non-zero. (https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.InputCapture.html#org-freedesktop-portal-inputcapture-setpointerbarriers)
9566369
to
244027b
Compare
ddfd099
to
d9692a1
Compare
6ccf7bc
to
c824960
Compare
This is now a bit of a compromise between enum ActivatedBarrier {
Barrier(BarrierID),
Unkown,
NoBarrier,
} and Option<Option<NonZeroU32>> in that we have I find this pretty intuitive in that One thing I am slightly concerned about is the Let me know what you think about the approach and also the naming, which could probably be improved as well. |
From a quick look, the approach looks good to me. The only way to know if there are broken portal implementations is by having a library that enforces what is written in the spec. So I would say, let us merge this and see how things evolve in the future. |
According to the documentation, barrier-ids must be non-zero.
(https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.InputCapture.html#org-freedesktop-portal-inputcapture-setpointerbarriers)