Commit graph

6620 commits

Author SHA1 Message Date
Ian Douglas Scott
53fed52405
wayland: Set cusor position on Enter events
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.
2026-01-26 12:13:32 -05:00
Vukašin Vojinović
b775402f65
feat(scrollable): add padding to ends of scrollbar
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.
2026-01-26 12:13:27 -05:00
Ian Douglas Scott
f04e237946
subsurface_widget: Use neagtive z to place below parent surface
Now uses `i32` for `z`.
2026-01-26 11:56:40 -05:00
Ian Douglas Scott
02bd5d17ef
subsurface_widget: Sort parent WlSurface, not ObjectId 2026-01-26 11:56:37 -05:00
Ian Douglas Scott
9f07d15617
subsurface_widget: Fix use of place_above
`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.
2026-01-26 11:48:15 -05:00
Ashley Wulber
5b0468e535
refactor: include virtual offset in Layout 2026-01-26 11:48:10 -05:00
Jeremy Soller
7120db60ba
Format 2026-01-26 10:14:19 -05:00
Ashley Wulber
4db71cb0e6
fix: create fractional scale for sctk subsurfaces 2026-01-23 15:39:42 -05:00
Ashley Wulber
93bc4bbd88
feat: subsurfaces 2026-01-23 15:39:35 -05:00
Adam Cosner
0f37c9922d
perf: use cached alpha mode instead of calling surface.get_capabilities every time the window is redrawn 2026-01-23 14:50:36 -05:00
Sosthène Guédon
46c745be2c
Add focus id to text editor 2026-01-23 14:50:32 -05:00
Ian Douglas Scott
49b154c048
winit/wayland: Update for toplevel-info cctk changes 2026-01-23 14:47:54 -05:00
Ian Douglas Scott
3cdcfe79db
Update cctk to latest commit 2026-01-23 14:46:29 -05:00
Ian Douglas Scott
592f17729c
mouse_area: Fix on_drag behavior without on_release
Mouse/touch release events should end the drag even if there's not an
`on_release` callback.

This was causing https://github.com/pop-os/cosmic-comp/issues/1071.
2026-01-23 14:44:58 -05:00
Ian Douglas Scott
1f93ae8c3f
winit: Fix building without wayland feature 2026-01-23 14:39:31 -05:00
Ian Douglas Scott
a1792b681a
winit/wayland: Apply scale when creating drag surface 2026-01-23 14:36:40 -05:00
Ian Douglas Scott
b4168e69cc
Add an offset to IconSurface, so icon can be offset from custor 2026-01-23 14:34:16 -05:00
Ian Douglas Scott
ed5de12e69
runtime: Remove start_dnd
This is not currently used. And is impossible to (soundly) use, since it
requires a `Send` bound, which `State` and `Element` lack.
2026-01-23 14:07:12 -05:00
Ian Douglas Scott
bd6c04d809
Don't use Box<Arc<_>> and Arc::into_inner unnecessarily 2026-01-23 14:03:53 -05:00
Ian Douglas Scott
fde0689def
winit/wayland: Subsurfaces for drag surfaces
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.
2026-01-23 14:00:38 -05:00
Ian Douglas Scott
545ecb8a8a
Remove unused destroyed_surface_ids 2026-01-23 13:47:40 -05:00
Ashley Wulber
6cffd2f452
fix: use total_cmp where possible 2026-01-23 13:47:39 -05:00
Ian Douglas Scott
288919958e
subsurface: Add option to apply buffer transform 2026-01-23 13:47:38 -05:00
Ian Douglas Scott
e034001468
subsurface: Remove width/height arguments to Subsurface::new
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.
2026-01-23 13:47:37 -05:00
Ian Douglas Scott
c7dd111ae8
subsurface: Add width/height methods to SubsuraceBuffer
This is potentially useful.

Other properties are specific to shm/dmabuf, and not meaningful in
general.
2026-01-23 13:47:34 -05:00
Ian Douglas Scott
18f0521357
subsurface_widget: Remove subsurface_ids
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.
2026-01-23 13:33:59 -05:00
Ian Douglas Scott
dd9576d94e
subsurface_widget: Clear subsurface list after calls to ::draw()
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.
2026-01-23 13:33:42 -05:00
Ian Douglas Scott
c18f5f6dda
subsurface_widget: Take owned SubsurfaceBuffer
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.
2026-01-23 13:12:06 -05:00
Ashley Wulber
dbbaa4f442
fix(winit): cleanup layer surface dnd surface 2026-01-23 13:11:54 -05:00
Ashley Wulber
8e08ceb25c
fix: convert sctk configure events to Opened and Resized 2026-01-23 11:30:54 -05:00
Ashley Wulber
39d88f2ffa
refactor: add namespace 2026-01-23 11:28:35 -05:00
Ashley Wulber
301892aaa5
feat: overlap notify 2026-01-23 11:25:32 -05:00
Ashley Wulber
6e91eabf4c
refactor: use cctk 2026-01-23 11:16:56 -05:00
Matt George
1b8a399ebd
use a variable instead of a fn for hard-coded check 2026-01-23 11:11:22 -05:00
Matt George
c984005e9b
hard-code which targets have drag_resize support
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).
2026-01-23 11:11:22 -05:00
Matt George
c2ad04a4da
fix: clear drag_initiated state on dbl click 2026-01-23 11:11:18 -05:00
Matt George
5ca1838a2d
fix: correct event types for windows 2026-01-23 11:09:50 -05:00
Ashley Wulber
c0473f8a91
fix: rebuild a11y tree when rebuilding widget tree 2026-01-23 11:07:45 -05:00
Ashley Wulber
eff664a035
fix: request logical size when autosizing 2026-01-23 10:51:41 -05:00
Ian Douglas Scott
db8e74b7a3
Send KeyboardEventVariant::Enter on keyboard enter
`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).
2026-01-23 10:25:19 -05:00
Ashley Wulber
83910ff5b0
refactor: allow apps to request to be treated as a daemon 2026-01-23 10:25:03 -05:00
Ashley Wulber
3cb4e4674e
fix: close subscriptions when exiting 2026-01-22 14:06:37 -05:00
Ashley Wulber
44ac127e8d
fix: feature gate a11y_nodes for mouse_area 2026-01-22 13:55:13 -05:00
Ashley Wulber
ea406698bd
fix: a11y nodes 2026-01-22 13:55:12 -05:00
Ashley Wulber
f1353e1ce2
fix: tree diff improvements
Search for the old child state with matching index
2026-01-22 13:55:01 -05:00
Ashley Wulber
37085bc8ec
fix: offset DnD events in scrollable 2026-01-21 15:12:43 -05:00
Ashley Wulber
4238d0ef2b
fix: avoid overwriting id when diffing children
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.
2026-01-21 15:04:44 -05:00
Vukašin Vojinović
3992a3d4ac
fix: scrollbar width 2026-01-21 15:04:44 -05:00
Eduardo Flores
785732b90d
fix: documentation 2026-01-21 15:04:43 -05:00
Eduardo Flores
61cdb6fe1f
fix: use enable and disable methods 2026-01-21 15:04:37 -05:00