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

Side by Side Diff: ui/views/win/hwnd_message_handler.cc

Issue 114873002: Allow synthesized WM_MOUSEMOVE and WM_MOUSELEAVE messages for touch based input through. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years 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 | « no previous file | 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/views/win/hwnd_message_handler.h" 5 #include "ui/views/win/hwnd_message_handler.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 if (GetWindowLong(hwnd(), GWL_EXSTYLE) & WS_EX_NOACTIVATE) 1505 if (GetWindowLong(hwnd(), GWL_EXSTYLE) & WS_EX_NOACTIVATE)
1506 return MA_NOACTIVATE; 1506 return MA_NOACTIVATE;
1507 SetMsgHandled(FALSE); 1507 SetMsgHandled(FALSE);
1508 return MA_ACTIVATE; 1508 return MA_ACTIVATE;
1509 } 1509 }
1510 1510
1511 LRESULT HWNDMessageHandler::OnMouseRange(UINT message, 1511 LRESULT HWNDMessageHandler::OnMouseRange(UINT message,
1512 WPARAM w_param, 1512 WPARAM w_param,
1513 LPARAM l_param) { 1513 LPARAM l_param) {
1514 #if defined(USE_AURA) 1514 #if defined(USE_AURA)
1515 if (!touch_ids_.empty()) 1515 if (!touch_ids_.empty() && message != WM_MOUSEMOVE &&
1516 message != WM_MOUSELEAVE) {
1516 return 0; 1517 return 0;
1518 }
1517 // We handle touch events on Windows Aura. Windows generates synthesized 1519 // We handle touch events on Windows Aura. Windows generates synthesized
1518 // mouse messages in response to touch which we should ignore. However touch 1520 // mouse messages in response to touch which we should ignore. However touch
1519 // messages are only received for the client area. We need to ignore the 1521 // messages are only received for the client area. We need to ignore the
1520 // synthesized mouse messages for all points in the client area and places 1522 // synthesized mouse messages for all points in the client area and places
1521 // which return HTNOWHERE. 1523 // which return HTNOWHERE.
1522 if (ui::IsMouseEventFromTouch(message)) { 1524 if (message != WM_MOUSEMOVE && message != WM_MOUSELEAVE &&
1525 ui::IsMouseEventFromTouch(message)) {
1523 LPARAM l_param_ht = l_param; 1526 LPARAM l_param_ht = l_param;
1524 // For mouse events (except wheel events), location is in window coordinates 1527 // For mouse events (except wheel events), location is in window coordinates
1525 // and should be converted to screen coordinates for WM_NCHITTEST. 1528 // and should be converted to screen coordinates for WM_NCHITTEST.
1526 if (message != WM_MOUSEWHEEL && message != WM_MOUSEHWHEEL) { 1529 if (message != WM_MOUSEWHEEL && message != WM_MOUSEHWHEEL) {
1527 CPoint screen_point(l_param_ht); 1530 CPoint screen_point(l_param_ht);
1528 MapWindowPoints(hwnd(), HWND_DESKTOP, &screen_point, 1); 1531 MapWindowPoints(hwnd(), HWND_DESKTOP, &screen_point, 1);
1529 l_param_ht = MAKELPARAM(screen_point.x, screen_point.y); 1532 l_param_ht = MAKELPARAM(screen_point.x, screen_point.y);
1530 } 1533 }
1531 LRESULT hittest = SendMessage(hwnd(), WM_NCHITTEST, 0, l_param_ht); 1534 LRESULT hittest = SendMessage(hwnd(), WM_NCHITTEST, 0, l_param_ht);
1532 if (hittest == HTCLIENT || hittest == HTNOWHERE) 1535 if (hittest == HTCLIENT || hittest == HTNOWHERE)
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
2241 SetMsgHandled(FALSE); 2244 SetMsgHandled(FALSE);
2242 } 2245 }
2243 2246
2244 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) { 2247 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) {
2245 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); 2248 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr());
2246 for (size_t i = 0; i < touch_events.size() && ref; ++i) 2249 for (size_t i = 0; i < touch_events.size() && ref; ++i)
2247 delegate_->HandleTouchEvent(touch_events[i]); 2250 delegate_->HandleTouchEvent(touch_events[i]);
2248 } 2251 }
2249 2252
2250 } // namespace views 2253 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698