diff --git a/app/metal_darwin.go b/app/metal_darwin.go index e93b0251..0043ffb3 100644 --- a/app/metal_darwin.go +++ b/app/metal_darwin.go @@ -60,8 +60,9 @@ static void presentDrawable(CFTypeRef queueRef, CFTypeRef drawableRef) { id drawable = (__bridge id)drawableRef; id queue = (__bridge id)queueRef; id cmdBuffer = [queue commandBuffer]; - [cmdBuffer presentDrawable:drawable]; [cmdBuffer commit]; + [cmdBuffer waitUntilScheduled]; + [drawable present]; } } diff --git a/app/metal_ios.go b/app/metal_ios.go index 860ba1aa..d5b5dc41 100644 --- a/app/metal_ios.go +++ b/app/metal_ios.go @@ -21,7 +21,10 @@ Class gio_layerClass(void) { static CFTypeRef getMetalLayer(CFTypeRef viewRef) { @autoreleasepool { UIView *view = (__bridge UIView *)viewRef; - return CFBridgingRetain(view.layer); + CAMetalLayer *l = (CAMetalLayer *)view.layer; + l.needsDisplayOnBoundsChange = YES; + l.presentsWithTransaction = YES; + return CFBridgingRetain(l); } } diff --git a/app/metal_macos.go b/app/metal_macos.go index 8b602ee3..4fe7586c 100644 --- a/app/metal_macos.go +++ b/app/metal_macos.go @@ -14,7 +14,11 @@ package app CALayer *gio_layerFactory(void) { @autoreleasepool { - return [CAMetalLayer layer]; + CAMetalLayer *l = [CAMetalLayer layer]; + l.autoresizingMask = kCALayerHeightSizable|kCALayerWidthSizable; + l.needsDisplayOnBoundsChange = YES; + l.presentsWithTransaction = YES; + return l; } } diff --git a/app/os_macos.go b/app/os_macos.go index 6be39508..7489975d 100644 --- a/app/os_macos.go +++ b/app/os_macos.go @@ -195,6 +195,14 @@ static void setScreenFrame(CFTypeRef windowRef, CGFloat x, CGFloat y, CGFloat w, } } +static void resetLayerFrame(CFTypeRef viewRef) { + @autoreleasepool { + NSView* view = (__bridge NSView *)viewRef; + NSRect r = view.frame; + view.layer.frame = r; + } +} + static void hideWindow(CFTypeRef windowRef) { @autoreleasepool { NSWindow* window = (__bridge NSWindow *)windowRef; @@ -456,6 +464,9 @@ func (w *window) Configure(options []Option) { C.setWindowStandardButtonHidden(window, C.NSWindowCloseButton, barTrans) C.setWindowStandardButtonHidden(window, C.NSWindowMiniaturizeButton, barTrans) C.setWindowStandardButtonHidden(window, C.NSWindowZoomButton, barTrans) + // When toggling the titlebar, the layer doesn't update its frame + // until the next resize. Force it. + C.resetLayerFrame(w.view) } w.ProcessEvent(ConfigEvent{Config: w.config}) }