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

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
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 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 fwi.dwFlags = FLASHW_STOP; 781 fwi.dwFlags = FLASHW_STOP;
782 } 782 }
783 FlashWindowEx(&fwi); 783 FlashWindowEx(&fwi);
784 } 784 }
785 785
786 void HWNDMessageHandler::ClearNativeFocus() { 786 void HWNDMessageHandler::ClearNativeFocus() {
787 ::SetFocus(hwnd()); 787 ::SetFocus(hwnd());
788 } 788 }
789 789
790 void HWNDMessageHandler::SetCapture() { 790 void HWNDMessageHandler::SetCapture() {
791 DCHECK(!HasCapture());
sky 2014/02/12 14:36:31 What did the call stack look like when you hit thi
792 ::SetCapture(hwnd()); 791 ::SetCapture(hwnd());
793 } 792 }
794 793
795 void HWNDMessageHandler::ReleaseCapture() { 794 void HWNDMessageHandler::ReleaseCapture() {
796 if (HasCapture()) 795 if (HasCapture())
797 ::ReleaseCapture(); 796 ::ReleaseCapture();
798 } 797 }
799 798
800 bool HWNDMessageHandler::HasCapture() const { 799 bool HWNDMessageHandler::HasCapture() const {
801 return ::GetCapture() == hwnd(); 800 return ::GetCapture() == hwnd();
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 return handled; 1288 return handled;
1290 } 1289 }
1291 1290
1292 void HWNDMessageHandler::OnCancelMode() { 1291 void HWNDMessageHandler::OnCancelMode() {
1293 delegate_->HandleCancelMode(); 1292 delegate_->HandleCancelMode();
1294 // Need default handling, otherwise capture and other things aren't canceled. 1293 // Need default handling, otherwise capture and other things aren't canceled.
1295 SetMsgHandled(FALSE); 1294 SetMsgHandled(FALSE);
1296 } 1295 }
1297 1296
1298 void HWNDMessageHandler::OnCaptureChanged(HWND window) { 1297 void HWNDMessageHandler::OnCaptureChanged(HWND window) {
1299 delegate_->HandleCaptureLost(); 1298 if (!HasCapture())
1299 delegate_->HandleCaptureLost();
1300 } 1300 }
1301 1301
1302 void HWNDMessageHandler::OnClose() { 1302 void HWNDMessageHandler::OnClose() {
1303 delegate_->HandleClose(); 1303 delegate_->HandleClose();
1304 } 1304 }
1305 1305
1306 void HWNDMessageHandler::OnCommand(UINT notification_code, 1306 void HWNDMessageHandler::OnCommand(UINT notification_code,
1307 int command, 1307 int command,
1308 HWND window) { 1308 HWND window) {
1309 // If the notification code is > 1 it means it is control specific and we 1309 // If the notification code is > 1 it means it is control specific and we
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1618 } 1618 }
1619 } 1619 }
1620 } else if (message == WM_NCRBUTTONDOWN && 1620 } else if (message == WM_NCRBUTTONDOWN &&
1621 (w_param == HTCAPTION || w_param == HTSYSMENU)) { 1621 (w_param == HTCAPTION || w_param == HTSYSMENU)) {
1622 is_right_mouse_pressed_on_caption_ = true; 1622 is_right_mouse_pressed_on_caption_ = true;
1623 // We SetCapture() to ensure we only show the menu when the button 1623 // We SetCapture() to ensure we only show the menu when the button
1624 // down and up are both on the caption. Note: this causes the button up to 1624 // down and up are both on the caption. Note: this causes the button up to
1625 // be WM_RBUTTONUP instead of WM_NCRBUTTONUP. 1625 // be WM_RBUTTONUP instead of WM_NCRBUTTONUP.
1626 SetCapture(); 1626 SetCapture();
1627 } 1627 }
1628
1629 MSG msg = { hwnd(), message, w_param, l_param, GetMessageTime(), 1628 MSG msg = { hwnd(), message, w_param, l_param, GetMessageTime(),
1630 { CR_GET_X_LPARAM(l_param), CR_GET_Y_LPARAM(l_param) } }; 1629 { CR_GET_X_LPARAM(l_param), CR_GET_Y_LPARAM(l_param) } };
1631 ui::MouseEvent event(msg); 1630 ui::MouseEvent event(msg);
1632 if (!touch_ids_.empty() || ui::IsMouseEventFromTouch(message)) 1631 if (!touch_ids_.empty() || ui::IsMouseEventFromTouch(message))
1633 event.set_flags(event.flags() | ui::EF_FROM_TOUCH); 1632 event.set_flags(event.flags() | ui::EF_FROM_TOUCH);
1634 1633
1635 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) 1634 if (!(event.flags() & ui::EF_IS_NON_CLIENT))
1636 delegate_->HandleTooltipMouseMove(message, w_param, l_param); 1635 delegate_->HandleTooltipMouseMove(message, w_param, l_param);
1637 1636
1638 if (event.type() == ui::ET_MOUSE_MOVED && !HasCapture()) { 1637 if (event.type() == ui::ET_MOUSE_MOVED && !HasCapture()) {
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
2386 SetMsgHandled(FALSE); 2385 SetMsgHandled(FALSE);
2387 } 2386 }
2388 2387
2389 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) { 2388 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) {
2390 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); 2389 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr());
2391 for (size_t i = 0; i < touch_events.size() && ref; ++i) 2390 for (size_t i = 0; i < touch_events.size() && ref; ++i)
2392 delegate_->HandleTouchEvent(touch_events[i]); 2391 delegate_->HandleTouchEvent(touch_events[i]);
2393 } 2392 }
2394 2393
2395 } // namespace views 2394 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698