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

Unified Diff: ash/display/mouse_cursor_event_filter.cc

Issue 575143002: Reland of: Remove deprecated cursor event filter for Ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 3 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
« no previous file with comments | « ash/display/mouse_cursor_event_filter.h ('k') | ash/display/mouse_cursor_event_filter_ozone.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/mouse_cursor_event_filter.cc
diff --git a/ash/display/mouse_cursor_event_filter.cc b/ash/display/mouse_cursor_event_filter.cc
index 14a6913e925a7056ccecb8c4a942c73f8a274326..baa1466bfb281835bd2fd540fe067293d8bf4e7b 100644
--- a/ash/display/mouse_cursor_event_filter.cc
+++ b/ash/display/mouse_cursor_event_filter.cc
@@ -152,7 +152,6 @@ void MouseCursorEventFilter::OnDisplaysInitialized() {
OnDisplayConfigurationChanged();
}
-#if !defined(USE_OZONE)
void MouseCursorEventFilter::OnDisplayConfigurationChanged() {
// Extra check for |num_connected_displays()| is for SystemDisplayApiTest
// that injects MockScreen.
@@ -174,7 +173,6 @@ void MouseCursorEventFilter::OnDisplayConfigurationChanged() {
else
UpdateVerticalEdgeBounds();
}
-#endif
void MouseCursorEventFilter::OnMouseEvent(ui::MouseEvent* event) {
aura::Window* target = static_cast<aura::Window*>(event->target());
@@ -224,7 +222,6 @@ void MouseCursorEventFilter::MoveCursorTo(aura::Window* root,
root->GetHost()->MoveCursorToHostLocation(point_in_host);
}
-#if !defined(USE_OZONE)
bool MouseCursorEventFilter::WarpMouseCursorIfNecessary(ui::MouseEvent* event) {
if (!event->HasNativeEvent())
return false;
@@ -232,8 +229,16 @@ bool MouseCursorEventFilter::WarpMouseCursorIfNecessary(ui::MouseEvent* event) {
gfx::Point point_in_native =
ui::EventSystemLocationFromNative(event->native_event());
- gfx::Point point_in_screen = event->location();
aura::Window* target = static_cast<aura::Window*>(event->target());
+#if defined(USE_OZONE)
+ // TODO(dnicoara): crbug.com/415680 Move cursor warping into Ozone once Ozone
+ // has access to the logical display layout.
+ // Native events in Ozone are in the native window coordinate system. We need
+ // to translate them to get the global position.
+ point_in_native.Offset(target->GetHost()->GetBounds().x(),
+ target->GetHost()->GetBounds().y());
+#endif
+ gfx::Point point_in_screen = event->location();
::wm::ConvertPointToScreen(target, &point_in_screen);
return WarpMouseCursorInNativeCoords(point_in_native, point_in_screen);
@@ -263,7 +268,6 @@ bool MouseCursorEventFilter::WarpMouseCursorInNativeCoords(
return true;
}
-#endif
void MouseCursorEventFilter::UpdateHorizontalEdgeBounds() {
bool from_primary = Shell::GetPrimaryRootWindow() == drag_source_root_;
@@ -374,7 +378,6 @@ void MouseCursorEventFilter::GetSrcAndDstRootWindows(aura::Window** src_root,
*dst_root = root_windows[0] == *src_root ? root_windows[1] : root_windows[0];
}
-#if !defined(USE_OZONE)
bool MouseCursorEventFilter::WarpMouseCursorIfNecessaryForTest(
aura::Window* target_root,
const gfx::Point& point_in_screen) {
@@ -383,6 +386,5 @@ bool MouseCursorEventFilter::WarpMouseCursorIfNecessaryForTest(
target_root->GetHost()->ConvertPointToNativeScreen(&native);
return WarpMouseCursorInNativeCoords(native, point_in_screen);
}
-#endif
} // namespace ash
« no previous file with comments | « ash/display/mouse_cursor_event_filter.h ('k') | ash/display/mouse_cursor_event_filter_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698