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

Side by Side Diff: ui/events/ozone/evdev/tablet_event_converter_evdev.cc

Issue 873563002: [Ozone] Constrain the cursor when overscan insets are set (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 abs_value_dirty_ = true; 103 abs_value_dirty_ = true;
104 break; 104 break;
105 case ABS_Y: 105 case ABS_Y:
106 y_abs_location_ = input.value; 106 y_abs_location_ = input.value;
107 abs_value_dirty_ = true; 107 abs_value_dirty_ = true;
108 break; 108 break;
109 } 109 }
110 } 110 }
111 111
112 void TabletEventConverterEvdev::UpdateCursor() { 112 void TabletEventConverterEvdev::UpdateCursor() {
113 gfx::Rect display_bounds = cursor_->GetCursorDisplayBounds(); 113 gfx::Rect confined_bounds = cursor_->GetCursorConfinedBounds();
114 114
115 int x = 115 int x =
116 ((x_abs_location_ - x_abs_min_) * display_bounds.width()) / x_abs_range_; 116 ((x_abs_location_ - x_abs_min_) * confined_bounds.width()) / x_abs_range_;
117 int y = 117 int y = ((y_abs_location_ - y_abs_min_) * confined_bounds.height()) /
118 ((y_abs_location_ - y_abs_min_) * display_bounds.height()) / y_abs_range_; 118 y_abs_range_;
119 119
120 x += display_bounds.x(); 120 x += confined_bounds.x();
121 y += display_bounds.y(); 121 y += confined_bounds.y();
122 122
123 cursor_->MoveCursorTo(gfx::PointF(x, y)); 123 cursor_->MoveCursorTo(gfx::PointF(x, y));
124 } 124 }
125 125
126 void TabletEventConverterEvdev::DispatchMouseButton(const input_event& input) { 126 void TabletEventConverterEvdev::DispatchMouseButton(const input_event& input) {
127 if (!cursor_) 127 if (!cursor_)
128 return; 128 return;
129 129
130 unsigned int modifier; 130 unsigned int modifier;
131 // These are the same as X11 behaviour 131 // These are the same as X11 behaviour
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 callback_.Run(make_scoped_ptr( 169 callback_.Run(make_scoped_ptr(
170 new MouseEvent(ui::ET_MOUSE_MOVED, cursor_->GetLocation(), 170 new MouseEvent(ui::ET_MOUSE_MOVED, cursor_->GetLocation(),
171 cursor_->GetLocation(), modifiers_->GetModifierFlags(), 171 cursor_->GetLocation(), modifiers_->GetModifierFlags(),
172 /* changed_button_flags */ 0))); 172 /* changed_button_flags */ 0)));
173 173
174 abs_value_dirty_ = false; 174 abs_value_dirty_ = false;
175 } 175 }
176 176
177 } // namespace ui 177 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/input_injector_evdev_unittest.cc ('k') | ui/events/ozone/evdev/tablet_event_converter_evdev_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698