Commit 026b825b authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

WindowService: renames EventDispatch to EventProcessor

Using 'dispatch' is mildly confusing given the class doesn't really
handle dispatch.

BUG=none
TEST=none

Change-Id: I20f858d924d0a68efb2e449fd0ab3140ef5ffa54
Reviewed-on: https://chromium-review.googlesource.com/956496
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542184}
parent 5211ea3a
......@@ -44,12 +44,12 @@ static_library("lib") {
"drag_cursor_updater.h",
"drag_source.h",
"drag_target_connection.h",
"event_dispatcher.cc",
"event_dispatcher.h",
"event_dispatcher_delegate.h",
"event_location.h",
"event_matcher.cc",
"event_matcher.h",
"event_processor.cc",
"event_processor.h",
"event_processor_delegate.h",
"event_targeter.cc",
"event_targeter.h",
"event_targeter_delegate.h",
......@@ -250,8 +250,8 @@ source_set("tests") {
"cursor_unittest.cc",
"display_unittest.cc",
"drag_controller_unittest.cc",
"event_dispatcher_unittest.cc",
"event_matcher_unittest.cc",
"event_processor_unittest.cc",
"focus_controller_unittest.cc",
"frame_generator_unittest.cc",
"gpu_host_unittest.cc",
......
......@@ -15,7 +15,7 @@
#include "services/ui/ws/display.h"
#include "services/ui/ws/display_binding.h"
#include "services/ui/ws/display_creation_config.h"
#include "services/ui/ws/event_dispatcher.h"
#include "services/ui/ws/event_processor.h"
#include "services/ui/ws/frame_generator.h"
#include "services/ui/ws/server_window.h"
#include "services/ui/ws/user_display_manager.h"
......
......@@ -11,7 +11,6 @@
#include "services/ui/ws/drag_cursor_updater.h"
#include "services/ui/ws/drag_source.h"
#include "services/ui/ws/drag_target_connection.h"
#include "services/ui/ws/event_dispatcher.h"
#include "services/ui/ws/server_window.h"
#include "ui/base/cursor/cursor.h"
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SERVICES_UI_WS_EVENT_DISPATCHER_H_
#define SERVICES_UI_WS_EVENT_DISPATCHER_H_
#ifndef SERVICES_UI_WS_EVENT_PROCESSOR_H_
#define SERVICES_UI_WS_EVENT_PROCESSOR_H_
#include <stdint.h>
......@@ -40,20 +40,23 @@ class Accelerator;
class DragController;
class DragSource;
class DragTargetConnection;
class EventDispatcherDelegate;
class EventProcessorDelegate;
class ServerWindow;
class ServerWindowDrawnTracker;
struct EventLocation;
namespace test {
class EventDispatcherTestApi;
class EventProcessorTestApi;
}
// Handles dispatching events to the right location as well as updating focus.
class EventDispatcher : public ServerWindowDrawnTrackerObserver,
public DragCursorUpdater,
public EventTargeterDelegate {
// Processes events sent to the Window Service from the native platform. Updates
// internale state associated with events (such as mouse, keyboard state,
// capture, focus...). EventProcessorDelegate handles dispatching to the
// appropriate client.
class EventProcessor : public ServerWindowDrawnTrackerObserver,
public DragCursorUpdater,
public EventTargeterDelegate {
public:
enum class AcceleratorMatchPhase {
// Both pre and post should be considered.
......@@ -64,8 +67,8 @@ class EventDispatcher : public ServerWindowDrawnTrackerObserver,
POST_ONLY,
};
explicit EventDispatcher(EventDispatcherDelegate* delegate);
~EventDispatcher() override;
explicit EventProcessor(EventProcessorDelegate* delegate);
~EventProcessor() override;
ModalWindowController* modal_window_controller() {
return &modal_window_controller_;
......@@ -175,7 +178,7 @@ class EventDispatcher : public ServerWindowDrawnTrackerObserver,
const viz::FrameSinkId& frame_sink_id) override;
private:
friend class test::EventDispatcherTestApi;
friend class test::EventProcessorTestApi;
// Keeps track of state associated with an active pointer.
struct PointerTarget {
......@@ -248,7 +251,7 @@ class EventDispatcher : public ServerWindowDrawnTrackerObserver,
const EventLocation& event_location,
const DeepestWindow& target);
// EventDispatcher provides the following logic for events:
// EventProcessor provides the following logic for events:
// . wheel events go to the current target of the associated pointer. If
// there is no target, they go to the deepest window.
// . move (not drag) events go to the deepest window.
......@@ -351,7 +354,7 @@ class EventDispatcher : public ServerWindowDrawnTrackerObserver,
// DragCursorUpdater:
void OnDragCursorUpdated() override;
EventDispatcherDelegate* delegate_;
EventProcessorDelegate* delegate_;
ServerWindow* capture_window_;
ClientSpecificId capture_window_client_id_;
......@@ -401,10 +404,10 @@ class EventDispatcher : public ServerWindowDrawnTrackerObserver,
AcceleratorMatchPhase::ANY;
#endif
DISALLOW_COPY_AND_ASSIGN(EventDispatcher);
DISALLOW_COPY_AND_ASSIGN(EventProcessor);
};
} // namespace ws
} // namespace ui
#endif // SERVICES_UI_WS_EVENT_DISPATCHER_H_
#endif // SERVICES_UI_WS_EVENT_PROCESSOR_H_
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SERVICES_UI_WS_EVENT_DISPATCHER_DELEGATE_H_
#define SERVICES_UI_WS_EVENT_DISPATCHER_DELEGATE_H_
#ifndef SERVICES_UI_WS_EVENT_PROCESSOR_DELEGATE_H_
#define SERVICES_UI_WS_EVENT_PROCESSOR_DELEGATE_H_
#include <stdint.h>
......@@ -26,8 +26,9 @@ namespace ws {
class Accelerator;
class ServerWindow;
// Used by EventDispatcher for mocking in tests.
class EventDispatcherDelegate {
// Used by EventProcessor for dispatching of events, as well as to inform the
// delegate of various state changes.
class EventProcessorDelegate {
public:
enum class AcceleratorPhase {
PRE,
......@@ -39,8 +40,8 @@ class EventDispatcherDelegate {
const ui::Event& event,
AcceleratorPhase phase) = 0;
virtual void SetFocusedWindowFromEventDispatcher(ServerWindow* window) = 0;
virtual ServerWindow* GetFocusedWindowForEventDispatcher(
virtual void SetFocusedWindowFromEventProcessor(ServerWindow* window) = 0;
virtual ServerWindow* GetFocusedWindowForEventProcessor(
int64_t display_id) = 0;
// Called when capture should be set on the native display. |window| is the
......@@ -51,9 +52,9 @@ class EventDispatcherDelegate {
// longer a ServerWindow holding capture.
virtual void ReleaseNativeCapture() = 0;
// Called when EventDispatcher has a new value for the cursor and our
// Called when EventProcessor has a new value for the cursor and our
// delegate should perform the native updates.
virtual void UpdateNativeCursorFromDispatcher() = 0;
virtual void UpdateNativeCursorFromEventProcessor() = 0;
// Called when |window| has lost capture. The native display may still be
// holding capture. The delegate should not change native display capture.
......@@ -125,10 +126,10 @@ class EventDispatcherDelegate {
const viz::FrameSinkId& frame_sink_id) = 0;
protected:
virtual ~EventDispatcherDelegate() {}
virtual ~EventProcessorDelegate() {}
};
} // namespace ws
} // namespace ui
#endif // SERVICES_UI_WS_EVENT_DISPATCHER_DELEGATE_H_
#endif // SERVICES_UI_WS_EVENT_PROCESSOR_DELEGATE_H_
......@@ -170,28 +170,27 @@ void WindowTreeTestApi::StopPointerWatcher() {
tree_->StopPointerWatcher();
}
// EventDispatcherTestApi ----------------------------------------------------
// EventProcessorTestApi ----------------------------------------------------
bool EventDispatcherTestApi::IsWindowPointerTarget(
bool EventProcessorTestApi::IsWindowPointerTarget(
const ServerWindow* window) const {
for (const auto& pair : ed_->pointer_targets_) {
for (const auto& pair : ep_->pointer_targets_) {
if (pair.second.window == window)
return true;
}
return false;
}
int EventDispatcherTestApi::NumberPointerTargetsForWindow(
ServerWindow* window) {
int EventProcessorTestApi::NumberPointerTargetsForWindow(ServerWindow* window) {
int count = 0;
for (const auto& pair : ed_->pointer_targets_)
for (const auto& pair : ep_->pointer_targets_)
if (pair.second.window == window)
count++;
return count;
}
bool EventDispatcherTestApi::IsObservingWindow(ServerWindow* window) {
return ed_->observed_windows_.count(window) > 0;
bool EventProcessorTestApi::IsObservingWindow(ServerWindow* window) {
return ep_->observed_windows_.count(window) > 0;
}
// TestDisplayBinding ---------------------------------------------------------
......
......@@ -24,7 +24,7 @@
#include "services/ui/ws/display.h"
#include "services/ui/ws/display_binding.h"
#include "services/ui/ws/drag_controller.h"
#include "services/ui/ws/event_dispatcher.h"
#include "services/ui/ws/event_processor.h"
#include "services/ui/ws/event_targeter.h"
#include "services/ui/ws/gpu_host.h"
#include "services/ui/ws/platform_display.h"
......@@ -167,26 +167,26 @@ class WindowTreeTestApi {
// -----------------------------------------------------------------------------
class EventDispatcherTestApi {
class EventProcessorTestApi {
public:
explicit EventDispatcherTestApi(EventDispatcher* ed) : ed_(ed) {}
~EventDispatcherTestApi() {}
explicit EventProcessorTestApi(EventProcessor* ep) : ep_(ep) {}
~EventProcessorTestApi() {}
bool AreAnyPointersDown() const { return ed_->AreAnyPointersDown(); }
bool is_mouse_button_down() const { return ed_->mouse_button_down_; }
bool AreAnyPointersDown() const { return ep_->AreAnyPointersDown(); }
bool is_mouse_button_down() const { return ep_->mouse_button_down_; }
bool IsWindowPointerTarget(const ServerWindow* window) const;
int NumberPointerTargetsForWindow(ServerWindow* window);
ModalWindowController* modal_window_controller() const {
return &ed_->modal_window_controller_;
return &ep_->modal_window_controller_;
}
ServerWindow* capture_window() { return ed_->capture_window_; }
EventTargeter* event_targeter() { return ed_->event_targeter_.get(); }
ServerWindow* capture_window() { return ep_->capture_window_; }
EventTargeter* event_targeter() { return ep_->event_targeter_.get(); }
bool IsObservingWindow(ServerWindow* window);
private:
EventDispatcher* ed_;
EventProcessor* ep_;
DISALLOW_COPY_AND_ASSIGN(EventDispatcherTestApi);
DISALLOW_COPY_AND_ASSIGN(EventProcessorTestApi);
};
// -----------------------------------------------------------------------------
......
......@@ -164,12 +164,12 @@ bool WindowManagerState::DebugAccelerator::Matches(
// details.
struct WindowManagerState::EventTask {
enum class Type {
// ProcessEvent() was called while waiting on a client or EventDispatcher
// ProcessEvent() was called while waiting on a client or EventProcessor
// to complete processing. |event| is non-null and |processed_target| is
// null.
kEvent,
// In certain situations EventDispatcher::ProcessEvent() generates more than
// In certain situations EventProcessor::ProcessEvent() generates more than
// one event. When that happens, |kProcessedEvent| is used for all events
// after the first. For example, a move may result in an exit for one
// Window and and an enter for another Window. The event generated for the
......@@ -178,7 +178,7 @@ struct WindowManagerState::EventTask {
kProcessedEvent,
// ScheduleCallbackWhenDoneProcessingEvents() is called while waiting on
// a client or EventDispatcher. |event| and |processed_target| are null.
// a client or EventProcessor. |event| and |processed_target| are null.
kClosure
};
......@@ -204,7 +204,7 @@ struct WindowManagerState::EventTask {
WindowManagerState::WindowManagerState(WindowTree* window_tree)
: window_tree_(window_tree),
event_dispatcher_(this),
event_processor_(this),
cursor_state_(window_tree_->display_manager(), this) {
frame_decoration_values_ = mojom::FrameDecorationValues::New();
frame_decoration_values_->max_title_bar_button_width = 0u;
......@@ -239,7 +239,7 @@ void WindowManagerState::SetFrameDecorationValues(
bool WindowManagerState::SetCapture(ServerWindow* window,
ClientSpecificId client_id) {
if (capture_window() == window &&
client_id == event_dispatcher_.capture_window_client_id()) {
client_id == event_processor_.capture_window_client_id()) {
return true;
}
#if DCHECK_IS_ON()
......@@ -249,11 +249,11 @@ bool WindowManagerState::SetCapture(ServerWindow* window,
DCHECK(display_root && display_root->window_manager_state() == this);
}
#endif
return event_dispatcher_.SetCaptureWindow(window, client_id);
return event_processor_.SetCaptureWindow(window, client_id);
}
void WindowManagerState::ReleaseCaptureBlockedByAnyModalWindow() {
event_dispatcher_.ReleaseCaptureBlockedByAnyModalWindow();
event_processor_.ReleaseCaptureBlockedByAnyModalWindow();
}
void WindowManagerState::SetCursorLocation(const gfx::Point& display_pixels,
......@@ -270,7 +270,7 @@ void WindowManagerState::SetCursorLocation(const gfx::Point& display_pixels,
void WindowManagerState::SetKeyEventsThatDontHideCursor(
std::vector<::ui::mojom::EventMatcherPtr> dont_hide_cursor_list) {
event_dispatcher()->SetKeyEventsThatDontHideCursor(
event_processor()->SetKeyEventsThatDontHideCursor(
std::move(dont_hide_cursor_list));
}
......@@ -297,22 +297,22 @@ void WindowManagerState::SetDragDropSourceWindow(
return;
}
event_dispatcher_.SetDragDropSourceWindow(drag_source, window,
source_connection, drag_pointer,
drag_data, drag_operation);
event_processor_.SetDragDropSourceWindow(drag_source, window,
source_connection, drag_pointer,
drag_data, drag_operation);
}
void WindowManagerState::CancelDragDrop() {
event_dispatcher_.CancelDragDrop();
event_processor_.CancelDragDrop();
}
void WindowManagerState::EndDragDrop() {
event_dispatcher_.EndDragDrop();
UpdateNativeCursorFromDispatcher();
event_processor_.EndDragDrop();
UpdateNativeCursorFromEventProcessor();
}
void WindowManagerState::AddSystemModalWindow(ServerWindow* window) {
event_dispatcher_.AddSystemModalWindow(window);
event_processor_.AddSystemModalWindow(window);
}
void WindowManagerState::DeleteWindowManagerDisplayRoot(
......@@ -336,7 +336,7 @@ void WindowManagerState::DeleteWindowManagerDisplayRoot(
}
void WindowManagerState::OnWillDestroyTree(WindowTree* tree) {
event_dispatcher_.OnWillDestroyDragTargetConnection(tree);
event_processor_.OnWillDestroyDragTargetConnection(tree);
if (!in_flight_event_dispatch_details_ ||
in_flight_event_dispatch_details_->tree != tree)
......@@ -379,7 +379,7 @@ void WindowManagerState::ProcessEvent(ui::Event* event, int64_t display_id) {
bool WindowManagerState::IsProcessingEvent() const {
return in_flight_event_dispatch_details_ ||
event_dispatcher_.IsProcessingEvent();
event_processor_.IsProcessingEvent();
}
void WindowManagerState::ScheduleCallbackWhenDoneProcessingEvents(
......@@ -410,9 +410,9 @@ void WindowManagerState::OnAcceleratorAck(
DCHECK(details->event->IsKeyEvent());
if (!properties.empty())
details->event->AsKeyEvent()->SetProperties(properties);
event_dispatcher_.ProcessEvent(
event_processor_.ProcessEvent(
*details->event, EventLocation(details->display_id),
EventDispatcher::AcceleratorMatchPhase::POST_ONLY);
EventProcessor::AcceleratorMatchPhase::POST_ONLY);
} else {
// We're not going to process the event any further, notify event observers.
// We don't do this first to ensure we don't send an event twice to clients.
......@@ -502,11 +502,11 @@ void WindowManagerState::OnEventAckTimeout(ClientSpecificId client_id) {
void WindowManagerState::ProcessEventImpl(const ui::Event& event,
const EventLocation& event_location) {
DCHECK(!in_flight_event_dispatch_details_ &&
!event_dispatcher_.IsProcessingEvent());
!event_processor_.IsProcessingEvent());
// Debug accelerators are always checked and don't interfere with processing.
ProcessDebugAccelerator(event, event_location.display_id);
event_dispatcher_.ProcessEvent(event, event_location,
EventDispatcher::AcceleratorMatchPhase::ANY);
event_processor_.ProcessEvent(event, event_location,
EventProcessor::AcceleratorMatchPhase::ANY);
}
void WindowManagerState::QueueEvent(
......@@ -534,7 +534,7 @@ void WindowManagerState::DispatchInputEventToWindowImpl(
target = GetWindowManagerRootForDisplayRoot(target);
if (event.IsMousePointerEvent())
UpdateNativeCursorFromDispatcher();
UpdateNativeCursorFromEventProcessor();
WindowTree* tree = window_server()->GetTreeWithId(client_id);
DCHECK(tree);
......@@ -586,7 +586,7 @@ void WindowManagerState::HandleDebugAccelerator(DebugAcceleratorType type,
<< display_root->root()->GetDebugWindowHierarchy();
}
}
ServerWindow* focused_window = GetFocusedWindowForEventDispatcher(display_id);
ServerWindow* focused_window = GetFocusedWindowForEventProcessor(display_id);
LOG(ERROR) << "Focused window: "
<< (focused_window ? focused_window->frame_sink_id().ToString()
: "(null)");
......@@ -697,7 +697,7 @@ void WindowManagerState::AdjustEventLocation(int64_t display_id,
}
////////////////////////////////////////////////////////////////////////////////
// EventDispatcherDelegate:
// EventProcessorDelegate:
void WindowManagerState::OnAccelerator(uint32_t accelerator_id,
int64_t display_id,
......@@ -716,12 +716,12 @@ void WindowManagerState::OnAccelerator(uint32_t accelerator_id,
window_tree_->OnAccelerator(accelerator_id, event, std::move(ack_callback));
}
void WindowManagerState::SetFocusedWindowFromEventDispatcher(
void WindowManagerState::SetFocusedWindowFromEventProcessor(
ServerWindow* new_focused_window) {
window_server()->SetFocusedWindow(new_focused_window);
}
ServerWindow* WindowManagerState::GetFocusedWindowForEventDispatcher(
ServerWindow* WindowManagerState::GetFocusedWindowForEventProcessor(
int64_t display_id) {
ServerWindow* focused_window = window_server()->GetFocusedWindow();
if (focused_window)
......@@ -767,8 +767,8 @@ void WindowManagerState::ReleaseNativeCapture() {
platform_display_with_capture_ = nullptr;
}
void WindowManagerState::UpdateNativeCursorFromDispatcher() {
const ui::CursorData cursor = event_dispatcher_.GetCurrentMouseCursor();
void WindowManagerState::UpdateNativeCursorFromEventProcessor() {
const ui::CursorData cursor = event_processor_.GetCurrentMouseCursor();
cursor_state_.SetCurrentWindowCursor(cursor);
}
......@@ -919,7 +919,7 @@ void WindowManagerState::OnEventTargetNotFound(const ui::Event& event,
window_server()->SendToPointerWatchers(event, nullptr, /* window */
nullptr /* ignore_tree */, display_id);
if (event.IsMousePointerEvent())
UpdateNativeCursorFromDispatcher();
UpdateNativeCursorFromEventProcessor();
}
ServerWindow* WindowManagerState::GetFallbackTargetForEventBlockedByModal(
......
......@@ -18,8 +18,8 @@
#include "services/ui/public/interfaces/display_manager.mojom.h"
#include "services/ui/ws/cursor_state.h"
#include "services/ui/ws/cursor_state_delegate.h"
#include "services/ui/ws/event_dispatcher.h"
#include "services/ui/ws/event_dispatcher_delegate.h"
#include "services/ui/ws/event_processor.h"
#include "services/ui/ws/event_processor_delegate.h"
#include "services/ui/ws/server_window_observer.h"
#include "services/ui/ws/window_server.h"
......@@ -42,7 +42,7 @@ class WindowManagerStateTestApi;
// Manages state specific to a WindowManager that is shared across displays.
// WindowManagerState is owned by the WindowTree the window manager is
// associated with.
class WindowManagerState : public EventDispatcherDelegate,
class WindowManagerState : public EventProcessorDelegate,
public ServerWindowObserver,
public CursorStateDelegate {
public:
......@@ -63,9 +63,9 @@ class WindowManagerState : public EventDispatcherDelegate,
}
bool SetCapture(ServerWindow* window, ClientSpecificId client_id);
ServerWindow* capture_window() { return event_dispatcher_.capture_window(); }
ServerWindow* capture_window() { return event_processor_.capture_window(); }
const ServerWindow* capture_window() const {
return event_dispatcher_.capture_window();
return event_processor_.capture_window();
}
void ReleaseCaptureBlockedByAnyModalWindow();
......@@ -92,9 +92,9 @@ class WindowManagerState : public EventDispatcherDelegate,
// Deletes the WindowManagerDisplayRoot whose root is |display_root|.
void DeleteWindowManagerDisplayRoot(ServerWindow* display_root);
// TODO(sky): EventDispatcher is really an implementation detail and should
// TODO(sky): EventProcessor is really an implementation detail and should
// not be exposed.
EventDispatcher* event_dispatcher() { return &event_dispatcher_; }
EventProcessor* event_processor() { return &event_processor_; }
CursorState& cursor_state() { return cursor_state_; }
......@@ -199,7 +199,7 @@ class WindowManagerState : public EventDispatcherDelegate,
void OnEventAckTimeout(ClientSpecificId client_id);
// Implemenation of processing an event with a match phase of all. This
// handles debug accelerators and forwards to EventDispatcher.
// handles debug accelerators and forwards to EventProcessor.
void ProcessEventImpl(const Event& event,
const EventLocation& event_location);
......@@ -246,16 +246,16 @@ class WindowManagerState : public EventDispatcherDelegate,
void AdjustEventLocation(int64_t display_id, LocatedEvent* event);
// EventDispatcherDelegate:
// EventProcessorDelegate:
void OnAccelerator(uint32_t accelerator_id,
int64_t display_id,
const Event& event,
AcceleratorPhase phase) override;
void SetFocusedWindowFromEventDispatcher(ServerWindow* window) override;
ServerWindow* GetFocusedWindowForEventDispatcher(int64_t display_id) override;
void SetFocusedWindowFromEventProcessor(ServerWindow* window) override;
ServerWindow* GetFocusedWindowForEventProcessor(int64_t display_id) override;
void SetNativeCapture(ServerWindow* window) override;
void ReleaseNativeCapture() override;
void UpdateNativeCursorFromDispatcher() override;
void UpdateNativeCursorFromEventProcessor() override;
void OnCaptureChanged(ServerWindow* new_capture,
ServerWindow* old_capture) override;
void OnMouseCursorLocationChanged(const gfx::PointF& point,
......@@ -308,7 +308,7 @@ class WindowManagerState : public EventDispatcherDelegate,
std::unique_ptr<InFlightEventDispatchDetails>
in_flight_event_dispatch_details_;
EventDispatcher event_dispatcher_;
EventProcessor event_processor_;
// PlatformDisplay that currently has capture.
PlatformDisplay* platform_display_with_capture_ = nullptr;
......
......@@ -281,7 +281,7 @@ TEST_F(WindowManagerStateTest, PreTargetConsumed) {
mojom::EventMatcherPtr matcher = ui::CreateKeyMatcher(
ui::mojom::KeyboardCode::W, ui::mojom::kEventFlagControlDown);
ASSERT_TRUE(window_manager_state()->event_dispatcher()->AddAccelerator(
ASSERT_TRUE(window_manager_state()->event_processor()->AddAccelerator(
accelerator_id, std::move(matcher)));
}
TestChangeTracker* tracker = wm_client()->tracker();
......@@ -351,7 +351,7 @@ TEST_F(WindowManagerStateTest, AckWithProperties) {
mojom::EventMatcherPtr matcher = ui::CreateKeyMatcher(
ui::mojom::KeyboardCode::W, ui::mojom::kEventFlagControlDown);
ASSERT_TRUE(window_manager_state()->event_dispatcher()->AddAccelerator(
ASSERT_TRUE(window_manager_state()->event_processor()->AddAccelerator(
accelerator_id, std::move(matcher)));
}
TestChangeTracker* tracker = wm_client()->tracker();
......@@ -881,11 +881,11 @@ TEST_F(WindowManagerStateTestAsync, CursorResetOverNoTargetAsync) {
// Setup steps already do hit-test for mouse cursor update so this should go
// to the queue in EventTargeter.
EventTargeterTestApi event_targeter_test_api(
EventDispatcherTestApi(window_manager_state()->event_dispatcher())
EventProcessorTestApi(window_manager_state()->event_processor())
.event_targeter());
EXPECT_TRUE(event_targeter_test_api.HasPendingQueries());
// But no events have been generated, so IsProcessingEvent() should be false.
EXPECT_FALSE(window_manager_state()->event_dispatcher()->IsProcessingEvent());
EXPECT_FALSE(window_manager_state()->event_processor()->IsProcessingEvent());
child_window->SetVisible(true);
child_window->SetBounds(gfx::Rect(0, 0, 20, 20));
child_window->parent()->SetCursor(ui::CursorData(ui::CursorType::kCopy));
......@@ -899,7 +899,7 @@ TEST_F(WindowManagerStateTestAsync, CursorResetOverNoTargetAsync) {
EXPECT_TRUE(test_api.is_event_tasks_empty());
window_manager_state()->ProcessEvent(&move, 0);
EXPECT_FALSE(test_api.tree_awaiting_input_ack());
EXPECT_TRUE(window_manager_state()->event_dispatcher()->IsProcessingEvent());
EXPECT_TRUE(window_manager_state()->event_processor()->IsProcessingEvent());
EXPECT_TRUE(test_api.is_event_tasks_empty());
task_runner_->RunUntilIdle();
EXPECT_TRUE(test_api.is_event_tasks_empty());
......
......@@ -769,9 +769,9 @@ void WindowServer::UpdateNativeCursorFromMouseLocation(
if (!display_root)
return;
EventDispatcher* event_dispatcher =
display_root->window_manager_state()->event_dispatcher();
event_dispatcher->UpdateCursorProviderByLastKnownLocation();
EventProcessor* event_processor =
display_root->window_manager_state()->event_processor();
event_processor->UpdateCursorProviderByLastKnownLocation();
}
void WindowServer::UpdateNativeCursorIfOver(ServerWindow* window) {
......@@ -780,12 +780,12 @@ void WindowServer::UpdateNativeCursorIfOver(ServerWindow* window) {
if (!display_root)
return;
EventDispatcher* event_dispatcher =
display_root->window_manager_state()->event_dispatcher();
if (window != event_dispatcher->GetWindowForMouseCursor())
EventProcessor* event_processor =
display_root->window_manager_state()->event_processor();
if (window != event_processor->GetWindowForMouseCursor())
return;
event_dispatcher->UpdateNonClientAreaForCurrentWindow();
event_processor->UpdateNonClientAreaForCurrentWindow();
}
void WindowServer::HandleTemporaryReferenceForNewSurface(
......
......@@ -21,9 +21,9 @@
#include "services/ui/ws/default_access_policy.h"
#include "services/ui/ws/display.h"
#include "services/ui/ws/display_manager.h"
#include "services/ui/ws/event_dispatcher.h"
#include "services/ui/ws/event_location.h"
#include "services/ui/ws/event_matcher.h"
#include "services/ui/ws/event_processor.h"
#include "services/ui/ws/focus_controller.h"
#include "services/ui/ws/frame_generator.h"
#include "services/ui/ws/modal_window_controller.h"
......@@ -437,7 +437,7 @@ bool WindowTree::ProcessSetBlockingContainers(
MakeClientWindowId(transport_container->min_container_id));
all_containers.push_back(blocking_containers);
}
window_manager_state_->event_dispatcher()
window_manager_state_->event_processor()
->modal_window_controller()
->SetBlockingContainers(all_containers);
return true;
......@@ -2487,7 +2487,7 @@ void WindowTree::AddAccelerators(
bool success = true;
for (auto iter = accelerators.begin(); iter != accelerators.end(); ++iter) {
if (!window_manager_state_->event_dispatcher()->AddAccelerator(
if (!window_manager_state_->event_processor()->AddAccelerator(
iter->get()->id, std::move(iter->get()->event_matcher)))
success = false;
}
......@@ -2495,7 +2495,7 @@ void WindowTree::AddAccelerators(
}
void WindowTree::RemoveAccelerator(uint32_t id) {
window_manager_state_->event_dispatcher()->RemoveAccelerator(id);
window_manager_state_->event_processor()->RemoveAccelerator(id);
}
void WindowTree::AddActivationParent(Id transport_window_id) {
......
......@@ -306,12 +306,12 @@ TEST_F(WindowTreeTest, EventDispatcherMouseCursorSourceWindowResetOnRemove) {
WindowManagerState* wms =
display()->window_manager_display_root()->window_manager_state();
EXPECT_EQ(window, wms->event_dispatcher()->mouse_cursor_source_window());
EXPECT_EQ(window, wms->event_processor()->mouse_cursor_source_window());
window->parent()->Remove(window);
// The remove should reset the mouse_cursor_source_window(). The important
// thing is it changes to something other than |window|.
EXPECT_NE(window, wms->event_dispatcher()->mouse_cursor_source_window());
EXPECT_NE(window, wms->event_processor()->mouse_cursor_source_window());
}
// Verifies SetChildModalParent() works correctly.
......@@ -780,8 +780,7 @@ TEST_F(WindowTreeTest, ModalTypeSystemToModalTypeNone) {
WindowManagerState* wms =
display()->window_manager_display_root()->window_manager_state();
ModalWindowControllerTestApi modal_window_controller_test_api(
EventDispatcherTestApi(wms->event_dispatcher())
.modal_window_controller());
EventProcessorTestApi(wms->event_processor()).modal_window_controller());
EXPECT_EQ(test_window,
modal_window_controller_test_api.GetActiveSystemModalWindow());
EXPECT_TRUE(wm_tree()->SetModalType(test_window_id, MODAL_TYPE_NONE));
......@@ -800,8 +799,7 @@ TEST_F(WindowTreeTest, ModalTypeSystemUnparentedThenParented) {
WindowManagerState* wms =
display()->window_manager_display_root()->window_manager_state();
ModalWindowControllerTestApi modal_window_controller_test_api(
EventDispatcherTestApi(wms->event_dispatcher())
.modal_window_controller());
EventProcessorTestApi(wms->event_processor()).modal_window_controller());
EXPECT_EQ(nullptr,
modal_window_controller_test_api.GetActiveSystemModalWindow());
EXPECT_TRUE(wm_tree()->AddWindow(wm_root_id, test_window_id));
......
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