diff --git a/docs/content.en/docs/release-notes/_index.md b/docs/content.en/docs/release-notes/_index.md index d348ec87..de11598c 100644 --- a/docs/content.en/docs/release-notes/_index.md +++ b/docs/content.en/docs/release-notes/_index.md @@ -22,7 +22,8 @@ feat: support pageup/pagedown to navigate search results #920 fix: automatic update of service list #913 fix: duplicate chat content #916 -fix: resolve pinned window shortcut not working (#917) +fix: resolve pinned window shortcut not working #917 +fix: WM ext does not work when operating focused win from another display #919 ### ✈️ Improvements diff --git a/src-tauri/src/extension/built_in/window_management/backend/mod.rs b/src-tauri/src/extension/built_in/window_management/backend/mod.rs index 9f5593d6..6efef301 100644 --- a/src-tauri/src/extension/built_in/window_management/backend/mod.rs +++ b/src-tauri/src/extension/built_in/window_management/backend/mod.rs @@ -34,6 +34,7 @@ use objc2_core_graphics::CGEventType; use objc2_core_graphics::CGMouseButton; use objc2_core_graphics::CGRectGetMidX; use objc2_core_graphics::CGRectGetMinY; +use objc2_core_graphics::CGRectIntersectsRect; use objc2_core_graphics::CGWindowID; use super::error::Error; @@ -46,12 +47,7 @@ use std::collections::HashMap; use std::sync::{LazyLock, Mutex}; fn intersects(r1: CGRect, r2: CGRect) -> bool { - let overlapping = !(r1.origin.x + r1.size.width < r2.origin.x - || r1.origin.y + r1.size.height < r2.origin.y - || r1.origin.x > r2.origin.x + r2.size.width - || r1.origin.y > r2.origin.y + r2.size.height); - - overlapping + unsafe { CGRectIntersectsRect(r1, r2) } } /// Core graphics APIs use flipped coordinate system, while AppKit uses the @@ -461,6 +457,9 @@ fn get_frontmost_window_close_button_frame() -> Result { /// 2. For non-main displays, it assumes that they don't have a menu bar, but macOS /// puts a menu bar on every display. /// +/// Update: This could be wrong, but looks like Apple fixed these 2 bugs in macOS +/// 26. At least the buggy behaviors disappear in my test. +/// /// /// [^1]: Visible frame: a rectangle defines the portion of the screen in which it /// is currently safe to draw your app’s content. @@ -636,3 +635,56 @@ pub(crate) fn get_frontmost_window_last_frame(window_id: CGWindowID) -> Option