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

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: 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
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 2a280548e8c78e7cb7705120c517fba58b39030f..4d24f99ed8e542175e30f90b940d5b1bacd22077 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);
+ OnHostMouseEventInternal(&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);
+ OnHostMouseEventInternal(&mouseev);
break;
}
case FocusOut:
@@ -573,7 +573,7 @@ bool RootWindowHostLinux::Dispatch(const base::NativeEvent& event) {
}
ui::MouseEvent mouseev(xev);
- delegate_->OnHostMouseEvent(&mouseev);
+ OnHostMouseEventInternal(&mouseev);
break;
}
}
@@ -671,12 +671,12 @@ void RootWindowHostLinux::DispatchXI2Event(const base::NativeEvent& event) {
}
}
ui::MouseEvent mouseev(xev);
- delegate_->OnHostMouseEvent(&mouseev);
+ OnHostMouseEventInternal(&mouseev);
break;
}
case ui::ET_MOUSEWHEEL: {
ui::MouseWheelEvent mouseev(xev);
- delegate_->OnHostMouseEvent(&mouseev);
+ OnHostMouseEventInternal(&mouseev);
break;
}
case ui::ET_SCROLL_FLING_START:
@@ -979,6 +979,21 @@ void RootWindowHostLinux::SetCursorInternal(gfx::NativeCursor cursor) {
XDefineCursor(xdisplay_, xwindow_, cursor.platform());
}
+void RootWindowHostLinux::OnHostMouseEventInternal(ui::MouseEvent* event) {
+ client::ScreenPositionClient* screen_position_client =
+ GetScreenPositionClient(GetRootWindow());
oshima 2012/09/18 23:10:15 nit. assigning RootWindow to root would make it cl
mazda 2012/09/18 23:44:57 Done.
+ if (screen_position_client && !bounds_.Contains(event->location())) {
+ gfx::Point location(event->location());
+ screen_position_client->ConvertNativePointToScreen(GetRootWindow(),
+ &location);
+ screen_position_client->ConvertPointFromScreen(GetRootWindow(),
+ &location);
+ event->set_location(location);
+ event->set_root_location(location);
+ }
+ delegate_->OnHostMouseEvent(event);
+}
+
// static
RootWindowHost* RootWindowHost::Create(RootWindowHostDelegate* delegate,
const gfx::Rect& bounds) {

Powered by Google App Engine
This is Rietveld 408576698