@@ -36,6 +36,24 @@ FlatlandExternalViewEmbedder::FlatlandExternalViewEmbedder(
36
36
root_transform_id_ = flatland_->NextTransformId ();
37
37
flatland_->flatland ()->CreateTransform (root_transform_id_);
38
38
flatland_->flatland ()->SetRootTransform (root_transform_id_);
39
+
40
+ if (intercept_all_input) {
41
+ input_interceptor_transform_ = flatland_->NextTransformId ();
42
+ flatland_->flatland ()->CreateTransform (*input_interceptor_transform_);
43
+
44
+ flatland_->flatland ()->AddChild (root_transform_id_,
45
+ *input_interceptor_transform_);
46
+ child_transforms_.emplace_back (*input_interceptor_transform_);
47
+
48
+ // Attach full-screen hit testing shield. Note that since the hit-region
49
+ // may be transformed (translated, rotated), we do not want to set
50
+ // width/height to FLT_MAX. This will cause a numeric overflow.
51
+ flatland_->flatland ()->SetHitRegions (
52
+ *input_interceptor_transform_,
53
+ {{{0 , 0 , kMaxHitRegionSize , kMaxHitRegionSize },
54
+ fuchsia::ui::composition::HitTestInteraction::
55
+ SEMANTICALLY_INVISIBLE}});
56
+ }
39
57
}
40
58
41
59
FlatlandExternalViewEmbedder::~FlatlandExternalViewEmbedder () = default ;
@@ -336,6 +354,18 @@ void FlatlandExternalViewEmbedder::SubmitFrame(
336
354
// Reset for the next pass:
337
355
flatland_layer_index++;
338
356
}
357
+
358
+ // TODO(fxbug.dev/104956): Setting per-layer overlay hit region for Flatland
359
+ // external view embedder should match with what is being done in GFX
360
+ // external view embedder.
361
+ // Set up the input interceptor at the top of the
362
+ // scene, if applicable. It will capture all input, and any unwanted input
363
+ // will be reinjected into embedded views.
364
+ if (input_interceptor_transform_.has_value ()) {
365
+ flatland_->flatland ()->AddChild (root_transform_id_,
366
+ *input_interceptor_transform_);
367
+ child_transforms_.emplace_back (*input_interceptor_transform_);
368
+ }
339
369
}
340
370
341
371
// Present the session to Scenic, along with surface acquire/release fences.
0 commit comments