Browse Source

Call layer.setNeedsDisplay on show. (#17096)

The `AvaloniaNative.GlPlatformSurface.CreateGlRenderTarget` method can only be called on the UI thread. In normal circumstances this method is called in response to a call to `TopLevel.HandlePaint` from the native `AvnView.updateLayer` method. However, a customer was experiencing a problem where `AvnView.updateLayer` and by extension `TopLevel.HandlePaint` were being called before the window is shown. This broke the creation of the GL render target.
release/11.1.4
Steven Kirk 1 year ago
parent
commit
fad06a01f4
  1. 7
      native/Avalonia.Native/src/OSX/WindowBaseImpl.mm

7
native/Avalonia.Native/src/OSX/WindowBaseImpl.mm

@ -132,6 +132,13 @@ HRESULT WindowBaseImpl::Show(bool activate, bool isDialog) {
_shown = true;
[Window setCollectionBehavior:collectionBehavior];
// Ensure that we call needsDisplay = YES so that AvnView.updateLayer is called after the
// window is shown: if the client is pumping messages during the window creation/show
// process, it's possible that updateLayer gets called after the window is created but
// before it's is shown.
[View.layer setNeedsDisplay];
return S_OK;
}
}

Loading…
Cancel
Save