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

Side by Side Diff: ui/events/ozone/evdev/tablet_event_converter_evdev.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 | « no previous file | ui/ozone/platform/caca/ozone_platform_caca.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 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/events/ozone/evdev/tablet_event_converter_evdev.h" 5 #include "ui/events/ozone/evdev/tablet_event_converter_evdev.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <linux/input.h> 8 #include <linux/input.h>
9 9
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 abs_value_dirty_ = true; 99 abs_value_dirty_ = true;
100 break; 100 break;
101 case ABS_Y: 101 case ABS_Y:
102 y_abs_location_ = input.value; 102 y_abs_location_ = input.value;
103 abs_value_dirty_ = true; 103 abs_value_dirty_ = true;
104 break; 104 break;
105 } 105 }
106 } 106 }
107 107
108 void TabletEventConverterEvdev::UpdateCursor() { 108 void TabletEventConverterEvdev::UpdateCursor() {
109 int width = cursor_->GetCursorDisplayBounds().width(); 109 gfx::Rect display_bounds = cursor_->GetCursorDisplayBounds();
110 int height = cursor_->GetCursorDisplayBounds().height(); 110
111 int x = ((x_abs_location_ - x_abs_min_) * width) / x_abs_range_; 111 int x =
112 int y = ((y_abs_location_ - y_abs_min_) * height) / y_abs_range_; 112 ((x_abs_location_ - x_abs_min_) * display_bounds.width()) / x_abs_range_;
113 int y =
114 ((y_abs_location_ - y_abs_min_) * display_bounds.height()) / y_abs_range_;
115
116 x += display_bounds.x();
117 y += display_bounds.y();
113 118
114 cursor_->MoveCursorTo(gfx::PointF(x, y)); 119 cursor_->MoveCursorTo(gfx::PointF(x, y));
115 } 120 }
116 121
117 void TabletEventConverterEvdev::DispatchMouseButton(const input_event& input) { 122 void TabletEventConverterEvdev::DispatchMouseButton(const input_event& input) {
118 if (!cursor_) 123 if (!cursor_)
119 return; 124 return;
120 125
121 unsigned int modifier; 126 unsigned int modifier;
122 // These are the same as X11 behaviour 127 // These are the same as X11 behaviour
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 163
159 callback_.Run(make_scoped_ptr( 164 callback_.Run(make_scoped_ptr(
160 new MouseEvent(ui::ET_MOUSE_MOVED, cursor_->location(), 165 new MouseEvent(ui::ET_MOUSE_MOVED, cursor_->location(),
161 cursor_->location(), modifiers_->GetModifierFlags(), 166 cursor_->location(), modifiers_->GetModifierFlags(),
162 /* changed_button_flags */ 0))); 167 /* changed_button_flags */ 0)));
163 168
164 abs_value_dirty_ = false; 169 abs_value_dirty_ = false;
165 } 170 }
166 171
167 } // namespace ui 172 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/ozone/platform/caca/ozone_platform_caca.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698