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 80008cf758a96e9faacbf9a81201934f23ea43b9..fd739cb6e535509feff28d19f76b14942bfbb36f 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 |
@@ -1432,7 +1432,7 @@ void DesktopWindowTreeHostX11::DispatchMouseEvent(ui::MouseEvent* event) { |
} else { |
// Another DesktopWindowTreeHostX11 has installed itself as |
// capture. Translate the event's location and dispatch to the other. |
- event->ConvertLocationToTarget(window(), g_current_capture->window()); |
+ UpdateEventLocationForDifferentHost(event, g_current_capture); |
g_current_capture->SendEventToProcessor(event); |
} |
} |
@@ -1440,13 +1440,29 @@ void DesktopWindowTreeHostX11::DispatchMouseEvent(ui::MouseEvent* event) { |
void DesktopWindowTreeHostX11::DispatchTouchEvent(ui::TouchEvent* event) { |
if (g_current_capture && g_current_capture != this && |
event->type() == ui::ET_TOUCH_PRESSED) { |
- event->ConvertLocationToTarget(window(), g_current_capture->window()); |
+ UpdateEventLocationForDifferentHost(event, g_current_capture); |
g_current_capture->SendEventToProcessor(event); |
} else { |
SendEventToProcessor(event); |
} |
} |
+void DesktopWindowTreeHostX11::UpdateEventLocationForDifferentHost( |
pkotwicz
2015/02/13 20:15:35
Nit: I think that ConvertEventToDifferentHost() is
sadrul
2015/02/13 20:27:36
Done.
|
+ ui::LocatedEvent* located_event, |
+ DesktopWindowTreeHostX11* host) { |
+ DCHECK_NE(this, host); |
+ const gfx::Display display_src = |
+ gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(window()); |
+ const gfx::Display display_dest = |
+ gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(host->window()); |
+ DCHECK_EQ(display_src.device_scale_factor(), |
+ display_dest.device_scale_factor()); |
+ gfx::Vector2d offset = GetLocationOnNativeScreen() - |
+ g_current_capture->GetLocationOnNativeScreen(); |
pkotwicz
2015/02/13 20:15:35
g_current_capture -> host
sadrul
2015/02/13 20:27:36
whoops. Done.
|
+ gfx::Point location_in_pixel = located_event->location() + offset; |
pkotwicz
2015/02/13 20:15:35
Nit: This variable name is confusing. Is "pixel" t
sadrul
2015/02/13 20:27:36
'pixel' here means 'physical pixels' (for device-i
sadrul
2015/02/13 20:31:09
Should read: "'pixel' here means 'physical pixels'
|
+ located_event->set_location(location_in_pixel); |
+} |
+ |
void DesktopWindowTreeHostX11::ResetWindowRegion() { |
// If a custom window shape was supplied then apply it. |
if (custom_window_shape_) { |