hex/src/linux/annotate_overlays.rs
Dax ece7cf9bfb
Linux: Annotate on GNOME lab (capsule and ink float on XWayland) (#1529)
* add a Labs toggle for Annotate overlays on GNOME

Rune won't back an overlay with an XWayland window when it asks for keys
on demand, so Annotate's recording capsule, ink, and picker never show on
GNOME Wayland: a capture records with nothing on screen. With Labs ›
Annotate on GNOME (`labs.gnome_annotate`, off by default), open them on an
already running XWayland like the meeting capsules do, with the same
checks at each show and without ever starting XWayland. The ink is made
with pointer regions and no keys, since it must take the pointer later
and Rune refuses an OnDemand overlay there; Esc can't stop drawing, so
the capsule's pen button or the Annotate key does.

idea and diagnosis from @pkkid in #1526

* Bump Rune to f2fb51ea

XWayland overlays now update their input shape on every drawn frame

* fix the Annotate lab copy and the XWayland checks

Esc can't stop drawing on the GNOME path, and a tap of the Annotate key
stops the recording, not the pen; the capsule's pen button or letting go
of a held key ends drawing. Use each language's existing name for the
Annotate feature, evaluate the ink's XWayland check once at install, and
skip the picker's check when nothing shows.
2026-11-08 04:13:40 -05:00

21 lines
1.1 KiB
Rust
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//! Labs › Annotate on GNOME. A Wayland compositor without layer-shell
//! (GNOME) gives Rune no surface for Annotate's capsule or ink, so a capture
//! records but shows neither. With this explicit opt-in they open on
//! XWayland as override-redirect windows that take the pointer and never
//! keyboard focus, and only while this user's XWayland already runs: Hex
//! never starts it. The capsule, ink, and the picker's overlay share the
//! meeting capsules' decision (`linux::meeting_capsules`).
/// Whether Annotate's overlays may float on XWayland, read as each shows.
pub(crate) fn on_xwayland() -> bool {
crate::linux::meeting_capsules::on_xwayland_for(crate::labs::gnome_annotate())
}
/// Whether the ink overlay can only ever show on XWayland here. Its input
/// and key policy are fixed when it is made, so on such a session it takes
/// the pointer in regions and no keys from the start: an XWayland window
/// made click-through can never take the pointer later, and Rune never shows
/// a `KeyPolicy::OnDemand` overlay on XWayland.
pub(crate) fn ink_uses_xwayland_pointer() -> bool {
crate::linux::meeting_capsules::without_layer_shell()
}