Skip to content
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

Implement support for xdg-activation #426

Merged
merged 2 commits into from
Nov 1, 2023
Merged

Conversation

Drakulix
Copy link
Member

@Drakulix Drakulix commented Oct 31, 2023

Implements xdg-activation.

The second commit adds it to the simple-window example as a test. Given how heavily commented that is, I guess that is not really a good place to put it. But without a proper window it doesn't make a whole lot of sense to use it. I could also just drop that commit?

@Drakulix Drakulix force-pushed the feature/xdg-activation branch 2 times, most recently from 070cb9f to f41bec4 Compare October 31, 2023 13:48
Comment on lines 19 to 46
/// *Warning*: Many compositors will issue invalid tokens for requests without
/// recent serials. There is no way to detect this from the client-side.
fn serial(&self) -> Option<(&wl_seat::WlSeat, u32)>;
/// Surface of the window requesting the token, if applicable.
///
/// *Warning*: Many compositors will issue invalid tokens for requests from
/// unfocused surfaces. There is no way to detect this from the client-side.
fn surface(&self) -> Option<&wl_surface::WlSurface>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to use Option for both of them, just enforce the use of what should be passed..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes there is use in requesting a token without providing these.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, what could it be, it's all non-documented. You better use app_id if you want to have a special logic in compositor.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E.g. requesting a token without an active surface. Which might be valid for privileged clients.

Because it is all non-documented, we should actually expose everything the protocol allows instead of assuming a certain compositor policy.

src/activation.rs Outdated Show resolved Hide resolved
Comment on lines 19 to 21
/// *Warning*: Many compositors will issue invalid tokens for requests without
/// recent serials. There is no way to detect this from the client-side.
fn serial(&self) -> Option<(&wl_seat::WlSeat, u32)>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're returning seat and serial from a function called serial, sounds really odd.

I'd suggest to separate seat and serial. Also &Wlseat should be better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the naming the protocol uses and it expects either both or none of the above. So I can't really make two methods out of it. We could just change the name.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, whatever protocol uses is up to the protocol, we're writing a toolkit which should have saner names.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess... Still like separate serial and seat a bit more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, if you tell me what the implementation is supposed to do, if it gets either but not the other... just don't set it? That feels wrong, if we can enforce it on a type level.

src/activation.rs Outdated Show resolved Hide resolved
@Drakulix Drakulix force-pushed the feature/xdg-activation branch 2 times, most recently from 67adadd to db1c2d3 Compare October 31, 2023 14:01
Comment on lines 19 to 21
/// *Warning*: Many compositors will issue invalid tokens for requests without
/// recent serials. There is no way to detect this from the client-side.
fn serial(&self) -> Option<(&wl_seat::WlSeat, u32)>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, whatever protocol uses is up to the protocol, we're writing a toolkit which should have saner names.

src/activation.rs Outdated Show resolved Hide resolved
src/activation.rs Outdated Show resolved Hide resolved
@Drakulix Drakulix force-pushed the feature/xdg-activation branch 3 times, most recently from 5523cb2 to ed0b5e6 Compare October 31, 2023 14:35
src/activation.rs Outdated Show resolved Hide resolved
@Drakulix Drakulix force-pushed the feature/xdg-activation branch from ed0b5e6 to 6a1fa55 Compare October 31, 2023 14:39
@Drakulix Drakulix force-pushed the feature/xdg-activation branch from 6a1fa55 to 0be6b8d Compare October 31, 2023 14:44
@wash2 wash2 merged commit 2e9bf9f into master Nov 1, 2023
@wash2 wash2 deleted the feature/xdg-activation branch November 1, 2023 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants