-
Notifications
You must be signed in to change notification settings - Fork 6k
Add an Info.plist flag to enable MacOS platform views preview support #22929
Add an Info.plist flag to enable MacOS platform views preview support #22929
Conversation
Add platform view support in FlutterGLCompositor and FlutterViewController
80af14c
to
b28f61f
Compare
…upport for MacOS. Enabling the key disables smooth resizing.
b28f61f
to
b33da83
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about [FlutterView present]
and [FlutterView reshaped]
Maybe @iskakaushik has more context as he reviewed #21525?
cc @knopp
#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterPlatformViewController_Internal.h" | ||
|
||
@implementation FlutterPlatformViewController | ||
@implementation FlutterPlatformViewController { | ||
bool _embeddedViewsEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this instance method.
// found in the LICENSE file. | ||
|
||
// The name of the Info.plist flag to enable the embedded MacOS views preview. | ||
const char* const kEmbeddedViewsPreview = "io.flutter_embedded_views_preview"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need the constant in a separate file, can move it to FlutterPlatformViewController.mm
@@ -56,6 +71,11 @@ - (void)onDisposeWithViewId:(int64_t)viewId result:(nonnull FlutterResult)result | |||
|
|||
- (void)registerViewFactory:(nonnull NSObject<FlutterPlatformViewFactory>*)factory | |||
withId:(nonnull NSString*)factoryId { | |||
if (!_embeddedViewsEnabled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can just be if (![self embeddedViewsEnabled])
return self; | ||
} | ||
|
||
- (void)onCreateWithViewId:(int64_t)viewId | ||
viewType:(nonnull NSString*)viewType | ||
result:(nonnull FlutterResult)result { | ||
if (!_embeddedViewsEnabled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this, the if (factory == nil)
already handles this.
Same in onDispose
@@ -15,6 +16,7 @@ @interface FlutterView () <FlutterResizeSynchronizerDelegate> { | |||
__weak id<FlutterViewReshapeListener> _reshapeListener; | |||
FlutterResizeSynchronizer* _resizeSynchronizer; | |||
FlutterSurfaceManager* _surfaceManager; | |||
bool _embedded_views_preview_enabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need this ivar, can just use [FlutterPlatformViewController embeddedViewsEnabled] when necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ivars should be camelCase.
First iteration of smooth resizing worked with merged platform / raster threads so it should be possible to do it here as well. I'll look into it when this lands. Might be bit trickier for dynamic thread merging. |
@iskakaushik Do you know who the owner for this is? |
I'd be happy to continue working on this one, but waiting on this #22905 to get reviewed. |
Enabling the flag
io.flutter_embedded_views_preview
enables platform view support for MacOS.Additionally, when the flag is enabled, the render and main threads are merged, however this disables smooth resizing as smooth resizing requires synchronization and blocking between the main and render thread.
Tentatively using the
io.flutter_embedded_views_preview
flag as it was used in #6756.Please only review the last commit, this PR depends on #22905 being merged.