[macOS] Fix live resize with the latest MoltenVK version.

This commit is contained in:
bruvzg 2023-09-05 16:20:57 +03:00
parent 332bc469c4
commit 208b379986
No known key found for this signature in database
GPG Key ID: 7960FCF39844EC38
2 changed files with 10 additions and 1 deletions

View File

@ -47,9 +47,11 @@
@interface GodotContentLayerDelegate : NSObject <CALayerDelegate> {
DisplayServer::WindowID window_id;
bool need_redraw;
}
- (void)setWindowID:(DisplayServer::WindowID)wid;
- (void)setNeedRedraw:(bool)redraw;
@end

View File

@ -40,6 +40,7 @@
- (id)init {
self = [super init];
window_id = DisplayServer::INVALID_WINDOW_ID;
need_redraw = false;
return self;
}
@ -47,13 +48,18 @@
window_id = wid;
}
- (void)setNeedRedraw:(bool)redraw {
need_redraw = redraw;
}
- (void)displayLayer:(CALayer *)layer {
DisplayServerMacOS *ds = (DisplayServerMacOS *)DisplayServer::get_singleton();
if (OS::get_singleton()->get_main_loop() && ds->get_is_resizing()) {
if (OS::get_singleton()->get_main_loop() && ds->get_is_resizing() && need_redraw) {
Main::force_redraw();
if (!Main::is_iterating()) { // Avoid cyclic loop.
Main::iteration();
}
need_redraw = false;
}
}
@ -93,6 +99,7 @@
}
[super setFrameSize:newSize];
[layer_delegate setNeedRedraw:true];
[self.layer setNeedsDisplay]; // Force "drawRect" call.
}