Fixes https://github.com/pop-os/cosmic-workspaces-epoch/issues/143.
The way some events are converted to `WindowEvent`s in `pointer_frame`
but motion is handled in `SctkEvent::process` seems a little cluttered
at the moment, I guess from how this code was ported to be part of
iced-winit instead of separate. But as I understand, the code handling
`PointerEventKind::Enter` in `SctkEvent::enter` wasn't being called, so
that can be replaced with the new code here that sets the logical cursor
position.
This adds a padding field to the scrollbar, which adds padding at the start and end of scrollbars, without affecting the scrollable. This enables the scrollable to use the full height/width of a container where it would otherwise be visually restricted by scrollbar placement (e.g. due to rounded corners).
Also adds methods for changing scrollbar/scroller width, allowing to match defaults to upstream, while making required changes in libcosmic.
`place_above` moves the subsurface within the stack of subsurfaces, so
calling it for all previous surfaces is wrong.
We also need to use the `z` from `view_subsurfaces` if this is called
before `attach_and_commit`, or an old value will be used.
Use `Icon::Surface` instead of `Icon::Buffer`, so we can then create
subsurfaces of the `wl_surface`.
Using `.screenshot()` then copying to an shm buffer is suboptimal, but
this does seem overall better than with the older Iced version when a
drag surface didn't appear until a Vulkan surface could be created for
it.
This re-uses `Connection` in the platform-specific code, instead of
creating from display handle on each call.
In an earlier version, this took a `WlBuffer`, so the width/height
arguments were needed. But since using the same `wl_buffer` multiple
times conflicted with `release` handling we instead accept
`SubsurfaceBuffer`, which stores the same height/width.
This was previously needed, but should be redundant now that an empty
input region is set for the subsurface. With that, the subsurface should
never get input events, so mapping them isn't needed.
Otherwise the `draw` call in response to `AboutToWait` causes this list
to grow, and eventually hit errors in `sendmsg` due to too many buffered
file descriptors from creating subsurfaces.
Probably the number of places `UserInterface::draw` are called should be
cleaned up. And it shouldn't be called in `AboutToWiat` like this. Some
improvements could probably be made in upstream iced.
This type is an `Arc`, so there's no major benefit to using a reference,
or a `Cow` to make it generic.
Drag surfaces currently require a `'static` `Element`, so this is needed
their.
This replaces the previous check which appeared to rely on the assumption that initiating a drag_resize without a left mouse press wouldn't actually start a resize (this assumption is false on Windows).
`cosmic-osd` expected this event, but it wasn't being sent. This isn't
hard to fix, unless there's some non-obvious issues that this was
commented to avoid (that is still applicable).
this can interact with the named IDs, and cause state mismatches, and doesn't need to be done, because the ID will be updated by the diff method if there is a Tag match anyways.