Index: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
index e3f1179c97597cb63622c8583613ac72b87bebb7..385a51768f7081d7daabce59155a24d8e5c97ba4 100644 |
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
@@ -944,6 +944,7 @@ void DesktopWindowTreeHostX11::InitX11Window( |
if (swa.override_redirect) |
attribute_mask |= CWOverrideRedirect; |
+ x_bounds_ = params.bounds; |
bounds_ = params.bounds; |
xwindow_ = XCreateWindow( |
xdisplay_, x_root_window_, |
@@ -1120,6 +1121,14 @@ void DesktopWindowTreeHostX11::OnCaptureReleased() { |
} |
void DesktopWindowTreeHostX11::DispatchMouseEvent(ui::MouseEvent* event) { |
+ // The event location is relative to |x_bounds_|. However, Aura uses |bounds_| |
+ // for all computations, including converting to screen coordinates. Offset |
+ // the event location so that converting the event location to screen |
+ // coordinates returns the correct value. |
+ gfx::Vector2d event_offset(x_bounds_.origin() - bounds_.origin()); |
+ event->set_location(event->location() + event_offset); |
+ event->set_root_location(event->location() + event_offset); |
+ |
sadrul
2014/03/13 15:41:31
This doesn't look right. Can you update DesktopWin
pkotwicz
2014/03/13 19:47:48
I think I understand what you are asking.
You are
|
if (!g_current_capture || g_current_capture == this) { |
SendEventToProcessor(event); |
} else { |
@@ -1339,6 +1348,7 @@ uint32_t DesktopWindowTreeHostX11::Dispatch(const base::NativeEvent& event) { |
bool size_changed = bounds_.size() != bounds.size(); |
bool origin_changed = bounds_.origin() != bounds.origin(); |
previous_bounds_ = bounds_; |
+ x_bounds_ = bounds; |
bounds_ = bounds; |
if (size_changed) |
OnHostResized(bounds.size()); |