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

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

Issue 159713012: Don't track mouse events in HWNDMessageHandler when they are forwarded by the LegacyRenderWidgetHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 10 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/views/event_utils_aura.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/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 <oleacc.h> 8 #include <oleacc.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <wtsapi32.h> 10 #include <wtsapi32.h>
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 } 1621 }
1622 } 1622 }
1623 } else if (message == WM_NCRBUTTONDOWN && 1623 } else if (message == WM_NCRBUTTONDOWN &&
1624 (w_param == HTCAPTION || w_param == HTSYSMENU)) { 1624 (w_param == HTCAPTION || w_param == HTSYSMENU)) {
1625 is_right_mouse_pressed_on_caption_ = true; 1625 is_right_mouse_pressed_on_caption_ = true;
1626 // We SetCapture() to ensure we only show the menu when the button 1626 // We SetCapture() to ensure we only show the menu when the button
1627 // down and up are both on the caption. Note: this causes the button up to 1627 // down and up are both on the caption. Note: this causes the button up to
1628 // be WM_RBUTTONUP instead of WM_NCRBUTTONUP. 1628 // be WM_RBUTTONUP instead of WM_NCRBUTTONUP.
1629 SetCapture(); 1629 SetCapture();
1630 } 1630 }
1631
1632 MSG msg = { hwnd(), message, w_param, l_param, GetMessageTime(), 1631 MSG msg = { hwnd(), message, w_param, l_param, GetMessageTime(),
1633 { CR_GET_X_LPARAM(l_param), CR_GET_Y_LPARAM(l_param) } }; 1632 { CR_GET_X_LPARAM(l_param), CR_GET_Y_LPARAM(l_param) } };
1634 ui::MouseEvent event(msg); 1633 ui::MouseEvent event(msg);
1635 if (!touch_ids_.empty() || ui::IsMouseEventFromTouch(message)) 1634 if (!touch_ids_.empty() || ui::IsMouseEventFromTouch(message))
1636 event.set_flags(event.flags() | ui::EF_FROM_TOUCH); 1635 event.set_flags(event.flags() | ui::EF_FROM_TOUCH);
1637 1636
1638 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) 1637 if (!(event.flags() & ui::EF_IS_NON_CLIENT))
1639 delegate_->HandleTooltipMouseMove(message, w_param, l_param); 1638 delegate_->HandleTooltipMouseMove(message, w_param, l_param);
1640 1639
1641 if (event.type() == ui::ET_MOUSE_MOVED && !HasCapture()) { 1640 if (event.type() == ui::ET_MOUSE_MOVED && !HasCapture() &&
cpu_(ooo_6.6-7.5) 2014/02/13 22:35:18 can you put a short comment here about why we test
ananta 2014/02/13 22:47:35 Done.
ananta 2014/02/13 22:47:35 Done.
1641 HIWORD(w_param) != SPECIAL_MOUSEMOVE_NOT_TO_BE_TRACKED) {
1642 // Windows only fires WM_MOUSELEAVE events if the application begins 1642 // Windows only fires WM_MOUSELEAVE events if the application begins
1643 // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events. 1643 // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events.
1644 // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE. 1644 // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE.
1645 TrackMouseEvents((message == WM_NCMOUSEMOVE) ? 1645 TrackMouseEvents((message == WM_NCMOUSEMOVE) ?
1646 TME_NONCLIENT | TME_LEAVE : TME_LEAVE); 1646 TME_NONCLIENT | TME_LEAVE : TME_LEAVE);
1647 } else if (event.type() == ui::ET_MOUSE_EXITED) { 1647 } else if (event.type() == ui::ET_MOUSE_EXITED) {
1648 // Reset our tracking flags so future mouse movement over this 1648 // Reset our tracking flags so future mouse movement over this
1649 // NativeWidgetWin results in a new tracking session. Fall through for 1649 // NativeWidgetWin results in a new tracking session. Fall through for
1650 // OnMouseEvent. 1650 // OnMouseEvent.
1651 active_mouse_tracking_flags_ = 0; 1651 active_mouse_tracking_flags_ = 0;
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 SetMsgHandled(FALSE); 2389 SetMsgHandled(FALSE);
2390 } 2390 }
2391 2391
2392 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) { 2392 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) {
2393 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); 2393 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr());
2394 for (size_t i = 0; i < touch_events.size() && ref; ++i) 2394 for (size_t i = 0; i < touch_events.size() && ref; ++i)
2395 delegate_->HandleTouchEvent(touch_events[i]); 2395 delegate_->HandleTouchEvent(touch_events[i]);
2396 } 2396 }
2397 2397
2398 } // namespace views 2398 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/event_utils_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698