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

Side by Side Diff: services/ui/ws/cursor_location_manager.cc

Issue 2778943005: Keep root_location to be in pixels and display coordinates in WS. (Closed)
Patch Set: const Created 3 years, 6 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
« no previous file with comments | « services/ui/ws/cursor_location_manager.h ('k') | services/ui/ws/display_manager.cc » ('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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "services/ui/ws/cursor_location_manager.h" 5 #include "services/ui/ws/cursor_location_manager.h"
6 6
7 #include "ui/gfx/geometry/point.h" 7 #include "ui/gfx/geometry/point.h"
8 8
9 namespace ui { 9 namespace ui {
10 namespace ws { 10 namespace ws {
11 11
12 CursorLocationManager::CursorLocationManager() {} 12 CursorLocationManager::CursorLocationManager() {}
13 13
14 CursorLocationManager::~CursorLocationManager() {} 14 CursorLocationManager::~CursorLocationManager() {}
15 15
16 void CursorLocationManager::OnMouseCursorLocationChanged( 16 void CursorLocationManager::OnMouseCursorLocationChanged(
17 const gfx::Point& point) { 17 const gfx::Point& point_in_dip) {
18 current_cursor_location_ = static_cast<base::subtle::Atomic32>( 18 current_cursor_location_ = static_cast<base::subtle::Atomic32>(
19 (point.x() & 0xFFFF) << 16 | (point.y() & 0xFFFF)); 19 (point_in_dip.x() & 0xFFFF) << 16 | (point_in_dip.y() & 0xFFFF));
20 if (cursor_location_memory()) { 20 if (cursor_location_memory()) {
21 base::subtle::NoBarrier_Store(cursor_location_memory(), 21 base::subtle::NoBarrier_Store(cursor_location_memory(),
22 current_cursor_location_); 22 current_cursor_location_);
23 } 23 }
24 } 24 }
25 25
26 mojo::ScopedSharedBufferHandle 26 mojo::ScopedSharedBufferHandle
27 CursorLocationManager::GetCursorLocationMemory() { 27 CursorLocationManager::GetCursorLocationMemory() {
28 if (!cursor_location_handle_.is_valid()) { 28 if (!cursor_location_handle_.is_valid()) {
29 // Create our shared memory segment to share the cursor state with our 29 // Create our shared memory segment to share the cursor state with our
(...skipping 11 matching lines...) Expand all
41 base::subtle::NoBarrier_Store(cursor_location_memory(), 41 base::subtle::NoBarrier_Store(cursor_location_memory(),
42 current_cursor_location_); 42 current_cursor_location_);
43 } 43 }
44 44
45 return cursor_location_handle_->Clone( 45 return cursor_location_handle_->Clone(
46 mojo::SharedBufferHandle::AccessMode::READ_ONLY); 46 mojo::SharedBufferHandle::AccessMode::READ_ONLY);
47 } 47 }
48 48
49 } // namespace ws 49 } // namespace ws
50 } // namespace ui 50 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/cursor_location_manager.h ('k') | services/ui/ws/display_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698