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

Side by Side Diff: services/ui/ws/event_dispatcher_delegate.h

Issue 2778943005: Keep root_location to be in pixels and display coordinates in WS. (Closed)
Patch Set: TODO 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SERVICES_UI_WS_EVENT_DISPATCHER_DELEGATE_H_ 5 #ifndef SERVICES_UI_WS_EVENT_DISPATCHER_DELEGATE_H_
6 #define SERVICES_UI_WS_EVENT_DISPATCHER_DELEGATE_H_ 6 #define SERVICES_UI_WS_EVENT_DISPATCHER_DELEGATE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "services/ui/common/types.h" 10 #include "services/ui/common/types.h"
(...skipping 13 matching lines...) Expand all
24 24
25 // Used by EventDispatcher for mocking in tests. 25 // Used by EventDispatcher for mocking in tests.
26 class EventDispatcherDelegate { 26 class EventDispatcherDelegate {
27 public: 27 public:
28 enum class AcceleratorPhase { 28 enum class AcceleratorPhase {
29 PRE, 29 PRE,
30 POST, 30 POST,
31 }; 31 };
32 32
33 virtual void OnAccelerator(uint32_t accelerator, 33 virtual void OnAccelerator(uint32_t accelerator,
34 const int64_t display_id,
34 const ui::Event& event, 35 const ui::Event& event,
35 AcceleratorPhase phase) = 0; 36 AcceleratorPhase phase) = 0;
36 37
37 virtual void SetFocusedWindowFromEventDispatcher(ServerWindow* window) = 0; 38 virtual void SetFocusedWindowFromEventDispatcher(ServerWindow* window) = 0;
38 virtual ServerWindow* GetFocusedWindowForEventDispatcher() = 0; 39 virtual ServerWindow* GetFocusedWindowForEventDispatcher(
40 const int64_t display_id) = 0;
39 41
40 // Called when capture should be set on the native display. |window| is the 42 // Called when capture should be set on the native display. |window| is the
41 // window capture is being set on. 43 // window capture is being set on.
42 virtual void SetNativeCapture(ServerWindow* window) = 0; 44 virtual void SetNativeCapture(ServerWindow* window) = 0;
43 45
44 // Called when the native display is having capture released. There is no 46 // Called when the native display is having capture released. There is no
45 // longer a ServerWindow holding capture. 47 // longer a ServerWindow holding capture.
46 virtual void ReleaseNativeCapture() = 0; 48 virtual void ReleaseNativeCapture() = 0;
47 49
48 // Called when EventDispatcher has a new value for the cursor and our 50 // Called when EventDispatcher has a new value for the cursor and our
49 // delegate should perform the native updates. 51 // delegate should perform the native updates.
50 virtual void UpdateNativeCursorFromDispatcher() = 0; 52 virtual void UpdateNativeCursorFromDispatcher() = 0;
51 53
52 // Called when |window| has lost capture. The native display may still be 54 // Called when |window| has lost capture. The native display may still be
53 // holding capture. The delegate should not change native display capture. 55 // holding capture. The delegate should not change native display capture.
54 // ReleaseNativeCapture() is invoked if appropriate. 56 // ReleaseNativeCapture() is invoked if appropriate.
55 virtual void OnCaptureChanged(ServerWindow* new_capture, 57 virtual void OnCaptureChanged(ServerWindow* new_capture,
56 ServerWindow* old_capture) = 0; 58 ServerWindow* old_capture) = 0;
57 59
58 virtual void OnMouseCursorLocationChanged(const gfx::Point& point) = 0; 60 virtual void OnMouseCursorLocationChanged(const gfx::Point& point,
61 const int64_t display_id) = 0;
59 62
60 // Dispatches an event to the specific client. 63 // Dispatches an event to the specific client.
61 virtual void DispatchInputEventToWindow(ServerWindow* target, 64 virtual void DispatchInputEventToWindow(ServerWindow* target,
62 ClientSpecificId client_id, 65 ClientSpecificId client_id,
66 const int64_t display_id,
63 const ui::Event& event, 67 const ui::Event& event,
64 Accelerator* accelerator) = 0; 68 Accelerator* accelerator) = 0;
65 69
66 // Returns the id of the client to send events to. |in_nonclient_area| is 70 // Returns the id of the client to send events to. |in_nonclient_area| is
67 // true if the event occurred in the non-client area of the window. 71 // true if the event occurred in the non-client area of the window.
68 virtual ClientSpecificId GetEventTargetClientId(const ServerWindow* window, 72 virtual ClientSpecificId GetEventTargetClientId(const ServerWindow* window,
69 bool in_nonclient_area) = 0; 73 bool in_nonclient_area) = 0;
70 74
71 // Returns the window to start searching from at the specified location, or 75 // Returns the window to start searching from at the specified location, or
72 // null if there is a no window containing |location|. |location| should be in 76 // null if there is a no window containing |location_in_display|.
73 // screen coordinates and if a window is returned then |location| will be 77 // |location_in_display| should be in display coordinates and in pixels.
sky 2017/05/25 22:10:19 'should be' -> 'are in'
riajiang 2017/05/25 22:59:23 Done.
74 // updated to be relative to the origin of the window. 78 // |location_in_display| and |display_id| will be updated if the window we
sky 2017/05/25 22:10:19 'will be updated' -> 'are updated'
riajiang 2017/05/25 22:59:23 Done.
75 virtual ServerWindow* GetRootWindowContaining(gfx::Point* location) = 0; 79 // found is on a different display than the originated display.
80 // TODO(riajiang): No need to update |location_in_display| and |display_id|
81 // after ozone drm can tell us the right display the cursor is on for
82 // drag-n-drop events. crbug.com/726470
83 virtual ServerWindow* GetRootWindowContaining(gfx::Point* location_in_display,
84 int64_t* display_id) = 0;
76 85
77 // Called when event dispatch could not find a target. OnAccelerator may still 86 // Called when event dispatch could not find a target. OnAccelerator may still
78 // be called. 87 // be called.
79 virtual void OnEventTargetNotFound(const ui::Event& event) = 0; 88 virtual void OnEventTargetNotFound(const ui::Event& event,
89 const int64_t display_id) = 0;
80 90
81 protected: 91 protected:
82 virtual ~EventDispatcherDelegate() {} 92 virtual ~EventDispatcherDelegate() {}
83 }; 93 };
84 94
85 } // namespace ws 95 } // namespace ws
86 } // namespace ui 96 } // namespace ui
87 97
88 #endif // SERVICES_UI_WS_EVENT_DISPATCHER_DELEGATE_H_ 98 #endif // SERVICES_UI_WS_EVENT_DISPATCHER_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698