diff options
| author | srdusr <[email protected]> | 2025-05-30 01:12:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2025-05-30 01:12:00 +0200 |
| commit | 3f2ac4d85c4e66c2f1ae6622bf3c2f302abe93b9 (patch) | |
| tree | ba933aa00823a47a34715a09d15ffbf30a25b923 /crates/wayland/src/xwayland.rs | |
| parent | 49ded5541243408e50a391f95bdca037c370a709 (diff) | |
| download | srdwm-3f2ac4d85c4e66c2f1ae6622bf3c2f302abe93b9.tar.gz srdwm-3f2ac4d85c4e66c2f1ae6622bf3c2f302abe93b9.zip | |
Detect XWayland dialogs via WM_TRANSIENT_FOR, not just native xdg_toplevel parent
Window::is_dialog (close-button-only titlebar, no traffic lights) was
only ever set from a native xdg_toplevel's own parent() - redraw_
decoration_buffer's is_dialog computation called dw.toplevel(), which
is always None for an XWayland-backed DWindow (X11Surface's own
accessor is x11_surface(), a different method), so the .unwrap_or(false)
fallback made every XWayland dialog - a GTK "Save As", an app's own
"About" box, anything setting the ICCCM transient-for hint - always
draw with the full three-button titlebar and traffic-light colours,
even though the feature this was built for explicitly wanted the
opposite. Documented as a known gap at the time; now closed.
redraw_decoration_buffer now also checks X11Surface::is_transient_for()
for an XWayland window. property_notify gained a WmWindowProperty::
TransientFor arm that re-runs redraw_decoration_buffer, for a client
that sets the hint slightly after its own initial map - the same
"read fresh every call" pattern the existing xdg_toplevel::parent()
check already relied on, extended to catch a late X11 property the way
the Wayland equivalent (set_parent, any time) already was.
Diffstat (limited to 'crates/wayland/src/xwayland.rs')
| -rw-r--r-- | crates/wayland/src/xwayland.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/wayland/src/xwayland.rs b/crates/wayland/src/xwayland.rs index a51ee97..7834f16 100644 --- a/crates/wayland/src/xwayland.rs +++ b/crates/wayland/src/xwayland.rs @@ -825,6 +825,21 @@ impl XwmHandler for CompState { /// (a dock's running-indicator, an app switcher, icon lookup), not just /// this compositor's own UI. fn property_notify(&mut self, _xwm: XwmId, window: X11Surface, property: WmWindowProperty) { + // `WM_TRANSIENT_FOR` - `Window::is_dialog`'s own X11 half (see its + // doc comment) - can arrive after the window's already mapped and + // decorated: a client that sets it slightly late, or one this + // compositor granted the map request for before XWayland finished + // resolving the property. `redraw_decoration_buffer` re-reads + // `is_transient_for()` fresh every call, so simply calling it again + // here picks up the change - same "cheap once nothing's actually + // different" self-guard (`decoration_signatures`) every other + // redraw trigger in this codebase already relies on. + if matches!(property, WmWindowProperty::TransientFor) { + if let Some(&id) = self.xwayland_windows.get(&window.window_id()) { + self.redraw_decoration_buffer(id); + } + return; + } if !matches!(property, WmWindowProperty::Title | WmWindowProperty::Class) { return; } |