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

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

Issue 251743004: aura: Remove WindowTreeHost::QueryMouseLocation(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 7 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
« no previous file with comments | « ui/aura/window_tree_host_win.h ('k') | ui/aura/window_tree_host_x11.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/window_tree_host_win.h" 5 #include "ui/aura/window_tree_host_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 } 120 }
121 121
122 void WindowTreeHostWin::ReleaseCapture() { 122 void WindowTreeHostWin::ReleaseCapture() {
123 if (has_capture_) { 123 if (has_capture_) {
124 has_capture_ = false; 124 has_capture_ = false;
125 ::ReleaseCapture(); 125 ::ReleaseCapture();
126 } 126 }
127 } 127 }
128 128
129 bool WindowTreeHostWin::QueryMouseLocation(gfx::Point* location_return) {
130 client::CursorClient* cursor_client = client::GetCursorClient(window());
131 if (cursor_client && !cursor_client->IsMouseEventsEnabled()) {
132 *location_return = gfx::Point(0, 0);
133 return false;
134 }
135
136 POINT pt;
137 GetCursorPos(&pt);
138 ScreenToClient(hwnd(), &pt);
139 const gfx::Size size = GetBounds().size();
140 *location_return =
141 gfx::Point(max(0, min(size.width(), static_cast<int>(pt.x))),
142 max(0, min(size.height(), static_cast<int>(pt.y))));
143 return (pt.x >= 0 && static_cast<int>(pt.x) < size.width() &&
144 pt.y >= 0 && static_cast<int>(pt.y) < size.height());
145 }
146
147 void WindowTreeHostWin::SetCursorNative(gfx::NativeCursor native_cursor) { 129 void WindowTreeHostWin::SetCursorNative(gfx::NativeCursor native_cursor) {
148 // Custom web cursors are handled directly. 130 // Custom web cursors are handled directly.
149 if (native_cursor == ui::kCursorCustom) 131 if (native_cursor == ui::kCursorCustom)
150 return; 132 return;
151 133
152 ui::CursorLoaderWin cursor_loader; 134 ui::CursorLoaderWin cursor_loader;
153 cursor_loader.SetPlatformCursor(&native_cursor); 135 cursor_loader.SetPlatformCursor(&native_cursor);
154 ::SetCursor(native_cursor.platform()); 136 ::SetCursor(native_cursor.platform());
155 } 137 }
156 138
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 namespace test { 229 namespace test {
248 230
249 // static 231 // static
250 void SetUsePopupAsRootWindowForTest(bool use) { 232 void SetUsePopupAsRootWindowForTest(bool use) {
251 use_popup_as_root_window_for_test = use; 233 use_popup_as_root_window_for_test = use;
252 } 234 }
253 235
254 } // namespace test 236 } // namespace test
255 237
256 } // namespace aura 238 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window_tree_host_win.h ('k') | ui/aura/window_tree_host_x11.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698