This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
[Embedder API] Add view #51523
Merged
Merged
[Embedder API] Add view #51523
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -831,6 +831,86 @@ typedef struct { | |
| }; | ||
| } FlutterRendererConfig; | ||
|
|
||
| /// Display refers to a graphics hardware system consisting of a framebuffer, | ||
| /// typically a monitor or a screen. This ID is unique per display and is | ||
| /// stable until the Flutter application restarts. | ||
| typedef uint64_t FlutterEngineDisplayId; | ||
|
|
||
| typedef struct { | ||
| /// The size of this struct. Must be sizeof(FlutterWindowMetricsEvent). | ||
| size_t struct_size; | ||
| /// Physical width of the window. | ||
| size_t width; | ||
| /// Physical height of the window. | ||
| size_t height; | ||
| /// Scale factor for the physical screen. | ||
| double pixel_ratio; | ||
| /// Horizontal physical location of the left side of the window on the screen. | ||
| size_t left; | ||
| /// Vertical physical location of the top of the window on the screen. | ||
| size_t top; | ||
| /// Top inset of window. | ||
| double physical_view_inset_top; | ||
| /// Right inset of window. | ||
| double physical_view_inset_right; | ||
| /// Bottom inset of window. | ||
| double physical_view_inset_bottom; | ||
| /// Left inset of window. | ||
| double physical_view_inset_left; | ||
| /// The identifier of the display the view is rendering on. | ||
| FlutterEngineDisplayId display_id; | ||
| /// The view that this event is describing. | ||
| int64_t view_id; | ||
| } FlutterWindowMetricsEvent; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to future archaeologists - this is just code moving around; there are no diffs here. |
||
|
|
||
| typedef struct { | ||
| /// The size of this struct. | ||
| /// Must be sizeof(FlutterAddViewResult). | ||
| size_t struct_size; | ||
|
|
||
| /// True if the add view operation succeeded. | ||
| bool added; | ||
|
|
||
| /// The |FlutterAddViewInfo.user_data|. | ||
| void* user_data; | ||
| } FlutterAddViewResult; | ||
|
|
||
| /// The callback invoked by the engine when the engine has attempted to add a | ||
| /// view. | ||
| /// | ||
| /// The |FlutterAddViewResult| is only guaranteed to be valid during this | ||
| /// callback. | ||
| typedef void (*FlutterAddViewCallback)(const FlutterAddViewResult* result); | ||
|
|
||
| typedef struct { | ||
| /// The size of this struct. | ||
| /// Must be sizeof(FlutterAddViewInfo). | ||
| size_t struct_size; | ||
|
|
||
| /// The identifier for the view to add. This must be unique. | ||
| FlutterViewId view_id; | ||
|
|
||
| /// The view's properties. | ||
| /// | ||
| /// The metric's |view_id| must match this struct's |view_id|. | ||
| const FlutterWindowMetricsEvent* view_metrics; | ||
|
|
||
| /// A baton that is not interpreted by the engine in any way. It will be given | ||
| /// back to the embedder in |add_view_callback|. Embedder resources may be | ||
| /// associated with this baton. | ||
| void* user_data; | ||
|
|
||
| /// Called once the engine has attempted to add the view. This callback is | ||
| /// required. | ||
| /// | ||
| /// The embedder/app must not use the view until the callback is invoked with | ||
| /// an `added` value of `true`. | ||
| /// | ||
| /// This callback is invoked on an internal engine managed thread. Embedders | ||
| /// must re-thread if necessary. | ||
| FlutterAddViewCallback add_view_callback; | ||
| } FlutterAddViewInfo; | ||
|
|
||
| typedef struct { | ||
| /// The size of this struct. | ||
| /// Must be sizeof(FlutterRemoveViewResult). | ||
|
|
@@ -846,7 +926,8 @@ typedef struct { | |
| /// The callback invoked by the engine when the engine has attempted to remove | ||
| /// a view. | ||
| /// | ||
| /// The |FlutterRemoveViewResult| will be deallocated once the callback returns. | ||
| /// The |FlutterRemoveViewResult| is only guaranteed to be valid during this | ||
| /// callback. | ||
| typedef void (*FlutterRemoveViewCallback)( | ||
| const FlutterRemoveViewResult* /* result */); | ||
|
|
||
|
|
@@ -878,38 +959,6 @@ typedef struct { | |
| FlutterRemoveViewCallback remove_view_callback; | ||
| } FlutterRemoveViewInfo; | ||
|
|
||
| /// Display refers to a graphics hardware system consisting of a framebuffer, | ||
| /// typically a monitor or a screen. This ID is unique per display and is | ||
| /// stable until the Flutter application restarts. | ||
| typedef uint64_t FlutterEngineDisplayId; | ||
|
|
||
| typedef struct { | ||
| /// The size of this struct. Must be sizeof(FlutterWindowMetricsEvent). | ||
| size_t struct_size; | ||
| /// Physical width of the window. | ||
| size_t width; | ||
| /// Physical height of the window. | ||
| size_t height; | ||
| /// Scale factor for the physical screen. | ||
| double pixel_ratio; | ||
| /// Horizontal physical location of the left side of the window on the screen. | ||
| size_t left; | ||
| /// Vertical physical location of the top of the window on the screen. | ||
| size_t top; | ||
| /// Top inset of window. | ||
| double physical_view_inset_top; | ||
| /// Right inset of window. | ||
| double physical_view_inset_right; | ||
| /// Bottom inset of window. | ||
| double physical_view_inset_bottom; | ||
| /// Left inset of window. | ||
| double physical_view_inset_left; | ||
| /// The identifier of the display the view is rendering on. | ||
| FlutterEngineDisplayId display_id; | ||
| /// The view that this event is describing. | ||
| int64_t view_id; | ||
| } FlutterWindowMetricsEvent; | ||
|
|
||
| /// The phase of the pointer event. | ||
| typedef enum { | ||
| kCancel, | ||
|
|
@@ -1851,7 +1900,9 @@ typedef struct { | |
| /// Callback invoked by the engine to composite the contents of each layer | ||
| /// onto the implicit view. | ||
| /// | ||
| /// DEPRECATED: Use |present_view_callback| to support multiple views. | ||
| /// DEPRECATED: Use `present_view_callback` to support multiple views. | ||
| /// If this callback is provided, `FlutterEngineAddView` and | ||
| /// `FlutterEngineRemoveView` should not be used. | ||
| /// | ||
| /// Only one of `present_layers_callback` and `present_view_callback` may be | ||
| /// provided. Providing both is an error and engine initialization will | ||
|
|
@@ -2175,6 +2226,10 @@ typedef struct { | |
| /// `update_semantics_callback`, and | ||
| /// `update_semantics_callback2` may be provided; the others | ||
| /// should be set to null. | ||
| /// | ||
| /// This callback is incompatible with multiple views. If this | ||
| /// callback is provided, `FlutterEngineAddView` and | ||
| /// `FlutterEngineRemoveView` should not be used. | ||
| FlutterUpdateSemanticsNodeCallback update_semantics_node_callback; | ||
| /// The legacy callback invoked by the engine in order to give the embedder | ||
| /// the chance to respond to updates to semantics custom actions from the Dart | ||
|
|
@@ -2191,6 +2246,10 @@ typedef struct { | |
| /// `update_semantics_callback`, and | ||
| /// `update_semantics_callback2` may be provided; the others | ||
| /// should be set to null. | ||
| /// | ||
| /// This callback is incompatible with multiple views. If this | ||
| /// callback is provided, `FlutterEngineAddView` and | ||
| /// `FlutterEngineRemoveView` should not be used. | ||
| FlutterUpdateSemanticsCustomActionCallback | ||
| update_semantics_custom_action_callback; | ||
| /// Path to a directory used to store data that is cached across runs of a | ||
|
|
@@ -2340,6 +2399,10 @@ typedef struct { | |
| /// `update_semantics_callback`, and | ||
| /// `update_semantics_callback2` may be provided; the others | ||
| /// must be set to null. | ||
| /// | ||
| /// This callback is incompatible with multiple views. If this | ||
| /// callback is provided, `FlutterEngineAddView` and | ||
| /// `FlutterEngineRemoveView` should not be used. | ||
| FlutterUpdateSemanticsCallback update_semantics_callback; | ||
|
|
||
| /// The callback invoked by the engine in order to give the embedder the | ||
|
|
@@ -2505,6 +2568,25 @@ FLUTTER_EXPORT | |
| FlutterEngineResult FlutterEngineRunInitialized( | ||
| FLUTTER_API_SYMBOL(FlutterEngine) engine); | ||
|
|
||
| //------------------------------------------------------------------------------ | ||
| /// @brief Adds a view. | ||
| /// | ||
| /// This is an asynchronous operation. The view should not be used | ||
| /// until the |add_view_callback| is invoked with an `added` of | ||
| /// `true`. | ||
| /// | ||
| /// @param[in] engine A running engine instance. | ||
| /// @param[in] info The add view arguments. This can be deallocated | ||
| /// once |FlutterEngineAddView| returns, before | ||
| /// |add_view_callback| is invoked. | ||
| /// | ||
| /// @return The result of *starting* the asynchronous operation. If | ||
| /// `kSuccess`, the |add_view_callback| will be invoked. | ||
| FLUTTER_EXPORT | ||
| FlutterEngineResult FlutterEngineAddView(FLUTTER_API_SYMBOL(FlutterEngine) | ||
| engine, | ||
| const FlutterAddViewInfo* info); | ||
|
|
||
| //------------------------------------------------------------------------------ | ||
| /// @brief Removes a view. | ||
| /// | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.