summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorgirard@chromium.org <girard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-05 16:43:25 +0000
committergirard@chromium.org <girard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-05 16:43:25 +0000
commit21a0707cca21ae5078671959e77d92ffe98b1245 (patch)
treea251479e88495789134580910e5b1a0d93ccbe8a /content
parent444c1b8d84709aca175ad67c048ea236cda92eba (diff)
downloadchromium_src-21a0707cca21ae5078671959e77d92ffe98b1245.zip
chromium_src-21a0707cca21ae5078671959e77d92ffe98b1245.tar.gz
chromium_src-21a0707cca21ae5078671959e77d92ffe98b1245.tar.bz2
Fix touch scaling for high dpi windows.
Touch events in windows are always expressed in screen coordinates, even if the target app is not dpi-aware. This patch determines the dpi scale used by the OS, and re-scales touch events accordingly. In some cases the touch events are sent to the wrong window. This is detected and corrected. BUG=175542 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=185474 Review URL: https://chromiumcodereview.appspot.com/12317157 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186187 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/renderer_host/render_widget_host_view_win.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc
index 6500a8b..048f3e4 100644
--- a/content/browser/renderer_host/render_widget_host_view_win.cc
+++ b/content/browser/renderer_host/render_widget_host_view_win.cc
@@ -2072,8 +2072,9 @@ WebKit::WebTouchPoint* WebTouchState::AddTouchPoint(
bool WebTouchState::UpdateTouchPoint(
WebKit::WebTouchPoint* touch_point,
TOUCHINPUT* touch_input) {
- CPoint coordinates(TOUCH_COORD_TO_PIXEL(touch_input->x),
- TOUCH_COORD_TO_PIXEL(touch_input->y));
+ CPoint coordinates(
+ TOUCH_COORD_TO_PIXEL(touch_input->x) / ui::win::GetDPIScaleFromRegistry(),
+ TOUCH_COORD_TO_PIXEL(touch_input->y) / ui::win::GetDPIScaleFromRegistry());
int radius_x = 1;
int radius_y = 1;
if (touch_input->dwMask & TOUCHINPUTMASKF_CONTACTAREA) {
@@ -2140,8 +2141,8 @@ LRESULT RenderWidgetHostViewWin::OnTouchEvent(UINT message, WPARAM wparam,
if (total == 1 && (points[0].dwFlags & TOUCHEVENTF_DOWN)) {
pointer_down_context_ = true;
last_touch_location_ = gfx::Point(
- TOUCH_COORD_TO_PIXEL(points[0].x),
- TOUCH_COORD_TO_PIXEL(points[0].y));
+ TOUCH_COORD_TO_PIXEL(points[0].x) / ui::win::GetDPIScaleFromRegistry(),
+ TOUCH_COORD_TO_PIXEL(points[0].y) / ui::win::GetDPIScaleFromRegistry());
}
bool should_forward = render_widget_host_->ShouldForwardTouchEvent() &&