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

Issue:
Getter property `#gesture::is_hovered`  is inverted in root wigets
#### I tried this code:

```rust
  Window! {
      widget::background_color = colors::BLUE;
      when #gesture::is_hovered {
          widget::background_color = colors::RED;
      }
      child_align = Align::CENTER;
      child = Container! {
          layout::size = 50;
          widget::background_color = colors::BLUE;
          when #gesture::is_hovered {
              widget::background_color = colors::RED;
          }
      }
  }
```

#### Following these steps:

1 - Run.
2 - Observe window opening not under mouse cursor.

#### I saw this happen:

On init, the `Window!` background is RED (wrong), the `Container!` background is BLUE (correct).

#### I expected this to happen:

Window background also BLUE.

#### Cargo version:

```
cargo 1.81.0 (2dbb1af80 2024-08-20)
release: 1.81.0
commit-hash: 2dbb1af80a2914475ba76827a312e29cedfa6b2f
commit-date: 2024-08-20
host: x86_64-unknown-linux-gnu
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.8.0-DEV (sys:0.4.73+curl-8.8.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Ubuntu 24.4.0 (noble) [64-bit]
```


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1991dc643..801bbad38 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
 # Unreleased
 
+* Fix window receiving a cursor move event while cursor is not over (on x11).
 * Remove end punctuation from command `info` fields
 * Add better custom chrome for GNOME+Wayland.
 * Add `zng::widget::node::bind_state_init` helper.
diff --git a/crates/zng-view/src/window.rs b/crates/zng-view/src/window.rs
index 9356804a9..bc34a7b7d 100644
--- a/crates/zng-view/src/window.rs
+++ b/crates/zng-view/src/window.rs
@@ -557,6 +557,11 @@ impl Window {
 
     /// Returns `true` if the cursor actually moved.
     pub fn cursor_moved(&mut self, pos: DipPoint, device: DeviceId) -> bool {
+        if !self.cursor_over {
+            // this can happen on X11
+            return false;
+        }
+
         let moved = self.cursor_pos != pos || self.cursor_device != device;
 
         if moved {


Test patch: