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

Side by Side Diff: components/mus/ws/event_dispatcher.h

Issue 1465803003: mus: Let clients set the cursor of their window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do it the other way + explicit checks that it is a mouse pointer. Created 5 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 unified diff | Download patch
« no previous file with comments | « components/mus/ws/display_manager.cc ('k') | components/mus/ws/event_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 COMPONENTS_MUS_WS_EVENT_DISPATCHER_H_ 5 #ifndef COMPONENTS_MUS_WS_EVENT_DISPATCHER_H_
6 #define COMPONENTS_MUS_WS_EVENT_DISPATCHER_H_ 6 #define COMPONENTS_MUS_WS_EVENT_DISPATCHER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 15 matching lines...) Expand all
26 // Handles dispatching events to the right location as well as updating focus. 26 // Handles dispatching events to the right location as well as updating focus.
27 class EventDispatcher : public ServerWindowObserver { 27 class EventDispatcher : public ServerWindowObserver {
28 public: 28 public:
29 explicit EventDispatcher(EventDispatcherDelegate* delegate); 29 explicit EventDispatcher(EventDispatcherDelegate* delegate);
30 ~EventDispatcher() override; 30 ~EventDispatcher() override;
31 31
32 void set_root(ServerWindow* root) { root_ = root; } 32 void set_root(ServerWindow* root) { root_ = root; }
33 33
34 void set_surface_id(cc::SurfaceId surface_id) { surface_id_ = surface_id; } 34 void set_surface_id(cc::SurfaceId surface_id) { surface_id_ = surface_id; }
35 35
36 // Retrieves the ServerWindow of the last mouse move.
37 ServerWindow* mouse_cursor_source_window() const {
38 return mouse_cursor_source_window_;
39 }
40
36 // Adds an accelerator with the given id and event-matcher. If an accelerator 41 // Adds an accelerator with the given id and event-matcher. If an accelerator
37 // already exists with the same id or the same matcher, then the accelerator 42 // already exists with the same id or the same matcher, then the accelerator
38 // is not added. Returns whether adding the accelerator was successful or not. 43 // is not added. Returns whether adding the accelerator was successful or not.
39 bool AddAccelerator(uint32_t id, mojom::EventMatcherPtr event_matcher); 44 bool AddAccelerator(uint32_t id, mojom::EventMatcherPtr event_matcher);
40 void RemoveAccelerator(uint32_t id); 45 void RemoveAccelerator(uint32_t id);
41 46
42 void OnEvent(mojom::EventPtr event); 47 void OnEvent(mojom::EventPtr event);
43 48
44 private: 49 private:
45 // Keeps track of state associated with a pointer down until the 50 // Keeps track of state associated with a pointer down until the
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // ServerWindowObserver: 93 // ServerWindowObserver:
89 void OnWillChangeWindowHierarchy(ServerWindow* window, 94 void OnWillChangeWindowHierarchy(ServerWindow* window,
90 ServerWindow* new_parent, 95 ServerWindow* new_parent,
91 ServerWindow* old_parent) override; 96 ServerWindow* old_parent) override;
92 void OnWindowVisibilityChanged(ServerWindow* window) override; 97 void OnWindowVisibilityChanged(ServerWindow* window) override;
93 void OnWindowDestroyed(ServerWindow* window) override; 98 void OnWindowDestroyed(ServerWindow* window) override;
94 99
95 EventDispatcherDelegate* delegate_; 100 EventDispatcherDelegate* delegate_;
96 ServerWindow* root_; 101 ServerWindow* root_;
97 102
103 bool mouse_button_down_;
104 ServerWindow* mouse_cursor_source_window_;
105
98 cc::SurfaceId surface_id_; 106 cc::SurfaceId surface_id_;
99 107
100 using Entry = std::pair<uint32_t, EventMatcher>; 108 using Entry = std::pair<uint32_t, EventMatcher>;
101 std::map<uint32_t, EventMatcher> accelerators_; 109 std::map<uint32_t, EventMatcher> accelerators_;
102 110
103 using PointerIdToTargetMap = std::map<int32_t, PointerTarget>; 111 using PointerIdToTargetMap = std::map<int32_t, PointerTarget>;
104 PointerIdToTargetMap pointer_targets_; 112 PointerIdToTargetMap pointer_targets_;
105 113
106 DISALLOW_COPY_AND_ASSIGN(EventDispatcher); 114 DISALLOW_COPY_AND_ASSIGN(EventDispatcher);
107 }; 115 };
108 116
109 } // namespace ws 117 } // namespace ws
110 } // namespace mus 118 } // namespace mus
111 119
112 #endif // COMPONENTS_MUS_WS_EVENT_DISPATCHER_H_ 120 #endif // COMPONENTS_MUS_WS_EVENT_DISPATCHER_H_
OLDNEW
« no previous file with comments | « components/mus/ws/display_manager.cc ('k') | components/mus/ws/event_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698