From 4f84db9080d19beca0bcc1206370e822b0aac21e Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 10 Jul 2018 22:06:50 +0100 Subject: [PATCH] Add fix for monomac borderless windows being transparent to mouse clicks when they shouldnt be. --- src/OSX/Avalonia.MonoMac/WindowImpl.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/OSX/Avalonia.MonoMac/WindowImpl.cs b/src/OSX/Avalonia.MonoMac/WindowImpl.cs index a2f8df6791..3900af8709 100644 --- a/src/OSX/Avalonia.MonoMac/WindowImpl.cs +++ b/src/OSX/Avalonia.MonoMac/WindowImpl.cs @@ -3,6 +3,7 @@ using Avalonia.Controls; using Avalonia.Platform; using MonoMac.AppKit; using MonoMac.CoreGraphics; +using Avalonia.Threading; namespace Avalonia.MonoMac { @@ -16,7 +17,14 @@ namespace Avalonia.MonoMac public WindowImpl() { - UpdateStyle(); + // Post UpdateStyle to UIThread otherwise for as yet unknown reason. + // The window becomes transparent to mouse clicks except a 100x100 square + // at the top left. (danwalmsley) + Dispatcher.UIThread.Post(() => + { + UpdateStyle(); + }); + Window.SetCanBecomeKeyAndMain(); Window.DidResize += delegate