Skip to content

Commit

Permalink
Change [FlutterView start] to synchronousResizing property
Browse files Browse the repository at this point in the history
  • Loading branch information
knopp committed Oct 1, 2020
1 parent 7400492 commit c32f0cd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
6 changes: 3 additions & 3 deletions shell/platform/darwin/macos/framework/Source/FlutterEngine.mm
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ - (BOOL)runWithEntrypoint:(NSString*)entrypoint {

[self sendUserLocales];
[self updateDisplayConfig];
[self.viewController.flutterView start];
self.viewController.flutterView.synchronousResizing = YES;
return YES;
}

Expand All @@ -301,7 +301,7 @@ - (void)setViewController:(FlutterViewController*)controller {
_resourceContext = nil;
}
if (_engine) {
[self.viewController.flutterView start];
self.viewController.flutterView.synchronousResizing = YES;
}
}

Expand Down Expand Up @@ -353,7 +353,7 @@ - (void)updateDisplayConfig {
CVDisplayLinkRelease(displayLinkRef);
}

// Must be driven by FlutterView (i.e. [FlutterView start])
// Called by [FlutterViewController viewDidReshape]
- (void)updateWindowMetrics {
if (!_engine) {
return;
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/darwin/macos/framework/Source/FlutterView.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
@interface FlutterView : NSView

@property(readwrite, nonatomic, nonnull) NSOpenGLContext* openGLContext;
@property(readwrite, nonatomic) BOOL synchronousResizing;

- (nullable instancetype)initWithFrame:(NSRect)frame
shareContext:(nonnull NSOpenGLContext*)shareContext
Expand All @@ -37,7 +38,6 @@
- (nullable instancetype)initWithCoder:(nonnull NSCoder*)coder NS_UNAVAILABLE;
- (nonnull instancetype)init NS_UNAVAILABLE;

- (void)start;
- (void)present;
- (int)getFrameBufferIdForSize:(CGSize)size;

Expand Down
10 changes: 3 additions & 7 deletions shell/platform/darwin/macos/framework/Source/FlutterView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ @interface FlutterView () <FlutterResizeSynchronizerDelegate> {
__weak id<FlutterViewReshapeListener> _reshapeListener;
FlutterResizeSynchronizer* resizeSynchronizer;
FlutterSurfaceManager* surfaceManager;
BOOL active;
CALayer* contentLayer;
}

Expand Down Expand Up @@ -80,18 +79,15 @@ - (void)present {
[resizeSynchronizer requestCommit];
}

- (void)start {
active = YES;
[self reshaped];
}

- (void)reshaped {
if (active) {
if (self.synchronousResizing) {
CGSize scaledSize = [self convertSizeToBacking:self.bounds.size];
[resizeSynchronizer beginResize:scaledSize
notify:^{
[_reshapeListener viewDidReshape:self];
}];
} else {
[_reshapeListener viewDidReshape:self];
}
}

Expand Down

0 comments on commit c32f0cd

Please sign in to comment.