| OLD | NEW |
| 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 27 matching lines...) Expand all Loading... |
| 38 #include "ui/views/views_delegate.h" | 38 #include "ui/views/views_delegate.h" |
| 39 #include "ui/views/widget/monitor_win.h" | 39 #include "ui/views/widget/monitor_win.h" |
| 40 #include "ui/views/widget/widget_hwnd_utils.h" | 40 #include "ui/views/widget/widget_hwnd_utils.h" |
| 41 #include "ui/views/win/fullscreen_handler.h" | 41 #include "ui/views/win/fullscreen_handler.h" |
| 42 #include "ui/views/win/hwnd_message_handler_delegate.h" | 42 #include "ui/views/win/hwnd_message_handler_delegate.h" |
| 43 #include "ui/views/win/scoped_fullscreen_visibility.h" | 43 #include "ui/views/win/scoped_fullscreen_visibility.h" |
| 44 | 44 |
| 45 namespace views { | 45 namespace views { |
| 46 namespace { | 46 namespace { |
| 47 | 47 |
| 48 // A version of the OBJID_CLIENT constant that works in 64-bit mode too. | |
| 49 static const LPARAM kObjIdClient = static_cast<ULONG>(OBJID_CLIENT); | |
| 50 | |
| 51 // MoveLoopMouseWatcher is used to determine if the user canceled or completed a | 48 // MoveLoopMouseWatcher is used to determine if the user canceled or completed a |
| 52 // move. win32 doesn't appear to offer a way to determine the result of a move, | 49 // move. win32 doesn't appear to offer a way to determine the result of a move, |
| 53 // so we install hooks to determine if we got a mouse up and assume the move | 50 // so we install hooks to determine if we got a mouse up and assume the move |
| 54 // completed. | 51 // completed. |
| 55 class MoveLoopMouseWatcher { | 52 class MoveLoopMouseWatcher { |
| 56 public: | 53 public: |
| 57 MoveLoopMouseWatcher(HWNDMessageHandler* host, bool hide_on_escape); | 54 MoveLoopMouseWatcher(HWNDMessageHandler* host, bool hide_on_escape); |
| 58 ~MoveLoopMouseWatcher(); | 55 ~MoveLoopMouseWatcher(); |
| 59 | 56 |
| 60 // Returns true if the mouse is up, or if we couldn't install the hook. | 57 // Returns true if the mouse is up, or if we couldn't install the hook. |
| (...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 minmax_info->ptMaxTrackSize.y = max_window_size.height(); | 1409 minmax_info->ptMaxTrackSize.y = max_window_size.height(); |
| 1413 } | 1410 } |
| 1414 SetMsgHandled(FALSE); | 1411 SetMsgHandled(FALSE); |
| 1415 } | 1412 } |
| 1416 | 1413 |
| 1417 LRESULT HWNDMessageHandler::OnGetObject(UINT message, | 1414 LRESULT HWNDMessageHandler::OnGetObject(UINT message, |
| 1418 WPARAM w_param, | 1415 WPARAM w_param, |
| 1419 LPARAM l_param) { | 1416 LPARAM l_param) { |
| 1420 LRESULT reference_result = static_cast<LRESULT>(0L); | 1417 LRESULT reference_result = static_cast<LRESULT>(0L); |
| 1421 | 1418 |
| 1419 // Only the lower 32 bits of l_param are valid when checking the object id |
| 1420 // because it sometimes gets sign-extended incorrectly (but not always). |
| 1421 DWORD obj_id = static_cast<DWORD>(static_cast<DWORD_PTR>(l_param)); |
| 1422 |
| 1422 // Accessibility readers will send an OBJID_CLIENT message | 1423 // Accessibility readers will send an OBJID_CLIENT message |
| 1423 if (kObjIdClient == l_param) { | 1424 if (OBJID_CLIENT == obj_id) { |
| 1424 // Retrieve MSAA dispatch object for the root view. | 1425 // Retrieve MSAA dispatch object for the root view. |
| 1425 base::win::ScopedComPtr<IAccessible> root( | 1426 base::win::ScopedComPtr<IAccessible> root( |
| 1426 delegate_->GetNativeViewAccessible()); | 1427 delegate_->GetNativeViewAccessible()); |
| 1427 | 1428 |
| 1428 // Create a reference that MSAA will marshall to the client. | 1429 // Create a reference that MSAA will marshall to the client. |
| 1429 reference_result = LresultFromObject(IID_IAccessible, w_param, | 1430 reference_result = LresultFromObject(IID_IAccessible, w_param, |
| 1430 static_cast<IAccessible*>(root.Detach())); | 1431 static_cast<IAccessible*>(root.Detach())); |
| 1431 } | 1432 } |
| 1432 | 1433 |
| 1433 return reference_result; | 1434 return reference_result; |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2421 POINT cursor_pos = {0}; | 2422 POINT cursor_pos = {0}; |
| 2422 ::GetCursorPos(&cursor_pos); | 2423 ::GetCursorPos(&cursor_pos); |
| 2423 if (memcmp(&cursor_pos, &mouse_location, sizeof(POINT))) | 2424 if (memcmp(&cursor_pos, &mouse_location, sizeof(POINT))) |
| 2424 return false; | 2425 return false; |
| 2425 return true; | 2426 return true; |
| 2426 } | 2427 } |
| 2427 return false; | 2428 return false; |
| 2428 } | 2429 } |
| 2429 | 2430 |
| 2430 } // namespace views | 2431 } // namespace views |
| OLD | NEW |