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

Unified Diff: ui/aura/root_window_host_linux.cc

Issue 10948020: Convert native mouse locations to the locations in screen coordinate in RootWindowHostLinux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 | « ui/aura/root_window_host_linux.h ('k') | ui/base/events/event.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/root_window_host_linux.cc
diff --git a/ui/aura/root_window_host_linux.cc b/ui/aura/root_window_host_linux.cc
index 0b4fa9522c90ea684e05da2d7f22bad5ca7ace7c..eeedf8b8de52598245445479cdd92c4f3cb92147 100644
--- a/ui/aura/root_window_host_linux.cc
+++ b/ui/aura/root_window_host_linux.cc
@@ -437,7 +437,7 @@ bool RootWindowHostLinux::Dispatch(const base::NativeEvent& event) {
switch (xev->type) {
case EnterNotify: {
ui::MouseEvent mouseenter_event(xev);
- delegate_->OnHostMouseEvent(&mouseenter_event);
+ TranslateAndDispatchMouseEvent(&mouseenter_event);
break;
}
case Expose:
@@ -469,7 +469,7 @@ bool RootWindowHostLinux::Dispatch(const base::NativeEvent& event) {
} // fallthrough
case ButtonRelease: {
ui::MouseEvent mouseev(xev);
- delegate_->OnHostMouseEvent(&mouseev);
+ TranslateAndDispatchMouseEvent(&mouseev);
break;
}
case FocusOut:
@@ -573,7 +573,7 @@ bool RootWindowHostLinux::Dispatch(const base::NativeEvent& event) {
}
ui::MouseEvent mouseev(xev);
- delegate_->OnHostMouseEvent(&mouseev);
+ TranslateAndDispatchMouseEvent(&mouseev);
break;
}
}
@@ -671,12 +671,12 @@ void RootWindowHostLinux::DispatchXI2Event(const base::NativeEvent& event) {
}
}
ui::MouseEvent mouseev(xev);
- delegate_->OnHostMouseEvent(&mouseev);
+ TranslateAndDispatchMouseEvent(&mouseev);
break;
}
case ui::ET_MOUSEWHEEL: {
ui::MouseWheelEvent mouseev(xev);
- delegate_->OnHostMouseEvent(&mouseev);
+ TranslateAndDispatchMouseEvent(&mouseev);
break;
}
case ui::ET_SCROLL_FLING_START:
@@ -989,6 +989,21 @@ void RootWindowHostLinux::SetCursorInternal(gfx::NativeCursor cursor) {
XDefineCursor(xdisplay_, xwindow_, cursor.platform());
}
+void RootWindowHostLinux::TranslateAndDispatchMouseEvent(
+ ui::MouseEvent* event) {
+ RootWindow* root = GetRootWindow();
+ client::ScreenPositionClient* screen_position_client =
+ GetScreenPositionClient(root);
+ if (screen_position_client && !bounds_.Contains(event->location())) {
+ gfx::Point location(event->location());
+ screen_position_client->ConvertNativePointToScreen(root, &location);
+ screen_position_client->ConvertPointFromScreen(root, &location);
+ event->set_location(location);
+ event->set_root_location(location);
+ }
+ delegate_->OnHostMouseEvent(event);
+}
+
// static
RootWindowHost* RootWindowHost::Create(RootWindowHostDelegate* delegate,
const gfx::Rect& bounds) {
« no previous file with comments | « ui/aura/root_window_host_linux.h ('k') | ui/base/events/event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698