gpui_macos: Fix hover feedback when another application is focused (#64301)
Follow-up #64234 If Zed is inactive, hovering over it produces no hover effects. While this matches other apps like Slack, I think it’s better to preserve existing behavior. This change keeps the bug fix of the original PR. This PR uses `ActiveAlways` for normal windows, matching popup windows. Release Notes: - N/A - [GPUI] N/A
This commit is contained in:
1 parent
7a99617ffc
commit
658460cc2b
1 file changed
+10
-19
@@ -1204,15 +1204,7 @@ impl MacWindow {
|
||||
} else {
|
||||
native_window.setLevel_(NSNormalWindowLevel);
|
||||
native_window.setAcceptsMouseMovedEvents_(NO);
|
||||
add_mouse_tracking_area(
|
||||
tracking_view,
|
||||
NSTrackingAreaOptions::MouseEnteredAndExited
|
||||
| NSTrackingAreaOptions::MouseMoved
|
||||
// Track while this application is active, even if another
|
||||
// window in the application has focus.
|
||||
| NSTrackingAreaOptions::ActiveInActiveApp
|
||||
| NSTrackingAreaOptions::InVisibleRect,
|
||||
);
|
||||
add_mouse_tracking_area(tracking_view);
|
||||
}
|
||||
|
||||
if let Some(tabbing_identifier) = tabbing_identifier {
|
||||
@@ -1225,15 +1217,7 @@ impl MacWindow {
|
||||
// `AnchoredPopup` is rejected in `MacPlatform::open_window`, grouped here only
|
||||
// for exhaustiveness.
|
||||
WindowKind::PopUp | WindowKind::AnchoredPopup(_) => {
|
||||
add_mouse_tracking_area(
|
||||
tracking_view,
|
||||
NSTrackingAreaOptions::MouseEnteredAndExited
|
||||
| NSTrackingAreaOptions::MouseMoved
|
||||
// Track even when another application is active, e.g. so
|
||||
// notification windows can respond to hover.
|
||||
| NSTrackingAreaOptions::ActiveAlways
|
||||
| NSTrackingAreaOptions::InVisibleRect,
|
||||
);
|
||||
add_mouse_tracking_area(tracking_view);
|
||||
|
||||
native_window.setLevel_(NSPopUpWindowLevel);
|
||||
let _: () = msg_send![
|
||||
@@ -2483,7 +2467,14 @@ extern "C" fn dealloc_view(this: &Object, _: Sel) {
|
||||
}
|
||||
}
|
||||
|
||||
fn add_mouse_tracking_area(native_view: &Objc2NSView, options: NSTrackingAreaOptions) {
|
||||
fn add_mouse_tracking_area(native_view: &Objc2NSView) {
|
||||
let options = NSTrackingAreaOptions::MouseEnteredAndExited
|
||||
| NSTrackingAreaOptions::MouseMoved
|
||||
// Track even when another application is active so visible
|
||||
// windows can respond to hover without being focused.
|
||||
| NSTrackingAreaOptions::ActiveAlways
|
||||
| NSTrackingAreaOptions::InVisibleRect;
|
||||
|
||||
// SAFETY: NSView provides the tracking-event callbacks, and the owner is
|
||||
// the same view that retains the tracking area. No user info is supplied.
|
||||
let tracking_area = unsafe {
|
||||
|
||||
Reference in new issue
Block a user