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

Unified Diff: ui/events/ozone/evdev/touch_event_converter_evdev.cc

Issue 616633002: [Ozone-Evdev] Propagate touchscreen device information to DeviceDataManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/ozone/evdev/touch_event_converter_evdev.cc
diff --git a/ui/events/ozone/evdev/touch_event_converter_evdev.cc b/ui/events/ozone/evdev/touch_event_converter_evdev.cc
index bbdf660395eb164ba9d3bff5edfb7a6cc4797cb2..16e969a2d242a6a8a65dad90ddac5181a4e232a0 100644
--- a/ui/events/ozone/evdev/touch_event_converter_evdev.cc
+++ b/ui/events/ozone/evdev/touch_event_converter_evdev.cc
@@ -26,7 +26,6 @@
#include "ui/events/event.h"
#include "ui/events/event_constants.h"
#include "ui/events/event_switches.h"
-#include "ui/gfx/screen.h"
namespace {
@@ -75,9 +74,10 @@ namespace ui {
TouchEventConverterEvdev::TouchEventConverterEvdev(
int fd,
base::FilePath path,
+ int id,
const EventDeviceInfo& info,
const EventDispatchCallback& callback)
- : EventConverterEvdev(fd, path),
+ : EventConverterEvdev(fd, path, id),
callback_(callback),
syn_dropped_(false),
is_type_a_(false),
@@ -91,31 +91,22 @@ TouchEventConverterEvdev::~TouchEventConverterEvdev() {
}
void TouchEventConverterEvdev::Init(const EventDeviceInfo& info) {
- gfx::Screen *screen = gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE);
- if (!screen)
- return; // No scaling.
- gfx::Display display = screen->GetPrimaryDisplay();
- gfx::Size size = display.GetSizeInPixel();
-
- pressure_min_ = info.GetAbsMinimum(ABS_MT_PRESSURE),
- pressure_max_ = info.GetAbsMaximum(ABS_MT_PRESSURE),
- x_min_tuxels_ = info.GetAbsMinimum(ABS_MT_POSITION_X),
- x_num_tuxels_ = info.GetAbsMaximum(ABS_MT_POSITION_X) - x_min_tuxels_ + 1,
- y_min_tuxels_ = info.GetAbsMinimum(ABS_MT_POSITION_Y),
- y_num_tuxels_ = info.GetAbsMaximum(ABS_MT_POSITION_Y) - y_min_tuxels_ + 1,
- x_min_pixels_ = x_min_tuxels_,
- x_num_pixels_ = x_num_tuxels_,
- y_min_pixels_ = y_min_tuxels_,
- y_num_pixels_ = y_num_tuxels_,
+ pressure_min_ = info.GetAbsMinimum(ABS_MT_PRESSURE);
+ pressure_max_ = info.GetAbsMaximum(ABS_MT_PRESSURE);
+ x_min_tuxels_ = info.GetAbsMinimum(ABS_MT_POSITION_X);
+ x_num_tuxels_ = info.GetAbsMaximum(ABS_MT_POSITION_X) - x_min_tuxels_ + 1;
+ y_min_tuxels_ = info.GetAbsMinimum(ABS_MT_POSITION_Y);
+ y_num_tuxels_ = info.GetAbsMaximum(ABS_MT_POSITION_Y) - y_min_tuxels_ + 1;
spang 2014/09/30 21:42:42 Haha
+ native_size_ = gfx::Size(x_num_tuxels_, y_num_tuxels_);
// Map coordinates onto screen.
x_min_pixels_ = 0;
y_min_pixels_ = 0;
- x_num_pixels_ = size.width();
- y_num_pixels_ = size.height();
+ x_num_pixels_ = x_num_tuxels_;
+ y_num_pixels_ = y_num_tuxels_;
spang 2014/09/30 21:42:41 This part disturbs me. Can you move it to the foll
dnicoara 2014/10/01 19:49:13 Done.
VLOG(1) << "mapping touch coordinates to screen coordinates: "
- << base::StringPrintf("%dx%d", size.width(), size.height());
+ << base::StringPrintf("%fx%f", x_num_pixels_, y_num_pixels_);
// Apply --touch-calibration.
TouchCalibration cal = {};
@@ -142,6 +133,14 @@ bool TouchEventConverterEvdev::Reinitialize() {
return false;
}
+bool TouchEventConverterEvdev::HasTouchscreen() const {
+ return true;
+}
+
+gfx::Size TouchEventConverterEvdev::GetTouchscreenSize() const {
+ return native_size_;
+}
+
void TouchEventConverterEvdev::OnFileCanReadWithoutBlocking(int fd) {
input_event inputs[MAX_FINGERS * 6 + 1];
ssize_t read_size = read(fd, inputs, sizeof(inputs));

Powered by Google App Engine
This is Rietveld 408576698