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

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

Issue 766583002: ozone: dri: Support moving between displays in MoveCursorTo(location) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « ui/ozone/platform/caca/ozone_platform_caca.cc ('k') | ui/ozone/platform/dri/dri_window.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 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 const gfx::Size& size = window->GetBounds().size(); 71 const gfx::Size& size = window->GetBounds().size();
72 cursor_location_.SetToMax(gfx::PointF(0, 0)); 72 cursor_location_.SetToMax(gfx::PointF(0, 0));
73 // Right and bottom edges are exclusive. 73 // Right and bottom edges are exclusive.
74 cursor_location_.SetToMin(gfx::PointF(size.width() - 1, size.height() - 1)); 74 cursor_location_.SetToMin(gfx::PointF(size.width() - 1, size.height() - 1));
75 75
76 if (cursor_.get()) 76 if (cursor_.get())
77 sender_->MoveHardwareCursor(cursor_window_, bitmap_location()); 77 sender_->MoveHardwareCursor(cursor_window_, bitmap_location());
78 } 78 }
79 79
80 void DriCursor::MoveCursorTo(const gfx::PointF& location) { 80 void DriCursor::MoveCursorTo(const gfx::PointF& location) {
81 MoveCursorTo(cursor_window_, location); 81 DriWindow* window =
82 window_manager_->GetWindowAt(gfx::ToFlooredPoint(location));
83 if (!window)
84 return;
85
86 MoveCursorTo(window->GetAcceleratedWidget(),
87 location - window->GetBounds().OffsetFromOrigin());
82 } 88 }
83 89
84 void DriCursor::MoveCursor(const gfx::Vector2dF& delta) { 90 void DriCursor::MoveCursor(const gfx::Vector2dF& delta) {
85 #if defined(OS_CHROMEOS) 91 #if defined(OS_CHROMEOS)
86 gfx::Vector2dF transformed_delta = delta; 92 gfx::Vector2dF transformed_delta = delta;
87 ui::CursorController::GetInstance()->ApplyCursorConfigForWindow( 93 ui::CursorController::GetInstance()->ApplyCursorConfigForWindow(
88 cursor_window_, &transformed_delta); 94 cursor_window_, &transformed_delta);
89 MoveCursorTo(cursor_window_, cursor_location_ + transformed_delta); 95 MoveCursorTo(cursor_window_, cursor_location_ + transformed_delta);
90 #else 96 #else
91 MoveCursorTo(cursor_window_, cursor_location_ + delta); 97 MoveCursorTo(cursor_window_, cursor_location_ + delta);
(...skipping 19 matching lines...) Expand all
111 gfx::PointF DriCursor::location() { 117 gfx::PointF DriCursor::location() {
112 return cursor_location_; 118 return cursor_location_;
113 } 119 }
114 120
115 gfx::Point DriCursor::bitmap_location() { 121 gfx::Point DriCursor::bitmap_location() {
116 return gfx::ToFlooredPoint(cursor_location_) - 122 return gfx::ToFlooredPoint(cursor_location_) -
117 cursor_->hotspot().OffsetFromOrigin(); 123 cursor_->hotspot().OffsetFromOrigin();
118 } 124 }
119 125
120 } // namespace ui 126 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/caca/ozone_platform_caca.cc ('k') | ui/ozone/platform/dri/dri_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698