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

Side by Side Diff: ui/aura/root_window_host_win.cc

Issue 11412315: Make the cursor have separate mode for disabled mouse events and invisible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 8 years 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/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
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->IsCursorEnabled()) {
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 namespace test { 307 namespace test {
300 308
301 // static 309 // static
302 void SetUsePopupAsRootWindowForTest(bool use) { 310 void SetUsePopupAsRootWindowForTest(bool use) {
303 use_popup_as_root_window_for_test = use; 311 use_popup_as_root_window_for_test = use;
304 } 312 }
305 313
306 } // namespace test 314 } // namespace test
307 315
308 } // namespace aura 316 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698