Index: ui/base/win/hwnd_subclass.cc |
diff --git a/ui/base/win/hwnd_subclass.cc b/ui/base/win/hwnd_subclass.cc |
index 94ab44cf7034af1bf261bfa4be874614f3357baa..c8102a2060dcfbdc1cb1e8f3685203014d473531 100644 |
--- a/ui/base/win/hwnd_subclass.cc |
+++ b/ui/base/win/hwnd_subclass.cc |
@@ -9,6 +9,7 @@ |
#include "base/logging.h" |
#include "base/memory/scoped_vector.h" |
#include "base/memory/singleton.h" |
+#include "ui/base/win/dpi.h" |
#include "ui/base/win/hwnd_util.h" |
namespace { |
@@ -119,6 +120,25 @@ LRESULT HWNDSubclass::OnWndProc(HWND hwnd, |
UINT message, |
WPARAM w_param, |
LPARAM l_param) { |
+ |
+ // Touch messages are always passed in screen coordinates. If the OS is |
+ // scaled, but the app is not DPI aware, then then WM_TOUCH might be |
+ // intended for a different window. |
+ if (message == WM_TOUCH) { |
+ TOUCHINPUT point; |
+ |
+ if (GetTouchInputInfo((HTOUCHINPUT)l_param, 1, |
+ &point, sizeof(TOUCHINPUT))) { |
Ryan Sleevi
2013/03/05 18:32:56
style: indentation
BUG: GetTouchInputInfo is only
|
+ POINT touch_location = { |
+ TOUCH_COORD_TO_PIXEL(point.x) / ui::win::GetDPIScaleFromRegistry(), |
+ TOUCH_COORD_TO_PIXEL(point.y) / ui::win::GetDPIScaleFromRegistry()}; |
+ HWND actual_target = WindowFromPoint(touch_location); |
+ if (actual_target != hwnd) { |
+ return SendMessage(actual_target, message, w_param, l_param); |
+ } |
+ } |
+ } |
+ |
for (std::vector<HWNDMessageFilter*>::iterator it = filters_.begin(); |
it != filters_.end(); ++it) { |
LRESULT l_result = 0; |