This is increasingly not just related to screencopy, so it's weird to
add there. I don't see any other module that fits, so add one called
"quirks" (like the Linux kernel uses for device-specific handling in
generic drives).
Fixes https://github.com/pop-os/cosmic-workspaces-epoch/issues/27.
We want this to apply to changes to workspace either through keybindings
or the cosmic-workspaces UI, so it adding a check here seems reasonable.
In principle it could be good to have some kind of privileged protocol
for setting things like this.
We may also want a configuration option to disable animations at some
point.
`(w_elements, p_elements)` tuples are used in a bunch of places. A
struct with named fields is generally an improvement just due to the
fact the order is non-obvious.
But we can also add methods. In particular,
`extend_from_workspace_elements` abstracts out some of the more
redundant code in `workspace_elements`.
It would be nice to avoid allocation everywhere, but iterators would
complicate lifetimes, run into issues with needing multiple mutable
borrows to things like the `Renderer`, and be awkward in certain
functions without generator syntax. In any case, cosmic-comp already
relies on allocating vectors here.
If this abstraction is commonly useful in compositors, perhaps it could
be moved to Smithay.
Don't just check maximized windows on every refresh, remapping them and
causing flickering, but introduce a proper recalculate method to be
called on layer-shell events / set_output event.
Also if we need to remap, remap all windows to keep stacking order.
Setting the clipboard is only allowed when the keyboard focus is the
same client as the client trying to set the clipboard. We shouldn't
allow background windows in stacks to set the clipboard.
I don't know if anything else expects `same_client_as` to have this `any`
behavior.
This should fix https://github.com/pop-os/cosmic-comp/issues/494, and
make clipboard and primary focus consistently correct.
Changing the active element of a stack needs to change the clipboard
focus, but it wasn't being changed since the `KeyboardFocusTarget` was
unchanged. The `CosmicStack` methods that change the active stack
element also have no obvious way to change the keyboard focus. So we can
set this in `refresh_focus`, which should be correct.
If the new focus `WlSurface` is `None`, this clears the focus instead of
leaving it as the previous code did. I believe that is desirable.
Requires https://github.com/Smithay/smithay/pull/1442 to avoid repeated
`offer`s, instead of only when focus changed.
(Perhaps this could better be solved by having a `WlSurface` variant of
`KeyboardFocusTarget`, like pointer focus, or some mechanism for a stack
of focus, which could help other things. But it's also unclear exactly
how that would work with the code for setting the active stack element,
among other questions.)
We already direct touch events to Iced, and the Cosmic `HeaderBar`
widget already recognizes drags from touch events. So it seems updating
`last_seat` is all that was needed for windows SSDs.
For stacks, the same works, plus moving using the same logic for
detecting drags that is used for mouse events.