| 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..dd8ed827c9df1dcdeddc6bddf8f7833785692969 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,14 +74,14 @@ namespace ui {
|
| TouchEventConverterEvdev::TouchEventConverterEvdev(
|
| int fd,
|
| base::FilePath path,
|
| - const EventDeviceInfo& info,
|
| + scoped_ptr<EventDeviceInfo> device_info,
|
| const EventDispatchCallback& callback)
|
| - : EventConverterEvdev(fd, path),
|
| + : EventConverterEvdev(fd, path, device_info.Pass()),
|
| callback_(callback),
|
| syn_dropped_(false),
|
| is_type_a_(false),
|
| current_slot_(0) {
|
| - Init(info);
|
| + Init();
|
| }
|
|
|
| TouchEventConverterEvdev::~TouchEventConverterEvdev() {
|
| @@ -90,32 +89,28 @@ TouchEventConverterEvdev::~TouchEventConverterEvdev() {
|
| close(fd_);
|
| }
|
|
|
| -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_,
|
| +void TouchEventConverterEvdev::Init() {
|
| + pressure_min_ = device_info_->GetAbsMinimum(ABS_MT_PRESSURE);
|
| + pressure_max_ = device_info_->GetAbsMaximum(ABS_MT_PRESSURE);
|
| + x_min_tuxels_ = device_info_->GetAbsMinimum(ABS_MT_POSITION_X);
|
| + x_num_tuxels_ =
|
| + device_info_->GetAbsMaximum(ABS_MT_POSITION_X) - x_min_tuxels_ + 1;
|
| + y_min_tuxels_ = device_info_->GetAbsMinimum(ABS_MT_POSITION_Y);
|
| + y_num_tuxels_ =
|
| + device_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_;
|
|
|
| // 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_;
|
|
|
| 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 = {};
|
| @@ -134,9 +129,9 @@ void TouchEventConverterEvdev::Init(const EventDeviceInfo& info) {
|
| }
|
|
|
| bool TouchEventConverterEvdev::Reinitialize() {
|
| - EventDeviceInfo info;
|
| - if (info.Initialize(fd_)) {
|
| - Init(info);
|
| + device_info_.reset(new EventDeviceInfo(device_info_->id()));
|
| + if (device_info_->Initialize(fd_)) {
|
| + Init();
|
| return true;
|
| }
|
| return false;
|
|
|