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

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

Issue 1949603002: Revert of mus: Enable system modal windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « components/mus/ws/BUILD.gn ('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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "cc/surfaces/surface_id.h" 14 #include "cc/surfaces/surface_id.h"
15 #include "components/mus/public/interfaces/event_matcher.mojom.h" 15 #include "components/mus/public/interfaces/event_matcher.mojom.h"
16 #include "components/mus/ws/modal_window_controller.h"
17 #include "components/mus/ws/server_window_observer.h" 16 #include "components/mus/ws/server_window_observer.h"
18 #include "ui/gfx/geometry/rect_f.h" 17 #include "ui/gfx/geometry/rect_f.h"
19 18
20 namespace ui { 19 namespace ui {
21 class Event; 20 class Event;
22 class KeyEvent; 21 class KeyEvent;
23 class LocatedEvent; 22 class LocatedEvent;
24 } 23 }
25 24
26 namespace mus { 25 namespace mus {
(...skipping 27 matching lines...) Expand all
54 } 53 }
55 54
56 // |capture_window_| will receive all input. See window_tree.mojom for 55 // |capture_window_| will receive all input. See window_tree.mojom for
57 // details. 56 // details.
58 ServerWindow* capture_window() { return capture_window_; } 57 ServerWindow* capture_window() { return capture_window_; }
59 const ServerWindow* capture_window() const { return capture_window_; } 58 const ServerWindow* capture_window() const { return capture_window_; }
60 // Setting capture can fail if the window is blocked by a modal window 59 // Setting capture can fail if the window is blocked by a modal window
61 // (indicated by returning |false|). 60 // (indicated by returning |false|).
62 bool SetCaptureWindow(ServerWindow* capture_window, bool in_nonclient_area); 61 bool SetCaptureWindow(ServerWindow* capture_window, bool in_nonclient_area);
63 62
64 // Adds a system modal window. The window remains modal to system until it is
65 // destroyed. There can exist multiple system modal windows, in which case the
66 // one that is visible and added most recently or shown most recently would be
67 // the active one.
68 void AddSystemModalWindow(ServerWindow* window);
69
70 // Checks if |modal_window| is a visible modal window that blocks current
71 // capture window and if that's the case, releases the capture.
72 void ReleaseCaptureBlockedByModalWindow(const ServerWindow* modal_window);
73
74 // Checks if the current capture window is blocked by any visible modal window
75 // and if that's the case, releases the capture.
76 void ReleaseCaptureBlockedByAnyModalWindow();
77
78 // Retrieves the ServerWindow of the last mouse move. 63 // Retrieves the ServerWindow of the last mouse move.
79 ServerWindow* mouse_cursor_source_window() const { 64 ServerWindow* mouse_cursor_source_window() const {
80 return mouse_cursor_source_window_; 65 return mouse_cursor_source_window_;
81 } 66 }
82 67
83 // Possibly updates the cursor. If we aren't in an implicit capture, we take 68 // Possibly updates the cursor. If we aren't in an implicit capture, we take
84 // the last known location of the mouse pointer, and look for the 69 // the last known location of the mouse pointer, and look for the
85 // ServerWindow* under it. 70 // ServerWindow* under it.
86 void UpdateCursorProviderByLastKnownLocation(); 71 void UpdateCursorProviderByLastKnownLocation();
87 72
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 141
157 // If |target->window| is valid, then passes the event to the delegate. 142 // If |target->window| is valid, then passes the event to the delegate.
158 void DispatchToPointerTarget(const PointerTarget& target, 143 void DispatchToPointerTarget(const PointerTarget& target,
159 const ui::LocatedEvent& event); 144 const ui::LocatedEvent& event);
160 145
161 // Stops sending pointer events to |window|. This does not remove the entry 146 // Stops sending pointer events to |window|. This does not remove the entry
162 // for |window| from |pointer_targets_|, rather it nulls out the window. This 147 // for |window| from |pointer_targets_|, rather it nulls out the window. This
163 // way we continue to eat events until the up/cancel is received. 148 // way we continue to eat events until the up/cancel is received.
164 void CancelPointerEventsToTarget(ServerWindow* window); 149 void CancelPointerEventsToTarget(ServerWindow* window);
165 150
166 // Used to observe a window. Can be called multiple times on a window. To 151 // Returns true if we're currently an observer for |window|. We are an
167 // unobserve a window, UnobserveWindow() should be called the same number of 152 // observer for a window if any pointer events are targeting it.
168 // times. 153 bool IsObservingWindow(ServerWindow* window);
169 void ObserveWindow(ServerWindow* winodw);
170 void UnobserveWindow(ServerWindow* winodw);
171 154
172 // Returns an Accelerator bound to the specified code/flags, and of the 155 // Returns an Accelerator bound to the specified code/flags, and of the
173 // matching |phase|. Otherwise returns null. 156 // matching |phase|. Otherwise returns null.
174 Accelerator* FindAccelerator(const ui::KeyEvent& event, 157 Accelerator* FindAccelerator(const ui::KeyEvent& event,
175 const mojom::AcceleratorPhase phase); 158 const mojom::AcceleratorPhase phase);
176 159
177 // ServerWindowObserver: 160 // ServerWindowObserver:
178 void OnWillChangeWindowHierarchy(ServerWindow* window, 161 void OnWillChangeWindowHierarchy(ServerWindow* window,
179 ServerWindow* new_parent, 162 ServerWindow* new_parent,
180 ServerWindow* old_parent) override; 163 ServerWindow* old_parent) override;
181 void OnWindowVisibilityChanged(ServerWindow* window) override; 164 void OnWindowVisibilityChanged(ServerWindow* window) override;
182 void OnWindowDestroyed(ServerWindow* window) override; 165 void OnWindowDestroyed(ServerWindow* window) override;
183 166
184 EventDispatcherDelegate* delegate_; 167 EventDispatcherDelegate* delegate_;
185 ServerWindow* root_; 168 ServerWindow* root_;
169 ServerWindow* capture_window_;
186 170
187 ServerWindow* capture_window_;
188 bool capture_window_in_nonclient_area_; 171 bool capture_window_in_nonclient_area_;
189
190 ModalWindowController modal_window_controller_;
191
192 bool mouse_button_down_; 172 bool mouse_button_down_;
193 ServerWindow* mouse_cursor_source_window_; 173 ServerWindow* mouse_cursor_source_window_;
194 174
195 // The on screen location of the mouse pointer. This can be outside the 175 // The on screen location of the mouse pointer. This can be outside the
196 // bounds of |mouse_cursor_source_window_|, which can capture the cursor. 176 // bounds of |mouse_cursor_source_window_|, which can capture the cursor.
197 gfx::Point mouse_pointer_last_location_; 177 gfx::Point mouse_pointer_last_location_;
198 178
199 cc::SurfaceId surface_id_; 179 cc::SurfaceId surface_id_;
200 180
201 using Entry = std::pair<uint32_t, std::unique_ptr<Accelerator>>; 181 using Entry = std::pair<uint32_t, std::unique_ptr<Accelerator>>;
202 std::map<uint32_t, std::unique_ptr<Accelerator>> accelerators_; 182 std::map<uint32_t, std::unique_ptr<Accelerator>> accelerators_;
203 183
204 using PointerIdToTargetMap = std::map<int32_t, PointerTarget>; 184 using PointerIdToTargetMap = std::map<int32_t, PointerTarget>;
205 // |pointer_targets_| contains the active pointers. For a mouse based pointer 185 // |pointer_targets_| contains the active pointers. For a mouse based pointer
206 // a PointerTarget is always active (and present in |pointer_targets_|). For 186 // a PointerTarget is always active (and present in |pointer_targets_|). For
207 // touch based pointers the pointer is active while down and removed on 187 // touch based pointers the pointer is active while down and removed on
208 // cancel or up. 188 // cancel or up.
209 PointerIdToTargetMap pointer_targets_; 189 PointerIdToTargetMap pointer_targets_;
210 190
211 // Keeps track of number of observe requests for each observed window.
212 std::map<const ServerWindow*, uint8_t> observed_windows_;
213
214 DISALLOW_COPY_AND_ASSIGN(EventDispatcher); 191 DISALLOW_COPY_AND_ASSIGN(EventDispatcher);
215 }; 192 };
216 193
217 } // namespace ws 194 } // namespace ws
218 } // namespace mus 195 } // namespace mus
219 196
220 #endif // COMPONENTS_MUS_WS_EVENT_DISPATCHER_H_ 197 #endif // COMPONENTS_MUS_WS_EVENT_DISPATCHER_H_
OLDNEW
« no previous file with comments | « components/mus/ws/BUILD.gn ('k') | components/mus/ws/event_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698