Commit 288525d3 authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

WindowService: Removes EventProcessorDelegate::IsWindowInDisplayRoot

And instead changes GetRootWindowForEventDispatch() to return null if
not in a valid hierarchy for event dispatch.

BUG=none
TEST=none

Change-Id: I9e8d23d3607fb600d2cf0c80ff1086688a4b6c13
Reviewed-on: https://chromium-review.googlesource.com/956849Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542324}
parent f0451434
......@@ -845,10 +845,8 @@ void EventProcessor::OnDrawnStateChanged(ServerWindow* ancestor,
void EventProcessor::OnRootDidChange(ServerWindow* ancestor,
ServerWindow* window) {
if (delegate_->IsWindowInDisplayRoot(window))
return;
WindowNoLongerValidTarget(window);
if (!delegate_->GetRootWindowForEventDispatch(window))
WindowNoLongerValidTarget(window);
}
void EventProcessor::OnDragCursorUpdated() {
......
......@@ -51,7 +51,7 @@ class EventProcessorTestApi;
}
// Processes events sent to the Window Service from the native platform. Updates
// internale state associated with events (such as mouse, keyboard state,
// internal state associated with events (such as mouse, keyboard state,
// capture, focus...). EventProcessorDelegate handles dispatching to the
// appropriate client.
class EventProcessor : public ServerWindowDrawnTrackerObserver,
......
......@@ -94,14 +94,11 @@ class EventProcessorDelegate {
virtual ServerWindow* GetRootWindowForDisplay(int64_t display_id) = 0;
// Returns the root of |window| that is used for event dispatch. The returned
// value is used for coordinate conversion.
// value is used for coordinate conversion. Returns null if |window| is not
// in a hierarchy that events should be dispatched to (typically not
// associated with a display).
virtual ServerWindow* GetRootWindowForEventDispatch(ServerWindow* window) = 0;
// Returns true if |window| is in a display root. This is called when the
// hierarchy changes and |window| needs to be tested if it's still in a valid
// display root.
virtual bool IsWindowInDisplayRoot(const ServerWindow* window) = 0;
// Called when event dispatch could not find a target. OnAccelerator may still
// be called.
virtual void OnEventTargetNotFound(const ui::Event& event,
......
......@@ -204,10 +204,7 @@ class TestEventProcessorDelegate : public EventProcessorDelegate {
return nullptr;
}
ServerWindow* GetRootWindowForEventDispatch(ServerWindow* window) override {
return window->GetRootForDrawn();
}
bool IsWindowInDisplayRoot(const ServerWindow* window) override {
return is_window_in_display_root_;
return is_window_in_display_root_ ? window->GetRootForDrawn() : nullptr;
}
Delegate* delegate_;
......
......@@ -900,20 +900,9 @@ ServerWindow* WindowManagerState::GetRootWindowForEventDispatch(
if (client_visible_root->Contains(window))
return client_visible_root;
}
NOTREACHED();
return nullptr;
}
bool WindowManagerState::IsWindowInDisplayRoot(const ServerWindow* window) {
for (auto& display_root_ptr : window_manager_display_roots_) {
ServerWindow* client_visible_root =
display_root_ptr->GetClientVisibleRoot();
if (client_visible_root->Contains(window))
return true;
}
return false;
}
void WindowManagerState::OnEventTargetNotFound(const ui::Event& event,
int64_t display_id) {
window_server()->SendToPointerWatchers(event, nullptr, /* window */
......
......@@ -273,7 +273,6 @@ class WindowManagerState : public EventProcessorDelegate,
bool in_nonclient_area) override;
ServerWindow* GetRootWindowForDisplay(int64_t display_id) override;
ServerWindow* GetRootWindowForEventDispatch(ServerWindow* window) override;
bool IsWindowInDisplayRoot(const ServerWindow* window) override;
void OnEventTargetNotFound(const Event& event, int64_t display_id) override;
ServerWindow* GetFallbackTargetForEventBlockedByModal(
ServerWindow* window) override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment