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

Side by Side Diff: ui/ozone/platform/dri/dri_cursor.cc

Issue 721823002: ozone: Interpret absolute events for graphics tablets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@o
Patch Set: Add missing initialisers for class members on TabletEventConverterEvdev Created 6 years, 1 month 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 | « ui/ozone/platform/dri/dri_cursor.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ozone/platform/dri/dri_cursor.h" 5 #include "ui/ozone/platform/dri/dri_cursor.h"
6 6
7 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" 7 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
8 #include "ui/gfx/geometry/point.h" 8 #include "ui/gfx/geometry/point.h"
9 #include "ui/gfx/geometry/point_conversions.h" 9 #include "ui/gfx/geometry/point_conversions.h"
10 #include "ui/gfx/geometry/point_f.h" 10 #include "ui/gfx/geometry/point_f.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 DriWindow* window = window_manager_->GetWindow(cursor_window_); 65 DriWindow* window = window_manager_->GetWindow(cursor_window_);
66 const gfx::Size& size = window->GetBounds().size(); 66 const gfx::Size& size = window->GetBounds().size();
67 cursor_location_.SetToMax(gfx::PointF(0, 0)); 67 cursor_location_.SetToMax(gfx::PointF(0, 0));
68 // Right and bottom edges are exclusive. 68 // Right and bottom edges are exclusive.
69 cursor_location_.SetToMin(gfx::PointF(size.width() - 1, size.height() - 1)); 69 cursor_location_.SetToMin(gfx::PointF(size.width() - 1, size.height() - 1));
70 70
71 if (cursor_.get()) 71 if (cursor_.get())
72 hardware_->MoveHardwareCursor(cursor_window_, bitmap_location()); 72 hardware_->MoveHardwareCursor(cursor_window_, bitmap_location());
73 } 73 }
74 74
75 void DriCursor::MoveCursorTo(const gfx::PointF& location) {
76 MoveCursorTo(cursor_window_, location);
77 }
78
75 void DriCursor::MoveCursor(const gfx::Vector2dF& delta) { 79 void DriCursor::MoveCursor(const gfx::Vector2dF& delta) {
76 MoveCursorTo(cursor_window_, cursor_location_ + delta); 80 MoveCursorTo(cursor_window_, cursor_location_ + delta);
77 } 81 }
78 82
83 gfx::Rect DriCursor::GetCursorDisplayBounds() {
84 if (cursor_window_ == gfx::kNullAcceleratedWidget)
85 return gfx::Rect();
86
87 DriWindow* window = window_manager_->GetWindow(cursor_window_);
88 return window->GetBounds();
89 }
90
79 gfx::AcceleratedWidget DriCursor::GetCursorWindow() { 91 gfx::AcceleratedWidget DriCursor::GetCursorWindow() {
80 return cursor_window_; 92 return cursor_window_;
81 } 93 }
82 94
83 bool DriCursor::IsCursorVisible() { 95 bool DriCursor::IsCursorVisible() {
84 return cursor_.get(); 96 return cursor_.get();
85 } 97 }
86 98
87 gfx::PointF DriCursor::location() { 99 gfx::PointF DriCursor::location() {
88 return cursor_location_; 100 return cursor_location_;
89 } 101 }
90 102
91 gfx::Point DriCursor::bitmap_location() { 103 gfx::Point DriCursor::bitmap_location() {
92 return gfx::ToFlooredPoint(cursor_location_) - 104 return gfx::ToFlooredPoint(cursor_location_) -
93 cursor_->hotspot().OffsetFromOrigin(); 105 cursor_->hotspot().OffsetFromOrigin();
94 } 106 }
95 107
96 } // namespace ui 108 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/dri_cursor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698