@@ -162,6 +162,8 @@ typedef enum {
162
162
kFlutterSemanticsActionMoveCursorBackwardByWord = 1 << 20 ,
163
163
/// Replace the current text in the text field.
164
164
kFlutterSemanticsActionSetText = 1 << 21 ,
165
+ /// Request that the respective focusable widget gain input focus.
166
+ kFlutterSemanticsActionFocus = 1 << 22 ,
165
167
} FlutterSemanticsAction ;
166
168
167
169
/// The set of properties that may be associated with a semantics node.
@@ -844,6 +846,86 @@ typedef struct {
844
846
};
845
847
} FlutterRendererConfig ;
846
848
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
+
847
929
typedef struct {
848
930
/// The size of this struct.
849
931
/// Must be sizeof(FlutterRemoveViewResult).
@@ -859,7 +941,8 @@ typedef struct {
859
941
/// The callback invoked by the engine when the engine has attempted to remove
860
942
/// a view.
861
943
///
862
- /// The |FlutterRemoveViewResult| will be deallocated once the callback returns.
944
+ /// The |FlutterRemoveViewResult| is only guaranteed to be valid during this
945
+ /// callback.
863
946
typedef void (* FlutterRemoveViewCallback )(
864
947
const FlutterRemoveViewResult * /* result */ );
865
948
@@ -891,38 +974,6 @@ typedef struct {
891
974
FlutterRemoveViewCallback remove_view_callback ;
892
975
} FlutterRemoveViewInfo ;
893
976
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
-
926
977
/// The phase of the pointer event.
927
978
typedef enum {
928
979
kCancel ,
@@ -1744,6 +1795,9 @@ typedef struct {
1744
1795
size_t struct_size ;
1745
1796
/// The size of the render target the engine expects to render into.
1746
1797
FlutterSize size ;
1798
+ /// The identifier for the view that the engine will use this backing store to
1799
+ /// render into.
1800
+ FlutterViewId view_id ;
1747
1801
} FlutterBackingStoreConfig ;
1748
1802
1749
1803
typedef enum {
@@ -1857,18 +1911,26 @@ typedef struct {
1857
1911
/// `FlutterBackingStore::struct_size` when specifying a new backing store to
1858
1912
/// the engine. This only matters if the embedder expects to be used with
1859
1913
/// engines older than the version whose headers it used during compilation.
1914
+ ///
1915
+ /// The callback should return true if the operation was successful.
1860
1916
FlutterBackingStoreCreateCallback create_backing_store_callback ;
1861
1917
/// A callback invoked by the engine to release the backing store. The
1862
1918
/// embedder may collect any resources associated with the backing store.
1919
+ ///
1920
+ /// The callback should return true if the operation was successful.
1863
1921
FlutterBackingStoreCollectCallback collect_backing_store_callback ;
1864
1922
/// Callback invoked by the engine to composite the contents of each layer
1865
1923
/// onto the implicit view.
1866
1924
///
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.
1868
1928
///
1869
1929
/// Only one of `present_layers_callback` and `present_view_callback` may be
1870
1930
/// provided. Providing both is an error and engine initialization will
1871
1931
/// terminate.
1932
+ ///
1933
+ /// The callback should return true if the operation was successful.
1872
1934
FlutterLayersPresentCallback present_layers_callback ;
1873
1935
/// Avoid caching backing stores provided by this compositor.
1874
1936
bool avoid_backing_store_cache ;
@@ -1878,6 +1940,8 @@ typedef struct {
1878
1940
/// Only one of `present_layers_callback` and `present_view_callback` may be
1879
1941
/// provided. Providing both is an error and engine initialization will
1880
1942
/// terminate.
1943
+ ///
1944
+ /// The callback should return true if the operation was successful.
1881
1945
FlutterPresentViewCallback present_view_callback ;
1882
1946
} FlutterCompositor ;
1883
1947
@@ -2188,6 +2252,10 @@ typedef struct {
2188
2252
/// `update_semantics_callback`, and
2189
2253
/// `update_semantics_callback2` may be provided; the others
2190
2254
/// 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.
2191
2259
FlutterUpdateSemanticsNodeCallback update_semantics_node_callback ;
2192
2260
/// The legacy callback invoked by the engine in order to give the embedder
2193
2261
/// the chance to respond to updates to semantics custom actions from the Dart
@@ -2204,6 +2272,10 @@ typedef struct {
2204
2272
/// `update_semantics_callback`, and
2205
2273
/// `update_semantics_callback2` may be provided; the others
2206
2274
/// 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.
2207
2279
FlutterUpdateSemanticsCustomActionCallback
2208
2280
update_semantics_custom_action_callback ;
2209
2281
/// Path to a directory used to store data that is cached across runs of a
@@ -2353,6 +2425,10 @@ typedef struct {
2353
2425
/// `update_semantics_callback`, and
2354
2426
/// `update_semantics_callback2` may be provided; the others
2355
2427
/// 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.
2356
2432
FlutterUpdateSemanticsCallback update_semantics_callback ;
2357
2433
2358
2434
/// The callback invoked by the engine in order to give the embedder the
@@ -2518,12 +2594,50 @@ FLUTTER_EXPORT
2518
2594
FlutterEngineResult FlutterEngineRunInitialized (
2519
2595
FLUTTER_API_SYMBOL (FlutterEngine ) engine );
2520
2596
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
+
2521
2627
//------------------------------------------------------------------------------
2522
2628
/// @brief Removes a view.
2523
2629
///
2524
2630
/// 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.
2527
2641
///
2528
2642
/// @param[in] engine A running engine instance.
2529
2643
/// @param[in] info The remove view arguments. This can be deallocated
@@ -3207,6 +3321,12 @@ typedef FlutterEngineResult (*FlutterEngineSetNextFrameCallbackFnPtr)(
3207
3321
FLUTTER_API_SYMBOL (FlutterEngine ) engine ,
3208
3322
VoidCallback callback ,
3209
3323
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 );
3210
3330
3211
3331
/// Function-pointer-based versions of the APIs above.
3212
3332
typedef struct {
@@ -3253,6 +3373,8 @@ typedef struct {
3253
3373
FlutterEngineNotifyDisplayUpdateFnPtr NotifyDisplayUpdate ;
3254
3374
FlutterEngineScheduleFrameFnPtr ScheduleFrame ;
3255
3375
FlutterEngineSetNextFrameCallbackFnPtr SetNextFrameCallback ;
3376
+ FlutterEngineAddViewFnPtr AddView ;
3377
+ FlutterEngineRemoveViewFnPtr RemoveView ;
3256
3378
} FlutterEngineProcTable ;
3257
3379
3258
3380
//------------------------------------------------------------------------------
0 commit comments