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

Unified Diff: services/ui/ws/event_targeter.h

Issue 2905333002: Separate out event-targeting logic in EventDispatcher to EventTargeter. (Closed)
Patch Set: rebase 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 | « services/ui/ws/event_dispatcher.cc ('k') | services/ui/ws/event_targeter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/event_targeter.h
diff --git a/services/ui/ws/event_targeter.h b/services/ui/ws/event_targeter.h
new file mode 100644
index 0000000000000000000000000000000000000000..a59aba2b5b3d3e6c5b5ceb26167a3de0109e2421
--- /dev/null
+++ b/services/ui/ws/event_targeter.h
@@ -0,0 +1,74 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_UI_WS_EVENT_TARGETER_H_
+#define SERVICES_UI_WS_EVENT_TARGETER_H_
+
+#include <stdint.h>
+
+#include "base/macros.h"
+
+namespace gfx {
+class Point;
+}
+
+namespace ui {
+class LocatedEvent;
+
+namespace ws {
+struct DeepestWindow;
+class EventDispatcherDelegate;
+class ModalWindowController;
+class ServerWindow;
+
+// Keeps track of state associated with an active pointer.
+struct PointerTarget {
+ PointerTarget()
+ : window(nullptr),
+ is_mouse_event(false),
+ in_nonclient_area(false),
+ is_pointer_down(false) {}
+
+ // The target window, which may be null. null is used in two situations:
+ // when there is no valid window target, or there was a target but the
+ // window is destroyed before a corresponding release/cancel.
+ ServerWindow* window;
+
+ bool is_mouse_event;
+
+ // Did the pointer event start in the non-client area.
+ bool in_nonclient_area;
+
+ bool is_pointer_down;
+};
+
+// Finds the PointerTarget for an event or the DeepestWindow for a location.
+class EventTargeter {
+ public:
+ EventTargeter(EventDispatcherDelegate* event_dispatcher_delegate,
+ ModalWindowController* modal_window_controller);
+ ~EventTargeter();
+
+ // Returns a PointerTarget for the supplied |event|. If there is no valid
+ // event target for the specified location |window| in the returned value is
+ // null.
+ PointerTarget PointerTargetForEvent(const ui::LocatedEvent& event,
+ int64_t* display_id);
+
+ // Returns a DeepestWindow for the supplied |location|. If there is no valid
+ // root window, |window| in the returned value is null.
+ DeepestWindow FindDeepestVisibleWindowForEvents(gfx::Point* location,
+ int64_t* display_id);
+
+ private:
+ EventDispatcherDelegate* event_dispatcher_delegate_;
+ ModalWindowController* modal_window_controller_;
+
+ DISALLOW_COPY_AND_ASSIGN(EventTargeter);
+};
+
+} // namespace ws
+} // namespace ui
+
+#endif // SERVICES_UI_WS_EVENT_TARGETER_H_
« no previous file with comments | « services/ui/ws/event_dispatcher.cc ('k') | services/ui/ws/event_targeter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698