Repository: zng-ui/zng (language: rust)

Issue:
Wayland fallback chrome bugs
Observed some bugs:

* Minimize -> Restore does not restore resize border.
* Window receives a render request unfulfilled (a warning).


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index db850f8fe..b771c77f2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
 # Unreleased
 
+* Fix window not updating state after restore in Wayland.
 * Add `FrameBuilder::render_widgets` and `render_update_widgets` to `FrameBuilder` and `FrameUpdate` to inspect external render requests.
 * Implement support for raster and svg emojis.
 * Add `FontFace::ttf` to quickly access the full parsed TTF data.
diff --git a/crates/zng-view/src/lib.rs b/crates/zng-view/src/lib.rs
index faec119b7..0c38ae4cd 100644
--- a/crates/zng-view/src/lib.rs
+++ b/crates/zng-view/src/lib.rs
@@ -624,6 +624,11 @@ impl winit::application::ApplicationHandler<AppEvent> for App {
                 if self.windows[i].focused_changed(&mut focused) {
                     if focused {
                         self.notify(Event::FocusChanged { prev: None, new: Some(id) });
+
+                        // some platforms (Wayland) don't change size on minimize/restore, so we check here too.
+                        if let Some(state) = self.windows[i].state_change() {
+                            self.notify(Event::WindowChanged(WindowChanged::state_changed(id, state, EventCause::System)));
+                        }
                     } else {
                         self.pending_modifiers_focus_clear = true;
                         self.notify(Event::FocusChanged { prev: Some(id), new: None });
diff --git a/crates/zng-wgt-layer/src/lib.rs b/crates/zng-wgt-layer/src/lib.rs
index b0de33f63..8c5fc1479 100644
--- a/crates/zng-wgt-layer/src/lib.rs
+++ b/crates/zng-wgt-layer/src/lib.rs
@@ -594,6 +594,9 @@ impl LAYERS {
                             }
                             _ => widget.render(frame),
                         }
+                    } else {
+                        // anchor not visible, call render to properly hide or collapse (if collapsed during layout)
+                        frame.hide(|frame| widget.render(frame))
                     }
                 } else {
                     widget.render(frame);


Test patch: