Browse Source

Don't apply our weird window positioning hacks for clicks on traffic lights (#17181)

This hack fixes the minimize problem with macOS 15.0
pull/17190/head
Nikita Tsukanov 2 years ago
committed by GitHub
parent
commit
b17153f9aa
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 20
      native/Avalonia.Native/src/OSX/AvnWindow.mm

20
native/Avalonia.Native/src/OSX/AvnWindow.mm

@ -452,6 +452,16 @@
return pt; return pt;
} }
- (NSView*) findRootView:(NSView*)view
{
while (true) {
auto parent = [view superview];
if(parent == nil)
return view;
view = parent;
}
}
- (void)sendEvent:(NSEvent *_Nonnull)event - (void)sendEvent:(NSEvent *_Nonnull)event
{ {
[super sendEvent:event]; [super sendEvent:event];
@ -467,7 +477,15 @@
AvnView* view = parent->View; AvnView* view = parent->View;
NSPoint windowPoint = [event locationInWindow]; NSPoint windowPoint = [event locationInWindow];
NSPoint viewPoint = [view convertPoint:windowPoint fromView:nil]; 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)) if (!NSPointInRect(viewPoint, view.bounds))
{ {
auto avnPoint = ToAvnPoint(windowPoint); auto avnPoint = ToAvnPoint(windowPoint);

Loading…
Cancel
Save