Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c32f0cd

Browse files
committed
Change [FlutterView start] to synchronousResizing property
1 parent 7400492 commit c32f0cd

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

shell/platform/darwin/macos/framework/Source/FlutterEngine.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ - (BOOL)runWithEntrypoint:(NSString*)entrypoint {
289289

290290
[self sendUserLocales];
291291
[self updateDisplayConfig];
292-
[self.viewController.flutterView start];
292+
self.viewController.flutterView.synchronousResizing = YES;
293293
return YES;
294294
}
295295

@@ -301,7 +301,7 @@ - (void)setViewController:(FlutterViewController*)controller {
301301
_resourceContext = nil;
302302
}
303303
if (_engine) {
304-
[self.viewController.flutterView start];
304+
self.viewController.flutterView.synchronousResizing = YES;
305305
}
306306
}
307307

@@ -353,7 +353,7 @@ - (void)updateDisplayConfig {
353353
CVDisplayLinkRelease(displayLinkRef);
354354
}
355355

356-
// Must be driven by FlutterView (i.e. [FlutterView start])
356+
// Called by [FlutterViewController viewDidReshape]
357357
- (void)updateWindowMetrics {
358358
if (!_engine) {
359359
return;

shell/platform/darwin/macos/framework/Source/FlutterView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
@interface FlutterView : NSView
2222

2323
@property(readwrite, nonatomic, nonnull) NSOpenGLContext* openGLContext;
24+
@property(readwrite, nonatomic) BOOL synchronousResizing;
2425

2526
- (nullable instancetype)initWithFrame:(NSRect)frame
2627
shareContext:(nonnull NSOpenGLContext*)shareContext
@@ -37,7 +38,6 @@
3738
- (nullable instancetype)initWithCoder:(nonnull NSCoder*)coder NS_UNAVAILABLE;
3839
- (nonnull instancetype)init NS_UNAVAILABLE;
3940

40-
- (void)start;
4141
- (void)present;
4242
- (int)getFrameBufferIdForSize:(CGSize)size;
4343

shell/platform/darwin/macos/framework/Source/FlutterView.mm

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ @interface FlutterView () <FlutterResizeSynchronizerDelegate> {
1313
__weak id<FlutterViewReshapeListener> _reshapeListener;
1414
FlutterResizeSynchronizer* resizeSynchronizer;
1515
FlutterSurfaceManager* surfaceManager;
16-
BOOL active;
1716
CALayer* contentLayer;
1817
}
1918

@@ -80,18 +79,15 @@ - (void)present {
8079
[resizeSynchronizer requestCommit];
8180
}
8281

83-
- (void)start {
84-
active = YES;
85-
[self reshaped];
86-
}
87-
8882
- (void)reshaped {
89-
if (active) {
83+
if (self.synchronousResizing) {
9084
CGSize scaledSize = [self convertSizeToBacking:self.bounds.size];
9185
[resizeSynchronizer beginResize:scaledSize
9286
notify:^{
9387
[_reshapeListener viewDidReshape:self];
9488
}];
89+
} else {
90+
[_reshapeListener viewDidReshape:self];
9591
}
9692
}
9793

0 commit comments

Comments
 (0)