| Index: components/mus/ws/event_dispatcher.h
|
| diff --git a/components/mus/ws/event_dispatcher.h b/components/mus/ws/event_dispatcher.h
|
| index bc0e94832c224288af9565a74571462775fc9e03..aa547b8f8ec1069b26b91780cf58dbe06fd12453 100644
|
| --- a/components/mus/ws/event_dispatcher.h
|
| +++ b/components/mus/ws/event_dispatcher.h
|
| @@ -7,6 +7,7 @@
|
|
|
| #include <stdint.h>
|
|
|
| +#include <list>
|
| #include <map>
|
| #include <memory>
|
|
|
| @@ -60,6 +61,20 @@ class EventDispatcher : public ServerWindowObserver {
|
| // (indicated by returning |false|).
|
| bool SetCaptureWindow(ServerWindow* capture_window, bool in_nonclient_area);
|
|
|
| + // Adds a system modal window. The window remains modal to system until it is
|
| + // destroyed. There can exist multiple system modal windows, in which case the
|
| + // one that is visible and added most recently or shown most recently would be
|
| + // the active one.
|
| + void AddSystemModalWindow(ServerWindow* window);
|
| +
|
| + // Checks if |modal_window| is a visible modal window that blocks current
|
| + // capture window and if that's the case, releases the capture.
|
| + void ReleaseCaptureBlockedByModalWindow(const ServerWindow* modal_window);
|
| +
|
| + // Checks if the current capture window is blocked by any visible modal window
|
| + // and if that's the case, releases the capture.
|
| + void ReleaseCaptureBlockedByAnyModalWindow();
|
| +
|
| // Retrieves the ServerWindow of the last mouse move.
|
| ServerWindow* mouse_cursor_source_window() const {
|
| return mouse_cursor_source_window_;
|
| @@ -81,6 +96,7 @@ class EventDispatcher : public ServerWindowObserver {
|
| void ProcessEvent(const ui::Event& event);
|
|
|
| private:
|
| + using ServerWindowList = std::list<ServerWindow*>;
|
| friend class test::EventDispatcherTestApi;
|
|
|
| // Keeps track of state associated with an active pointer.
|
| @@ -148,15 +164,24 @@ class EventDispatcher : public ServerWindowObserver {
|
| // way we continue to eat events until the up/cancel is received.
|
| void CancelPointerEventsToTarget(ServerWindow* window);
|
|
|
| - // Returns true if we're currently an observer for |window|. We are an
|
| - // observer for a window if any pointer events are targeting it.
|
| - bool IsObservingWindow(ServerWindow* window);
|
| + // Used to observe a window. Can be called multiple times on a window. To
|
| + // unobserve a window, UnobserveWindow() should be called the same number of
|
| + // times.
|
| + void ObserveWindow(ServerWindow* winodw);
|
| + void UnobserveWindow(ServerWindow* winodw);
|
|
|
| // Returns an Accelerator bound to the specified code/flags, and of the
|
| // matching |phase|. Otherwise returns null.
|
| Accelerator* FindAccelerator(const ui::KeyEvent& event,
|
| const mojom::AcceleratorPhase phase);
|
|
|
| + // Returns the system modal window that is visible and added/shown most
|
| + // recently, if any.
|
| + ServerWindow* GetActiveSystemModalWindow() const;
|
| +
|
| + // Removes system modal window at the given iterator and unobserves it.
|
| + void RemoveSystemModalWindow(ServerWindowList::iterator it);
|
| +
|
| // ServerWindowObserver:
|
| void OnWillChangeWindowHierarchy(ServerWindow* window,
|
| ServerWindow* new_parent,
|
| @@ -166,9 +191,13 @@ class EventDispatcher : public ServerWindowObserver {
|
|
|
| EventDispatcherDelegate* delegate_;
|
| ServerWindow* root_;
|
| - ServerWindow* capture_window_;
|
|
|
| + ServerWindow* capture_window_;
|
| bool capture_window_in_nonclient_area_;
|
| +
|
| + // List of system modal windows in order they are added/shown.
|
| + ServerWindowList system_modal_windows_;
|
| +
|
| bool mouse_button_down_;
|
| ServerWindow* mouse_cursor_source_window_;
|
|
|
| @@ -188,6 +217,9 @@ class EventDispatcher : public ServerWindowObserver {
|
| // cancel or up.
|
| PointerIdToTargetMap pointer_targets_;
|
|
|
| + // Keeps track of number of observe requests for each observed window.
|
| + std::map<const ServerWindow*, uint8_t> observed_windows_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(EventDispatcher);
|
| };
|
|
|
|
|