From f4928f271eb22e67e2b96773c56dd5003c1ef62d Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Thu, 3 Oct 2024 12:15:03 +0400 Subject: [PATCH] Don't apply our weird window positioning hacks for clicks on traffic lights (#17181) This hack fixes the minimize problem with macOS 15.0 --- native/Avalonia.Native/src/OSX/AvnWindow.mm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/native/Avalonia.Native/src/OSX/AvnWindow.mm b/native/Avalonia.Native/src/OSX/AvnWindow.mm index 226c194023..0bc294d079 100644 --- a/native/Avalonia.Native/src/OSX/AvnWindow.mm +++ b/native/Avalonia.Native/src/OSX/AvnWindow.mm @@ -436,6 +436,16 @@ return pt; } +- (NSView*) findRootView:(NSView*)view +{ + while (true) { + auto parent = [view superview]; + if(parent == nil) + return view; + view = parent; + } +} + - (void)sendEvent:(NSEvent *_Nonnull)event { [super sendEvent:event]; @@ -450,7 +460,15 @@ AvnView* view = _parent->View; NSPoint windowPoint = [event locationInWindow]; NSPoint viewPoint = [view convertPoint:windowPoint fromView:nil]; - + + auto targetView = [[self findRootView:view] hitTest: windowPoint]; + if(targetView) + { + auto targetViewClass = [targetView className]; + if([targetViewClass containsString: @"_NSThemeWidget"]) + return; + } + if (!NSPointInRect(viewPoint, view.bounds)) { auto avnPoint = ToAvnPoint(windowPoint);