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

Side by Side Diff: ui/base/win/hwnd_subclass.cc

Issue 12379040: Revert 185474 -- speculative. browser_tests stopped starting up on all (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/win/dpi.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/base/win/hwnd_subclass.h" 5 #include "ui/base/win/hwnd_subclass.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
11 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
12 #include "ui/base/win/dpi.h"
13 #include "ui/base/win/hwnd_util.h" 12 #include "ui/base/win/hwnd_util.h"
14 13
15 namespace { 14 namespace {
16 const char kHWNDSubclassKey[] = "__UI_BASE_WIN_HWND_SUBCLASS_PROC__"; 15 const char kHWNDSubclassKey[] = "__UI_BASE_WIN_HWND_SUBCLASS_PROC__";
17 16
18 LRESULT CALLBACK WndProc(HWND hwnd, 17 LRESULT CALLBACK WndProc(HWND hwnd,
19 UINT message, 18 UINT message,
20 WPARAM w_param, 19 WPARAM w_param,
21 LPARAM l_param) { 20 LPARAM l_param) {
22 ui::HWNDSubclass* wrapped_wnd_proc = 21 ui::HWNDSubclass* wrapped_wnd_proc =
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 ui::SetWindowProc(target_, &WndProc); 112 ui::SetWindowProc(target_, &WndProc);
114 } 113 }
115 114
116 HWNDSubclass::~HWNDSubclass() { 115 HWNDSubclass::~HWNDSubclass() {
117 } 116 }
118 117
119 LRESULT HWNDSubclass::OnWndProc(HWND hwnd, 118 LRESULT HWNDSubclass::OnWndProc(HWND hwnd,
120 UINT message, 119 UINT message,
121 WPARAM w_param, 120 WPARAM w_param,
122 LPARAM l_param) { 121 LPARAM l_param) {
123
124 // Touch messages are always passed in screen coordinates. If the OS is
125 // scaled, but the app is not DPI aware, then then WM_TOUCH might be
126 // intended for a different window.
127 if (message == WM_TOUCH) {
128 TOUCHINPUT point;
129
130 if (GetTouchInputInfo((HTOUCHINPUT)l_param, 1,
131 &point, sizeof(TOUCHINPUT))) {
132 POINT touch_location = {
133 TOUCH_COORD_TO_PIXEL(point.x) / ui::win::GetDPIScaleFromRegistry(),
134 TOUCH_COORD_TO_PIXEL(point.y) / ui::win::GetDPIScaleFromRegistry()};
135 HWND actual_target = WindowFromPoint(touch_location);
136 if (actual_target != hwnd) {
137 return SendMessage(actual_target, message, w_param, l_param);
138 }
139 }
140 }
141
142 for (std::vector<HWNDMessageFilter*>::iterator it = filters_.begin(); 122 for (std::vector<HWNDMessageFilter*>::iterator it = filters_.begin();
143 it != filters_.end(); ++it) { 123 it != filters_.end(); ++it) {
144 LRESULT l_result = 0; 124 LRESULT l_result = 0;
145 if ((*it)->FilterMessage(hwnd, message, w_param, l_param, &l_result)) 125 if ((*it)->FilterMessage(hwnd, message, w_param, l_param, &l_result))
146 return l_result; 126 return l_result;
147 } 127 }
148 128
149 // In most cases, |original_wnd_proc_| will take care of calling 129 // In most cases, |original_wnd_proc_| will take care of calling
150 // DefWindowProc. 130 // DefWindowProc.
151 return CallWindowProc(original_wnd_proc_, hwnd, message, w_param, l_param); 131 return CallWindowProc(original_wnd_proc_, hwnd, message, w_param, l_param);
152 } 132 }
153 133
154 HWNDMessageFilter::~HWNDMessageFilter() { 134 HWNDMessageFilter::~HWNDMessageFilter() {
155 HWNDSubclass::RemoveFilterFromAllTargets(this); 135 HWNDSubclass::RemoveFilterFromAllTargets(this);
156 } 136 }
157 137
158 } // namespace ui 138 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/win/dpi.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698