Skip to content

client-toolkit/toplevel-info: Work with only ext foreign toplevel #49

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

Merged
merged 4 commits into from
Feb 12, 2025

Conversation

ids1024
Copy link
Member

@ids1024 ids1024 commented Feb 3, 2025

Supporting both cosmic toplevel info version 1 and foreign toplevel list (with cosmic toplevel info) seems awkward. So this initially make the cosmic-protocol mandatory and the ext protocol optional (without breaking the API). But now that Cosmic has supported this for a while, lets drop client-side support for the old version, and add support for other compositors implementing ext-foreign-toplevel-list-v1.

I still need to update users of the library for this. Probably after #46. Looks like ext_foreign_toplevel_image_capture_source_manager_v1 isn't currently implemented by Sway? So this doesn't yet capture windows on Sway.

This makes `foreign_toplevel` in `ToplevelInfo` no longer an `Option`.

Cosmic-comp has supported version 2 of this protocol for a while, so
supporting version 1 is no longer necessary.
With this, `toplevel-monitor` works on Sway, but doesn't have the
information exposed through the Cosmic protocol, naturally.

The API is changed to use `ExtForeignToplevelHandleV1`. For convenience,
`ToplevelInfo` contains the foreign handle, and the optional cosmic
handle.

I assume `identifier` is meant to be mandatory, so that is no longer an
`Option` here. Though there's no check that the server sends this (is
server-side code, this would send a protocol error; I guess cctk could
panic, or log an error.)
ids1024 added a commit to pop-os/cosmic-applets that referenced this pull request Feb 12, 2025
Requires pop-os/cosmic-protocols#49.

The duplication between applets, and
cosmic-workspace/xdg-desktop-portal-cosmic, should be moved to shared
abstractions. But that can be done after moving to
`ext-image-copy-capture`.
Instead of `Option<ToplevelInfo>`, filter out toplevels that don't have
info. There isn't really any use for a handle without info, since it
can't really be used for anything without knowing what toplevel it
actually is.

`ExtForeignToplevelHandleV1` is then redundant, since it's part of the
`ToplevelInfo` now.
@ids1024 ids1024 marked this pull request as ready for review February 12, 2025 21:22
@ids1024 ids1024 requested a review from a team February 12, 2025 21:22
@ids1024 ids1024 merged commit 178eb0b into main Feb 12, 2025
4 checks passed
@ids1024 ids1024 deleted the toplevel branch February 12, 2025 23:06
ids1024 added a commit to pop-os/cosmic-applets that referenced this pull request Feb 13, 2025
Requires pop-os/cosmic-protocols#49.

The duplication between applets, and
cosmic-workspace/xdg-desktop-portal-cosmic, should be moved to shared
abstractions. But that can be done after moving to
`ext-image-copy-capture`.

`ToplevelInfo` now contains both ext and cosmic handles, so the tuples
of handles and info are needed. Use just the info.
ids1024 added a commit to pop-os/cosmic-applets that referenced this pull request Feb 13, 2025
Requires pop-os/cosmic-protocols#49.

The duplication between applets, and
cosmic-workspace/xdg-desktop-portal-cosmic, should be moved to shared
abstractions. But that can be done after moving to
`ext-image-copy-capture`.

`ToplevelInfo` now contains both ext and cosmic handles, so the tuples
of handles and info are needed. Use just the info.
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.

2 participants