OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SERVICES_UI_WS_EVENT_TARGETER_H_ |
| 6 #define SERVICES_UI_WS_EVENT_TARGETER_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
| 11 |
| 12 namespace gfx { |
| 13 class Point; |
| 14 } |
| 15 |
| 16 namespace ui { |
| 17 class LocatedEvent; |
| 18 |
| 19 namespace ws { |
| 20 struct DeepestWindow; |
| 21 class EventDispatcherDelegate; |
| 22 class ModalWindowController; |
| 23 class ServerWindow; |
| 24 |
| 25 // Keeps track of state associated with an active pointer. |
| 26 struct PointerTarget { |
| 27 PointerTarget() |
| 28 : window(nullptr), |
| 29 is_mouse_event(false), |
| 30 in_nonclient_area(false), |
| 31 is_pointer_down(false) {} |
| 32 |
| 33 // The target window, which may be null. null is used in two situations: |
| 34 // when there is no valid window target, or there was a target but the |
| 35 // window is destroyed before a corresponding release/cancel. |
| 36 ServerWindow* window; |
| 37 |
| 38 bool is_mouse_event; |
| 39 |
| 40 // Did the pointer event start in the non-client area. |
| 41 bool in_nonclient_area; |
| 42 |
| 43 bool is_pointer_down; |
| 44 }; |
| 45 |
| 46 // Finds the PointerTarget for an event or the DeepestWindow for a location. |
| 47 class EventTargeter { |
| 48 public: |
| 49 EventTargeter(EventDispatcherDelegate* event_dispatcher_delegate, |
| 50 ModalWindowController* modal_window_controller); |
| 51 ~EventTargeter(); |
| 52 |
| 53 // Returns a PointerTarget for the supplied |event|. If there is no valid |
| 54 // event target for the specified location |window| in the returned value is |
| 55 // null. |
| 56 PointerTarget PointerTargetForEvent(const ui::LocatedEvent& event, |
| 57 int64_t* display_id); |
| 58 |
| 59 // Returns a DeepestWindow for the supplied |location|. If there is no valid |
| 60 // root window, |window| in the returned value is null. |
| 61 DeepestWindow FindDeepestVisibleWindowForEvents(gfx::Point* location, |
| 62 int64_t* display_id); |
| 63 |
| 64 private: |
| 65 EventDispatcherDelegate* event_dispatcher_delegate_; |
| 66 ModalWindowController* modal_window_controller_; |
| 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(EventTargeter); |
| 69 }; |
| 70 |
| 71 } // namespace ws |
| 72 } // namespace ui |
| 73 |
| 74 #endif // SERVICES_UI_WS_EVENT_TARGETER_H_ |
OLD | NEW |