diff --git a/src/platform_impl/linux/x11/event_processor.rs b/src/platform_impl/linux/x11/event_processor.rs index 8aaabca5..3e3c0f5e 100644 --- a/src/platform_impl/linux/x11/event_processor.rs +++ b/src/platform_impl/linux/x11/event_processor.rs @@ -484,6 +484,7 @@ impl EventProcessor { } let mut shared_state_lock = window.shared_state_lock(); + let hittest = shared_state_lock.cursor_hittest; // This is a hack to ensure that the DPI adjusted resize is actually applied on all WMs. KWin // doesn't need this, but Xfwm does. The hack should not be run on other WMs, since tiling @@ -501,6 +502,11 @@ impl EventProcessor { // Unlock shared state to prevent deadlock in callback below drop(shared_state_lock); + // Reload hittest. + if hittest.unwrap_or(false) { + let _ = window.set_cursor_hittest(true); + } + if resized { callback(Event::WindowEvent { window_id, diff --git a/src/platform_impl/linux/x11/window.rs b/src/platform_impl/linux/x11/window.rs index 0ceca722..1b08869f 100644 --- a/src/platform_impl/linux/x11/window.rs +++ b/src/platform_impl/linux/x11/window.rs @@ -64,7 +64,8 @@ pub struct SharedState { pub base_size: Option, pub visibility: Visibility, pub has_focus: bool, - pub cursor_hittest: bool, + // Use `Option` to not apply hittest logic when it was never requested. + pub cursor_hittest: Option, } #[derive(Copy, Clone, Debug, Eq, PartialEq)] @@ -105,7 +106,7 @@ impl SharedState { resize_increments: None, base_size: None, has_focus: false, - cursor_hittest: true, + cursor_hittest: None, }) } } @@ -1295,8 +1296,8 @@ impl UnownedWindow { self.xconn .flush_requests() .expect("Failed to call XResizeWindow"); - // cursor_hittest needs to be reapplied after window resize - if self.shared_state_lock().cursor_hittest { + // cursor_hittest needs to be reapplied after each window resize. + if self.shared_state_lock().cursor_hittest.unwrap_or(false) { let _ = self.set_cursor_hittest(true); } } @@ -1627,7 +1628,7 @@ impl UnownedWindow { .xcb_connection() .xfixes_set_window_shape_region(self.xwindow, SK::INPUT, 0, 0, region.region()) .map_err(|_e| ExternalError::Ignored)?; - self.shared_state_lock().cursor_hittest = hittest; + self.shared_state_lock().cursor_hittest = Some(hittest); Ok(()) }