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

Unified Diff: services/ui/ws/window_manager_state.cc

Issue 2696873002: Change OnWindowInputEvent to use display_id to find the host and update event root_location in WS. (Closed)
Patch Set: TODO Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: services/ui/ws/window_manager_state.cc
diff --git a/services/ui/ws/window_manager_state.cc b/services/ui/ws/window_manager_state.cc
index c25923222eb392af2d5fa36003a1c3c7f28e0bad..dc6efcd0a2e32ed3bad34985ae305b4d62515155 100644
--- a/services/ui/ws/window_manager_state.cc
+++ b/services/ui/ws/window_manager_state.cc
@@ -18,6 +18,7 @@
#include "services/ui/ws/server_window.h"
#include "services/ui/ws/user_display_manager.h"
#include "services/ui/ws/user_id_tracker.h"
+#include "services/ui/ws/window_coordinate_conversions.h"
#include "services/ui/ws/window_manager_display_root.h"
#include "services/ui/ws/window_server.h"
#include "services/ui/ws/window_tree.h"
@@ -581,12 +582,29 @@ void WindowManagerState::DispatchInputEventToWindow(ServerWindow* target,
const ui::Event& event,
Accelerator* accelerator) {
DCHECK(IsActive());
+
+ std::unique_ptr<ui::Event> clone = ui::Event::Clone(event);
+ // Convert the root_location of this |event| to be from the coordinate system
+ // of the root window of the |window_tree_| to the coordinate system of the
+ // root_window of the window tree associated with this |client_id|.
+ if (client_id != window_tree_->id() && event.IsLocatedEvent()) {
+ WindowTree* target_tree = window_server()->GetTreeWithId(client_id);
+ CHECK_LE(1u, window_tree_->roots().size());
+ CHECK_LE(1u, target_tree->roots().size());
sadrul 2017/03/14 16:08:32 DCHECK_GE
riajiang 2017/03/14 19:03:26 Done.
+ const ServerWindow* window_tree_root = *window_tree_->roots().begin();
+ const ServerWindow* target_window_tree_root = *target_tree->roots().begin();
sadrul 2017/03/14 16:08:32 I don't think these will always give you the right
riajiang 2017/03/14 19:03:26 Done.
+ gfx::Point new_root_location =
+ ConvertPointBetweenWindows(window_tree_root, target_window_tree_root,
+ event.AsLocatedEvent()->root_location());
+ clone->AsLocatedEvent()->set_root_location(new_root_location);
+ }
+
// TODO(sky): this needs to see if another wms has capture and if so forward
// to it.
if (in_flight_event_details_) {
std::unique_ptr<ProcessedEventTarget> processed_event_target(
new ProcessedEventTarget(target, client_id, accelerator));
- QueueEvent(event, std::move(processed_event_target),
+ QueueEvent(*clone, std::move(processed_event_target),
event_processing_display_id_);
return;
}
@@ -594,7 +612,7 @@ void WindowManagerState::DispatchInputEventToWindow(ServerWindow* target,
base::WeakPtr<Accelerator> weak_accelerator;
if (accelerator)
weak_accelerator = accelerator->GetWeakPtr();
- DispatchInputEventToWindowImpl(target, client_id, event, weak_accelerator);
+ DispatchInputEventToWindowImpl(target, client_id, *clone, weak_accelerator);
}
ClientSpecificId WindowManagerState::GetEventTargetClientId(

Powered by Google App Engine
This is Rietveld 408576698