mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 12:12:28 +00:00
Merge pull request #81339 from bruvzg/macos_fix_mvk_live_resize
[macOS] Fix live resize with the latest MoltenVK version.
This commit is contained in:
commit
07176632a6
@ -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
|
||||
|
||||
|
@ -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.
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user