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.)
It seems this was needed for `renderer.bind_wl_display`. But only in the
X11 and winit backends. Unless there's some less obvious reason to use
the `use_system_lib` feature, it seems undesirable and avoidable.
This uses `WlDrmState` to provide `wl_drm` on those backends instead.
Cosmic-comp seems to spend a lot of CPU time here, particularly in debug
builds. The Iced tiny-skia render probably could use some optimization,
but it's expected that software rendering without optimization will
perform quite poorly.
Optimizing just these crates doesn't seem to add measurably to build
time but does help noticeably.
For the `drm` protocol, we can't construct an `ImportNotifier`, since
that is specifically based around `ZwpLinuxBufferParamsv1`. So we need a
new method for importing with that protocol.
This could be improved, but should match current behavior.
We'll probably want to add support for `cursor-shape-v1`. Not sure about
`wlr-data-control-unstable-v1`. But this just updates to work with the
latest smithay commit for new.
The protocol doesn't specify this, but XWayland does assume relative
pointer events are part of a frame.
This works for now, though a better solution will be needed in Smithay
to also handle pointer constraints where a relative motion may occur
alone, etc.
This seems to fix https://github.com/pop-os/cosmic-comp/issues/159.