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

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

Issue 1035513002: ozone: evdev: Remove native size member from TouchEventConverterEvdev (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « ui/events/ozone/evdev/touch_event_converter_evdev.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/events/ozone/evdev/touch_event_converter_evdev.h" 5 #include "ui/events/ozone/evdev/touch_event_converter_evdev.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <linux/input.h> 9 #include <linux/input.h>
10 #include <poll.h> 10 #include <poll.h>
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 x_num_tuxels_ -= cal.bezel_left + cal.bezel_right; 107 x_num_tuxels_ -= cal.bezel_left + cal.bezel_right;
108 y_min_tuxels_ += cal.bezel_top; 108 y_min_tuxels_ += cal.bezel_top;
109 y_num_tuxels_ -= cal.bezel_top + cal.bezel_bottom; 109 y_num_tuxels_ -= cal.bezel_top + cal.bezel_bottom;
110 110
111 VLOG(1) << "applying touch calibration: " 111 VLOG(1) << "applying touch calibration: "
112 << base::StringPrintf("[%d, %d, %d, %d]", cal.bezel_left, 112 << base::StringPrintf("[%d, %d, %d, %d]", cal.bezel_left,
113 cal.bezel_right, cal.bezel_top, 113 cal.bezel_right, cal.bezel_top,
114 cal.bezel_bottom); 114 cal.bezel_bottom);
115 } 115 }
116 116
117 native_size_ = gfx::Size(x_num_tuxels_, y_num_tuxels_);
118
119 events_.resize(touch_points_); 117 events_.resize(touch_points_);
120 for (size_t i = 0; i < events_.size(); ++i) { 118 for (size_t i = 0; i < events_.size(); ++i) {
121 events_[i].finger_ = info.GetSlotValue(ABS_MT_TRACKING_ID, i); 119 events_[i].finger_ = info.GetSlotValue(ABS_MT_TRACKING_ID, i);
122 events_[i].type_ = 120 events_[i].type_ =
123 events_[i].finger_ < 0 ? ET_TOUCH_RELEASED : ET_TOUCH_PRESSED; 121 events_[i].finger_ < 0 ? ET_TOUCH_RELEASED : ET_TOUCH_PRESSED;
124 events_[i].x_ = info.GetSlotValue(ABS_MT_POSITION_X, i); 122 events_[i].x_ = info.GetSlotValue(ABS_MT_POSITION_X, i);
125 events_[i].y_ = info.GetSlotValue(ABS_MT_POSITION_Y, i); 123 events_[i].y_ = info.GetSlotValue(ABS_MT_POSITION_Y, i);
126 events_[i].radius_x_ = info.GetSlotValue(ABS_MT_TOUCH_MAJOR, i); 124 events_[i].radius_x_ = info.GetSlotValue(ABS_MT_TOUCH_MAJOR, i);
127 events_[i].radius_y_ = info.GetSlotValue(ABS_MT_TOUCH_MINOR, i); 125 events_[i].radius_y_ = info.GetSlotValue(ABS_MT_TOUCH_MINOR, i);
128 events_[i].pressure_ = info.GetSlotValue(ABS_MT_PRESSURE, i); 126 events_[i].pressure_ = info.GetSlotValue(ABS_MT_PRESSURE, i);
129 } 127 }
130 } 128 }
131 129
132 bool TouchEventConverterEvdev::Reinitialize() { 130 bool TouchEventConverterEvdev::Reinitialize() {
133 EventDeviceInfo info; 131 EventDeviceInfo info;
134 if (info.Initialize(fd_)) { 132 if (info.Initialize(fd_)) {
135 Initialize(info); 133 Initialize(info);
136 return true; 134 return true;
137 } 135 }
138 return false; 136 return false;
139 } 137 }
140 138
141 bool TouchEventConverterEvdev::HasTouchscreen() const { 139 bool TouchEventConverterEvdev::HasTouchscreen() const {
142 return true; 140 return true;
143 } 141 }
144 142
145 gfx::Size TouchEventConverterEvdev::GetTouchscreenSize() const { 143 gfx::Size TouchEventConverterEvdev::GetTouchscreenSize() const {
146 return native_size_; 144 return gfx::Size(x_num_tuxels_, y_num_tuxels_);
147 } 145 }
148 146
149 int TouchEventConverterEvdev::GetTouchPoints() const { 147 int TouchEventConverterEvdev::GetTouchPoints() const {
150 return touch_points_; 148 return touch_points_;
151 } 149 }
152 150
153 void TouchEventConverterEvdev::OnFileCanReadWithoutBlocking(int fd) { 151 void TouchEventConverterEvdev::OnFileCanReadWithoutBlocking(int fd) {
154 input_event inputs[MAX_FINGERS * 6 + 1]; 152 input_event inputs[MAX_FINGERS * 6 + 1];
155 ssize_t read_size = read(fd, inputs, sizeof(inputs)); 153 ssize_t read_size = read(fd, inputs, sizeof(inputs));
156 if (read_size < 0) { 154 if (read_size < 0) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 279
282 // Subsequent events for this finger will be touch-move until it 280 // Subsequent events for this finger will be touch-move until it
283 // is released. 281 // is released.
284 events_[i].type_ = ET_TOUCH_MOVED; 282 events_[i].type_ = ET_TOUCH_MOVED;
285 events_[i].altered_ = false; 283 events_[i].altered_ = false;
286 } 284 }
287 } 285 }
288 } 286 }
289 287
290 } // namespace ui 288 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/touch_event_converter_evdev.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698