diff --git a/native/Avalonia.Native/src/OSX/gl.mm b/native/Avalonia.Native/src/OSX/gl.mm index a62098a074..083adc927d 100644 --- a/native/Avalonia.Native/src/OSX/gl.mm +++ b/native/Avalonia.Native/src/OSX/gl.mm @@ -208,9 +208,8 @@ public: virtual ~AvnGlRenderingSession() { - glFlush(); [_context flushBuffer]; - [_context setView:nil]; + [NSOpenGLContext clearCurrentContext]; CGLUnlockContext([_context CGLContextObj]); [_view unlockFocus]; } @@ -241,9 +240,8 @@ public: auto gl = _context; CGLLockContext([_context CGLContextObj]); [gl setView: _view]; + [gl update]; [gl makeCurrentContext]; - auto frame = [_view frame]; - *ret = new AvnGlRenderingSession(_window, _view, gl); return S_OK; } diff --git a/src/Avalonia.Controls/Button.cs b/src/Avalonia.Controls/Button.cs index 1f3fcbafb3..d485924885 100644 --- a/src/Avalonia.Controls/Button.cs +++ b/src/Avalonia.Controls/Button.cs @@ -253,10 +253,8 @@ namespace Avalonia.Controls IsPressed = false; e.Handled = true; - var hittest = this.GetVisualsAt(e.GetPosition(this)); - if (ClickMode == ClickMode.Release && - hittest.Any(c => c == this || (c as IStyledElement)?.TemplatedParent == this)) + this.GetVisualsAt(e.GetPosition(this)).Any(c => this == c || this.IsVisualAncestorOf(c))) { OnClick(); }