@@ -162,6 +162,8 @@ typedef enum {
162162 kFlutterSemanticsActionMoveCursorBackwardByWord = 1 << 20 ,
163163 /// Replace the current text in the text field.
164164 kFlutterSemanticsActionSetText = 1 << 21 ,
165+ /// Request that the respective focusable widget gain input focus.
166+ kFlutterSemanticsActionFocus = 1 << 22 ,
165167} FlutterSemanticsAction ;
166168
167169/// The set of properties that may be associated with a semantics node.
@@ -844,6 +846,86 @@ typedef struct {
844846 };
845847} FlutterRendererConfig ;
846848
849+ /// Display refers to a graphics hardware system consisting of a framebuffer,
850+ /// typically a monitor or a screen. This ID is unique per display and is
851+ /// stable until the Flutter application restarts.
852+ typedef uint64_t FlutterEngineDisplayId ;
853+
854+ typedef struct {
855+ /// The size of this struct. Must be sizeof(FlutterWindowMetricsEvent).
856+ size_t struct_size ;
857+ /// Physical width of the window.
858+ size_t width ;
859+ /// Physical height of the window.
860+ size_t height ;
861+ /// Scale factor for the physical screen.
862+ double pixel_ratio ;
863+ /// Horizontal physical location of the left side of the window on the screen.
864+ size_t left ;
865+ /// Vertical physical location of the top of the window on the screen.
866+ size_t top ;
867+ /// Top inset of window.
868+ double physical_view_inset_top ;
869+ /// Right inset of window.
870+ double physical_view_inset_right ;
871+ /// Bottom inset of window.
872+ double physical_view_inset_bottom ;
873+ /// Left inset of window.
874+ double physical_view_inset_left ;
875+ /// The identifier of the display the view is rendering on.
876+ FlutterEngineDisplayId display_id ;
877+ /// The view that this event is describing.
878+ int64_t view_id ;
879+ } FlutterWindowMetricsEvent ;
880+
881+ typedef struct {
882+ /// The size of this struct.
883+ /// Must be sizeof(FlutterAddViewResult).
884+ size_t struct_size ;
885+
886+ /// True if the add view operation succeeded.
887+ bool added ;
888+
889+ /// The |FlutterAddViewInfo.user_data|.
890+ void * user_data ;
891+ } FlutterAddViewResult ;
892+
893+ /// The callback invoked by the engine when the engine has attempted to add a
894+ /// view.
895+ ///
896+ /// The |FlutterAddViewResult| is only guaranteed to be valid during this
897+ /// callback.
898+ typedef void (* FlutterAddViewCallback )(const FlutterAddViewResult * result );
899+
900+ typedef struct {
901+ /// The size of this struct.
902+ /// Must be sizeof(FlutterAddViewInfo).
903+ size_t struct_size ;
904+
905+ /// The identifier for the view to add. This must be unique.
906+ FlutterViewId view_id ;
907+
908+ /// The view's properties.
909+ ///
910+ /// The metric's |view_id| must match this struct's |view_id|.
911+ const FlutterWindowMetricsEvent * view_metrics ;
912+
913+ /// A baton that is not interpreted by the engine in any way. It will be given
914+ /// back to the embedder in |add_view_callback|. Embedder resources may be
915+ /// associated with this baton.
916+ void * user_data ;
917+
918+ /// Called once the engine has attempted to add the view. This callback is
919+ /// required.
920+ ///
921+ /// The embedder/app must not use the view until the callback is invoked with
922+ /// an `added` value of `true`.
923+ ///
924+ /// This callback is invoked on an internal engine managed thread. Embedders
925+ /// must re-thread if necessary.
926+ FlutterAddViewCallback add_view_callback ;
927+ } FlutterAddViewInfo ;
928+
847929typedef struct {
848930 /// The size of this struct.
849931 /// Must be sizeof(FlutterRemoveViewResult).
@@ -859,7 +941,8 @@ typedef struct {
859941/// The callback invoked by the engine when the engine has attempted to remove
860942/// a view.
861943///
862- /// The |FlutterRemoveViewResult| will be deallocated once the callback returns.
944+ /// The |FlutterRemoveViewResult| is only guaranteed to be valid during this
945+ /// callback.
863946typedef void (* FlutterRemoveViewCallback )(
864947 const FlutterRemoveViewResult * /* result */ );
865948
@@ -891,38 +974,6 @@ typedef struct {
891974 FlutterRemoveViewCallback remove_view_callback ;
892975} FlutterRemoveViewInfo ;
893976
894- /// Display refers to a graphics hardware system consisting of a framebuffer,
895- /// typically a monitor or a screen. This ID is unique per display and is
896- /// stable until the Flutter application restarts.
897- typedef uint64_t FlutterEngineDisplayId ;
898-
899- typedef struct {
900- /// The size of this struct. Must be sizeof(FlutterWindowMetricsEvent).
901- size_t struct_size ;
902- /// Physical width of the window.
903- size_t width ;
904- /// Physical height of the window.
905- size_t height ;
906- /// Scale factor for the physical screen.
907- double pixel_ratio ;
908- /// Horizontal physical location of the left side of the window on the screen.
909- size_t left ;
910- /// Vertical physical location of the top of the window on the screen.
911- size_t top ;
912- /// Top inset of window.
913- double physical_view_inset_top ;
914- /// Right inset of window.
915- double physical_view_inset_right ;
916- /// Bottom inset of window.
917- double physical_view_inset_bottom ;
918- /// Left inset of window.
919- double physical_view_inset_left ;
920- /// The identifier of the display the view is rendering on.
921- FlutterEngineDisplayId display_id ;
922- /// The view that this event is describing.
923- int64_t view_id ;
924- } FlutterWindowMetricsEvent ;
925-
926977/// The phase of the pointer event.
927978typedef enum {
928979 kCancel ,
@@ -1744,6 +1795,9 @@ typedef struct {
17441795 size_t struct_size ;
17451796 /// The size of the render target the engine expects to render into.
17461797 FlutterSize size ;
1798+ /// The identifier for the view that the engine will use this backing store to
1799+ /// render into.
1800+ FlutterViewId view_id ;
17471801} FlutterBackingStoreConfig ;
17481802
17491803typedef enum {
@@ -1857,18 +1911,26 @@ typedef struct {
18571911 /// `FlutterBackingStore::struct_size` when specifying a new backing store to
18581912 /// the engine. This only matters if the embedder expects to be used with
18591913 /// engines older than the version whose headers it used during compilation.
1914+ ///
1915+ /// The callback should return true if the operation was successful.
18601916 FlutterBackingStoreCreateCallback create_backing_store_callback ;
18611917 /// A callback invoked by the engine to release the backing store. The
18621918 /// embedder may collect any resources associated with the backing store.
1919+ ///
1920+ /// The callback should return true if the operation was successful.
18631921 FlutterBackingStoreCollectCallback collect_backing_store_callback ;
18641922 /// Callback invoked by the engine to composite the contents of each layer
18651923 /// onto the implicit view.
18661924 ///
1867- /// DEPRECATED: Use |present_view_callback| to support multiple views.
1925+ /// DEPRECATED: Use `present_view_callback` to support multiple views.
1926+ /// If this callback is provided, `FlutterEngineAddView` and
1927+ /// `FlutterEngineRemoveView` should not be used.
18681928 ///
18691929 /// Only one of `present_layers_callback` and `present_view_callback` may be
18701930 /// provided. Providing both is an error and engine initialization will
18711931 /// terminate.
1932+ ///
1933+ /// The callback should return true if the operation was successful.
18721934 FlutterLayersPresentCallback present_layers_callback ;
18731935 /// Avoid caching backing stores provided by this compositor.
18741936 bool avoid_backing_store_cache ;
@@ -1878,6 +1940,8 @@ typedef struct {
18781940 /// Only one of `present_layers_callback` and `present_view_callback` may be
18791941 /// provided. Providing both is an error and engine initialization will
18801942 /// terminate.
1943+ ///
1944+ /// The callback should return true if the operation was successful.
18811945 FlutterPresentViewCallback present_view_callback ;
18821946} FlutterCompositor ;
18831947
@@ -2188,6 +2252,10 @@ typedef struct {
21882252 /// `update_semantics_callback`, and
21892253 /// `update_semantics_callback2` may be provided; the others
21902254 /// should be set to null.
2255+ ///
2256+ /// This callback is incompatible with multiple views. If this
2257+ /// callback is provided, `FlutterEngineAddView` and
2258+ /// `FlutterEngineRemoveView` should not be used.
21912259 FlutterUpdateSemanticsNodeCallback update_semantics_node_callback ;
21922260 /// The legacy callback invoked by the engine in order to give the embedder
21932261 /// the chance to respond to updates to semantics custom actions from the Dart
@@ -2204,6 +2272,10 @@ typedef struct {
22042272 /// `update_semantics_callback`, and
22052273 /// `update_semantics_callback2` may be provided; the others
22062274 /// should be set to null.
2275+ ///
2276+ /// This callback is incompatible with multiple views. If this
2277+ /// callback is provided, `FlutterEngineAddView` and
2278+ /// `FlutterEngineRemoveView` should not be used.
22072279 FlutterUpdateSemanticsCustomActionCallback
22082280 update_semantics_custom_action_callback ;
22092281 /// Path to a directory used to store data that is cached across runs of a
@@ -2353,6 +2425,10 @@ typedef struct {
23532425 /// `update_semantics_callback`, and
23542426 /// `update_semantics_callback2` may be provided; the others
23552427 /// must be set to null.
2428+ ///
2429+ /// This callback is incompatible with multiple views. If this
2430+ /// callback is provided, `FlutterEngineAddView` and
2431+ /// `FlutterEngineRemoveView` should not be used.
23562432 FlutterUpdateSemanticsCallback update_semantics_callback ;
23572433
23582434 /// The callback invoked by the engine in order to give the embedder the
@@ -2518,12 +2594,50 @@ FLUTTER_EXPORT
25182594FlutterEngineResult FlutterEngineRunInitialized (
25192595 FLUTTER_API_SYMBOL (FlutterEngine ) engine );
25202596
2597+ //------------------------------------------------------------------------------
2598+ /// @brief Adds a view.
2599+ ///
2600+ /// This is an asynchronous operation. The view should not be used
2601+ /// until the |info.add_view_callback| is invoked with an |added|
2602+ /// value of true. The embedder should prepare resources in advance
2603+ /// but be ready to clean up on failure.
2604+ ///
2605+ /// A frame is scheduled if the operation succeeds.
2606+ ///
2607+ /// The callback is invoked on a thread managed by the engine. The
2608+ /// embedder should re-thread if needed.
2609+ ///
2610+ /// Attempting to add the implicit view will fail and will return
2611+ /// kInvalidArguments. Attempting to add a view with an already
2612+ /// existing view ID will fail, and |info.add_view_callback| will be
2613+ /// invoked with an |added| value of false.
2614+ ///
2615+ /// @param[in] engine A running engine instance.
2616+ /// @param[in] info The add view arguments. This can be deallocated
2617+ /// once |FlutterEngineAddView| returns, before
2618+ /// |add_view_callback| is invoked.
2619+ ///
2620+ /// @return The result of *starting* the asynchronous operation. If
2621+ /// `kSuccess`, the |add_view_callback| will be invoked.
2622+ FLUTTER_EXPORT
2623+ FlutterEngineResult FlutterEngineAddView (FLUTTER_API_SYMBOL (FlutterEngine )
2624+ engine ,
2625+ const FlutterAddViewInfo * info );
2626+
25212627//------------------------------------------------------------------------------
25222628/// @brief Removes a view.
25232629///
25242630/// This is an asynchronous operation. The view's resources must not
2525- /// be cleaned up until the |remove_view_callback| is invoked with
2526- /// a |removed| value of `true`.
2631+ /// be cleaned up until |info.remove_view_callback| is invoked with
2632+ /// a |removed| value of true.
2633+ ///
2634+ /// The callback is invoked on a thread managed by the engine. The
2635+ /// embedder should re-thread if needed.
2636+ ///
2637+ /// Attempting to remove the implicit view will fail and will return
2638+ /// kInvalidArguments. Attempting to remove a view with a
2639+ /// non-existent view ID will fail, and |info.remove_view_callback|
2640+ /// will be invoked with a |removed| value of false.
25272641///
25282642/// @param[in] engine A running engine instance.
25292643/// @param[in] info The remove view arguments. This can be deallocated
@@ -3207,6 +3321,12 @@ typedef FlutterEngineResult (*FlutterEngineSetNextFrameCallbackFnPtr)(
32073321 FLUTTER_API_SYMBOL (FlutterEngine ) engine ,
32083322 VoidCallback callback ,
32093323 void * user_data );
3324+ typedef FlutterEngineResult (* FlutterEngineAddViewFnPtr )(
3325+ FLUTTER_API_SYMBOL (FlutterEngine ) engine ,
3326+ const FlutterAddViewInfo * info );
3327+ typedef FlutterEngineResult (* FlutterEngineRemoveViewFnPtr )(
3328+ FLUTTER_API_SYMBOL (FlutterEngine ) engine ,
3329+ const FlutterRemoveViewInfo * info );
32103330
32113331/// Function-pointer-based versions of the APIs above.
32123332typedef struct {
@@ -3253,6 +3373,8 @@ typedef struct {
32533373 FlutterEngineNotifyDisplayUpdateFnPtr NotifyDisplayUpdate ;
32543374 FlutterEngineScheduleFrameFnPtr ScheduleFrame ;
32553375 FlutterEngineSetNextFrameCallbackFnPtr SetNextFrameCallback ;
3376+ FlutterEngineAddViewFnPtr AddView ;
3377+ FlutterEngineRemoveViewFnPtr RemoveView ;
32563378} FlutterEngineProcTable ;
32573379
32583380//------------------------------------------------------------------------------
0 commit comments