| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/widget/widget_win.h" | 5 #include "views/widget/widget_win.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 int keystate) { | 559 int keystate) { |
| 560 SetMsgHandled(FALSE); | 560 SetMsgHandled(FALSE); |
| 561 return 0; | 561 return 0; |
| 562 } | 562 } |
| 563 | 563 |
| 564 void WidgetWin::OnCancelMode() { | 564 void WidgetWin::OnCancelMode() { |
| 565 } | 565 } |
| 566 | 566 |
| 567 void WidgetWin::OnCaptureChanged(HWND hwnd) { | 567 void WidgetWin::OnCaptureChanged(HWND hwnd) { |
| 568 if (is_mouse_down_) | 568 if (is_mouse_down_) |
| 569 GetRootView()->ProcessMouseDragCanceled(); | 569 GetRootView()->OnMouseCaptureLost(); |
| 570 is_mouse_down_ = false; | 570 is_mouse_down_ = false; |
| 571 } | 571 } |
| 572 | 572 |
| 573 void WidgetWin::OnClose() { | 573 void WidgetWin::OnClose() { |
| 574 Close(); | 574 Close(); |
| 575 } | 575 } |
| 576 | 576 |
| 577 void WidgetWin::OnCommand(UINT notification_code, int command_id, HWND window) { | 577 void WidgetWin::OnCommand(UINT notification_code, int command_id, HWND window) { |
| 578 SetMsgHandled(FALSE); | 578 SetMsgHandled(FALSE); |
| 579 } | 579 } |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 is_mouse_down_ = false; | 1016 is_mouse_down_ = false; |
| 1017 | 1017 |
| 1018 // Release the capture first, that way we don't get confused if | 1018 // Release the capture first, that way we don't get confused if |
| 1019 // OnMouseReleased blocks. | 1019 // OnMouseReleased blocks. |
| 1020 if (HasNativeCapture() && ReleaseCaptureOnMouseReleased()) | 1020 if (HasNativeCapture() && ReleaseCaptureOnMouseReleased()) |
| 1021 ReleaseNativeCapture(); | 1021 ReleaseNativeCapture(); |
| 1022 | 1022 |
| 1023 MSG msg; | 1023 MSG msg; |
| 1024 MakeMSG(&msg, message, w_param, l_param, 0, GET_X_LPARAM(l_param), | 1024 MakeMSG(&msg, message, w_param, l_param, 0, GET_X_LPARAM(l_param), |
| 1025 GET_Y_LPARAM(l_param)); | 1025 GET_Y_LPARAM(l_param)); |
| 1026 GetRootView()->OnMouseReleased(MouseEvent(msg), false); | 1026 GetRootView()->OnMouseReleased(MouseEvent(msg)); |
| 1027 return true; | 1027 return true; |
| 1028 } | 1028 } |
| 1029 | 1029 |
| 1030 bool WidgetWin::ProcessMouseMoved(UINT message, | 1030 bool WidgetWin::ProcessMouseMoved(UINT message, |
| 1031 WPARAM w_param, | 1031 WPARAM w_param, |
| 1032 LPARAM l_param) { | 1032 LPARAM l_param) { |
| 1033 // Windows only fires WM_MOUSELEAVE events if the application begins | 1033 // Windows only fires WM_MOUSELEAVE events if the application begins |
| 1034 // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events. | 1034 // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events. |
| 1035 // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE. | 1035 // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE. |
| 1036 if (!HasNativeCapture()) | 1036 if (!HasNativeCapture()) |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 return; | 1262 return; |
| 1263 | 1263 |
| 1264 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view); | 1264 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view); |
| 1265 if (native_widget) | 1265 if (native_widget) |
| 1266 children->insert(native_widget); | 1266 children->insert(native_widget); |
| 1267 EnumChildWindows(native_view, EnumerateChildWindowsForNativeWidgets, | 1267 EnumChildWindows(native_view, EnumerateChildWindowsForNativeWidgets, |
| 1268 reinterpret_cast<LPARAM>(children)); | 1268 reinterpret_cast<LPARAM>(children)); |
| 1269 } | 1269 } |
| 1270 | 1270 |
| 1271 } // namespace views | 1271 } // namespace views |
| OLD | NEW |