@@ -28,14 +28,22 @@ FlatlandExternalViewEmbedder::FlatlandExternalViewEmbedder(
28
28
std::shared_ptr<FlatlandConnection> flatland,
29
29
std::shared_ptr<SurfaceProducer> surface_producer,
30
30
bool intercept_all_input)
31
- : flatland_(flatland), surface_producer_(surface_producer) {
31
+ : flatland_(flatland),
32
+ surface_producer_ (surface_producer),
33
+ intercept_all_input_(intercept_all_input) {
32
34
flatland_->flatland ()->CreateView2 (
33
35
std::move (view_creation_token), std::move (view_identity),
34
36
std::move (view_protocols), std::move (parent_viewport_watcher_request));
35
37
36
38
root_transform_id_ = flatland_->NextTransformId ();
37
39
flatland_->flatland ()->CreateTransform (root_transform_id_);
38
40
flatland_->flatland ()->SetRootTransform (root_transform_id_);
41
+
42
+ if (intercept_all_input_) {
43
+ input_interceptor_node_ = flatland_->NextTransformId ();
44
+ flatland_->flatland ()->CreateTransform (*input_interceptor_node_);
45
+ child_transforms_.emplace_back (*input_interceptor_node_);
46
+ }
39
47
}
40
48
41
49
FlatlandExternalViewEmbedder::~FlatlandExternalViewEmbedder () = default ;
@@ -336,6 +344,27 @@ void FlatlandExternalViewEmbedder::SubmitFrame(
336
344
// Reset for the next pass:
337
345
flatland_layer_index++;
338
346
}
347
+
348
+ // TODO(fxbug.dev/104956): Setting hit regions for Flatland external view
349
+ // embedder should match with what is being done in GFX external view
350
+ // embedder.
351
+ // Set up the input interceptor at the top of the scene, if applicable. It
352
+ // will capture all input, and any unwanted input will be reinjected into
353
+ // embedded views.
354
+ if (intercept_all_input_) {
355
+ FML_CHECK (input_interceptor_node_.has_value ());
356
+ flatland_->flatland ()->AddChild (root_transform_id_,
357
+ *input_interceptor_node_);
358
+
359
+ // Attach full-screen hit testing shield. Note that since the hit-region
360
+ // may be transformed (translated, rotated), we do not want to set
361
+ // width/height to FLT_MAX. This will cause a numeric overflow.
362
+ flatland_->flatland ()->SetHitRegions (
363
+ *input_interceptor_node_,
364
+ {{{0 , 0 , kMaxHitRegionSize , kMaxHitRegionSize },
365
+ fuchsia::ui::composition::HitTestInteraction::
366
+ SEMANTICALLY_INVISIBLE}});
367
+ }
339
368
}
340
369
341
370
// Present the session to Scenic, along with surface acquire/release fences.
0 commit comments