Two one-line workspace-dep fixes that drop the last remaining X11 crates
for Wayland-only builds:
- softbuffer: its default = [kms, x11, x11-dlopen, wayland, wayland-dlopen]
pulled tiny-xlib + as-raw-xcb-connection unconditionally even though
iced_tiny_skia only needed softbuffer/wayland. Disabling the default
lets iced_tiny_skia's own feature propagation ask for just wayland +
wayland-dlopen.
- window_clipboard: upstream pulled clipboard_x11 + clipboard_wayland
unconditionally on unix. Our local fork (branch yoda-x11-optional)
gates clipboard_x11 behind an opt-in feature, so default-features=false
+ features=["wayland"] drops ~500 x11 symbols (clipboard_x11, x11rb,
x11rb-protocol).
Combined with previous yoda-v4 cuts, cosmic-yoterm goes from
1526 -> 43 x11 symbols (-97%), and 55.4 MB -> 53.3 MB (-2.1 MB).
iced_wgpu's unix block unconditionally depended on as-raw-xcb-connection,
tiny-xlib and x11rb for a DRI3 device-id fallback in
window/compositor.rs that only fires when wayland can't determine the
GPU. On a Wayland-only build this code path never runs, so the deps
are pure bloat.
Changes:
- Cargo.toml: move the 3 x11 crates to optional + new feature `x11`
(not in default — wayland-only is the yoda target; users who need
X11 opt in).
- window.rs: cfg-gate `mod x11;` on feature = "x11"
- window/compositor.rs: cfg-gate `use super::x11::get_x11_device_ids`
+ the or_else fallback on feature = "x11" (wrapped in a let-binding
so the non-x11 branch compiles cleanly).
Result: iced_wgpu no longer pulls any x11 crate when built without
the feature.
Was pulling winit's full x11 backend (winit-x11 + x11-dl) unconditionally
despite iced_winit's own x11 feature being disabled. Fixed by adding
default-features=false on the workspace-level winit dep — iced_winit/wayland
+ wayland-dlopen propagate to winit/wayland + wayland-dlopen as needed.
`hypot` while useful for most of the cases, may break sorting
assumptions like deterministic comparison.
As seen in: https://github.com/pop-os/cosmic-launcher/issues/352
Add and use a new method that trades the performance for more
determinism.
- At least, following apps are using `single-instance` feature:
- cosmic-launcher
- cosmic-app-library
- Once libcosmic text widgets supported the IME, these apps start hitting following methods of SctkWinitWindow which is `todo!()` and will crash at startup:
- `set_ime_cursor_area()`
- `set_ime_allowed()`
- `set_ime_purpose()`
- So, this PR implements these method utilizing following wayland protocols.
- zwp_text_input_v3
- zwp_text_input_manager_v3
Some widgets check the cursor position when handling the touch down
event, so we need to make sure `cursor_position` is set then, and not
only when there is a touch move event. Simply always setting it for
`WindowEvent::PointerButton` (for touch or mouse input) seems
reasonable.
We also need to avoid clearing `cursor_position` for `PointerLeft`
with a touch device. Do that only for mouse input.
Ideally Iced would handle touch input without tying to
`cursor_position`, but this should match the behavior of upstream Iced.
This seems to fix regressions since the Iced rebase in the `tour`
example, and in `cosmic-files`. `cosmic-files` seems to have some
issue using the menus with a touch device, but that doesn't seem to be a
regression.