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

Unified Diff: ui/aura/window_targeter.cc

Issue 113283005: aura: Start using EventPrcessor interface for event dispatch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years 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 | « ui/aura/window_targeter.h ('k') | ui/events/event_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window_targeter.cc
diff --git a/ui/aura/window_targeter.cc b/ui/aura/window_targeter.cc
index 767a79dbbd976fc38983aa3740cb12975afcca1f..586392bcdc81b9e8ceb02a8a0971530ae9324f50 100644
--- a/ui/aura/window_targeter.cc
+++ b/ui/aura/window_targeter.cc
@@ -4,8 +4,10 @@
#include "ui/aura/window_targeter.h"
+#include "ui/aura/client/capture_client.h"
#include "ui/aura/client/event_client.h"
#include "ui/aura/client/focus_client.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
#include "ui/events/event_target.h"
@@ -56,4 +58,38 @@ bool WindowTargeter::SubtreeShouldBeExploredForEvent(
return window->bounds().Contains(event.location());
}
+ui::EventTarget* WindowTargeter::FindTargetForLocatedEvent(
+ ui::EventTarget* root,
+ ui::LocatedEvent* event) {
+ Window* window = static_cast<Window*>(root);
+ if (!window->parent()) {
+ Window* target = FindTargetInRootWindow(window, *event);
+ if (target) {
+ window->ConvertEventToTarget(target, event);
+ return target;
+ }
+ }
+ return EventTargeter::FindTargetForLocatedEvent(root, event);
+}
+
+Window* WindowTargeter::FindTargetInRootWindow(Window* root_window,
+ const ui::LocatedEvent& event) {
+ DCHECK_EQ(root_window, root_window->GetRootWindow());
+
+ // Mouse events should be dispatched to the window that processed the
+ // mouse-press events (if any).
+ if (event.IsScrollEvent() || event.IsMouseEvent()) {
+ WindowEventDispatcher* dispatcher = root_window->GetDispatcher();
+ if (dispatcher->mouse_pressed_handler())
+ return dispatcher->mouse_pressed_handler();
+ }
+
+ // All events should be directed towards the capture window (if any).
+ Window* capture_window = client::GetCaptureWindow(root_window);
+ if (capture_window)
+ return capture_window;
+
+ return NULL;
+}
+
} // namespace aura
« no previous file with comments | « ui/aura/window_targeter.h ('k') | ui/events/event_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698