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/aura/root_window_host_win.h" | 5 #include "ui/aura/root_window_host_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "ui/aura/client/capture_client.h" | 12 #include "ui/aura/client/capture_client.h" |
| 13 #include "ui/aura/client/cursor_client.h" |
13 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
14 #include "ui/base/cursor/cursor_loader_win.h" | 15 #include "ui/base/cursor/cursor_loader_win.h" |
15 #include "ui/base/events/event.h" | 16 #include "ui/base/events/event.h" |
16 #include "ui/base/view_prop.h" | 17 #include "ui/base/view_prop.h" |
17 #include "ui/gfx/display.h" | 18 #include "ui/gfx/display.h" |
18 #include "ui/gfx/screen.h" | 19 #include "ui/gfx/screen.h" |
19 | 20 |
20 using std::max; | 21 using std::max; |
21 using std::min; | 22 using std::min; |
22 | 23 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 171 } |
171 | 172 |
172 void RootWindowHostWin::ReleaseCapture() { | 173 void RootWindowHostWin::ReleaseCapture() { |
173 if (has_capture_) { | 174 if (has_capture_) { |
174 has_capture_ = false; | 175 has_capture_ = false; |
175 ::ReleaseCapture(); | 176 ::ReleaseCapture(); |
176 } | 177 } |
177 } | 178 } |
178 | 179 |
179 bool RootWindowHostWin::QueryMouseLocation(gfx::Point* location_return) { | 180 bool RootWindowHostWin::QueryMouseLocation(gfx::Point* location_return) { |
| 181 client::CursorClient* cursor_client = |
| 182 client::GetCursorClient(GetRootWindow()); |
| 183 if (cursor_client && !cursor_client->IsMouseEventsEnabled()) { |
| 184 *location_return = gfx::Point(0, 0); |
| 185 return false; |
| 186 } |
| 187 |
180 POINT pt; | 188 POINT pt; |
181 GetCursorPos(&pt); | 189 GetCursorPos(&pt); |
182 ScreenToClient(hwnd(), &pt); | 190 ScreenToClient(hwnd(), &pt); |
183 const gfx::Size size = GetBounds().size(); | 191 const gfx::Size size = GetBounds().size(); |
184 *location_return = | 192 *location_return = |
185 gfx::Point(max(0, min(size.width(), static_cast<int>(pt.x))), | 193 gfx::Point(max(0, min(size.width(), static_cast<int>(pt.x))), |
186 max(0, min(size.height(), static_cast<int>(pt.y)))); | 194 max(0, min(size.height(), static_cast<int>(pt.y)))); |
187 return (pt.x >= 0 && static_cast<int>(pt.x) < size.width() && | 195 return (pt.x >= 0 && static_cast<int>(pt.x) < size.width() && |
188 pt.y >= 0 && static_cast<int>(pt.y) < size.height()); | 196 pt.y >= 0 && static_cast<int>(pt.y) < size.height()); |
189 } | 197 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 namespace test { | 311 namespace test { |
304 | 312 |
305 // static | 313 // static |
306 void SetUsePopupAsRootWindowForTest(bool use) { | 314 void SetUsePopupAsRootWindowForTest(bool use) { |
307 use_popup_as_root_window_for_test = use; | 315 use_popup_as_root_window_for_test = use; |
308 } | 316 } |
309 | 317 |
310 } // namespace test | 318 } // namespace test |
311 | 319 |
312 } // namespace aura | 320 } // namespace aura |
OLD | NEW |