Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(602)

Unified Diff: components/exo/shell_surface.cc

Issue 2909213003: Handle input events for ARC++ popup windows. (Closed)
Patch Set: Addressed comments. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/shell_surface.cc
diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc
index 7fe884ddec4f26815a3096cd588f82293181620f..d322a4bec20e4af6a627072eb00c263311fb40fc 100644
--- a/components/exo/shell_surface.cc
+++ b/components/exo/shell_surface.cc
@@ -103,17 +103,23 @@ class CustomWindowTargeter : public aura::WindowTargeter {
if (component != HTNOWHERE && component != HTCLIENT)
return true;
- // If there is an underlay, test against it's bounds instead since it will
- // be equal or larger than the surface's bounds.
+ // If there is an underlay, test against it first as it's bounds may be
+ // larger than the surface's bounds.
aura::Window* shadow_underlay =
static_cast<ShellSurface*>(
widget_->widget_delegate()->GetContentsView())
->shadow_underlay();
if (shadow_underlay) {
- aura::Window::ConvertPointToTarget(window, shadow_underlay, &local_point);
- return gfx::Rect(shadow_underlay->layer()->size()).Contains(local_point);
+ gfx::Point local_point_in_shadow_underlay = local_point;
+ aura::Window::ConvertPointToTarget(window, shadow_underlay,
+ &local_point_in_shadow_underlay);
+ if (gfx::Rect(shadow_underlay->layer()->size())
+ .Contains(local_point_in_shadow_underlay)) {
+ return true;
+ }
}
+ // Otherwise, fallback to hit test on the surface.
aura::Window::ConvertPointToTarget(window, surface->window(), &local_point);
return surface->HitTestRect(gfx::Rect(local_point, gfx::Size(1, 1)));
}
@@ -123,7 +129,8 @@ class CustomWindowTargeter : public aura::WindowTargeter {
aura::Window* window = static_cast<aura::Window*>(root);
Surface* surface = ShellSurface::GetMainSurface(window);
- // Send events which are outside of the surface's bounds to the underlay.
+ // Send events which wouldn't be handled by the surface, to the shadow
+ // underlay.
aura::Window* shadow_underlay =
static_cast<ShellSurface*>(
widget_->widget_delegate()->GetContentsView())
@@ -131,8 +138,12 @@ class CustomWindowTargeter : public aura::WindowTargeter {
if (surface && event->IsLocatedEvent() && shadow_underlay) {
gfx::Point local_point = event->AsLocatedEvent()->location();
int component = widget_->non_client_view()->NonClientHitTest(local_point);
- if (component == HTNOWHERE)
- return shadow_underlay;
+ if (component == HTNOWHERE) {
+ aura::Window::ConvertPointToTarget(window, surface->window(),
+ &local_point);
+ if (!surface->HitTestRect(gfx::Rect(local_point, gfx::Size(1, 1))))
+ return shadow_underlay;
+ }
}
return aura::WindowTargeter::FindTargetForEvent(root, event);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698