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 6fef3b55abca7fe35e67f6761fbbf5f4c9c3cd03..d3cbf36b5bf39069fec576329c010a1ed9173058 100644 |
--- a/ui/events/ozone/evdev/touch_event_converter_evdev.cc |
+++ b/ui/events/ozone/evdev/touch_event_converter_evdev.cc |
@@ -16,59 +16,12 @@ |
#include "base/bind.h" |
#include "base/callback.h" |
-#include "base/command_line.h" |
#include "base/logging.h" |
#include "base/memory/scoped_vector.h" |
#include "base/message_loop/message_loop.h" |
-#include "base/strings/string_number_conversions.h" |
-#include "base/strings/string_util.h" |
-#include "base/strings/stringprintf.h" |
#include "ui/events/event.h" |
#include "ui/events/event_constants.h" |
#include "ui/events/event_switches.h" |
-#include "ui/gfx/screen.h" |
- |
-namespace { |
- |
-struct TouchCalibration { |
- int bezel_left; |
- int bezel_right; |
- int bezel_top; |
- int bezel_bottom; |
-}; |
- |
-void GetTouchCalibration(TouchCalibration* cal) { |
- std::vector<std::string> parts; |
- if (Tokenize(CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
- switches::kTouchCalibration), |
- ",", |
- &parts) >= 4) { |
- if (!base::StringToInt(parts[0], &cal->bezel_left)) |
- DLOG(ERROR) << "Incorrect left border calibration value passed."; |
- if (!base::StringToInt(parts[1], &cal->bezel_right)) |
- DLOG(ERROR) << "Incorrect right border calibration value passed."; |
- if (!base::StringToInt(parts[2], &cal->bezel_top)) |
- DLOG(ERROR) << "Incorrect top border calibration value passed."; |
- if (!base::StringToInt(parts[3], &cal->bezel_bottom)) |
- DLOG(ERROR) << "Incorrect bottom border calibration value passed."; |
- } |
-} |
- |
-float TuxelsToPixels(float val, |
- float min_tuxels, |
- float num_tuxels, |
- float min_pixels, |
- float num_pixels) { |
- // Map [min_tuxels, min_tuxels + num_tuxels) to |
- // [min_pixels, min_pixels + num_pixels). |
- return min_pixels + (val - min_tuxels) * num_pixels / num_tuxels; |
-} |
- |
-float TuxelToPixelSize(float val, float num_tuxels, float num_pixels) { |
- return val * num_pixels / num_tuxels; |
-} |
- |
-} // namespace |
namespace ui { |
@@ -92,12 +45,6 @@ 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); |
@@ -105,30 +52,6 @@ void TouchEventConverterEvdev::Init(const EventDeviceInfo& info) { |
y_min_tuxels_ = info.GetAbsMinimum(ABS_MT_POSITION_Y); |
y_num_tuxels_ = info.GetAbsMaximum(ABS_MT_POSITION_Y) - y_min_tuxels_ + 1; |
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(); |
- |
- VLOG(1) << "mapping touch coordinates to screen coordinates: " |
- << base::StringPrintf("%dx%d", size.width(), size.height()); |
- |
- // Apply --touch-calibration. |
- TouchCalibration cal = {}; |
- GetTouchCalibration(&cal); |
- x_min_tuxels_ += cal.bezel_left; |
- x_num_tuxels_ -= cal.bezel_left + cal.bezel_right; |
- y_min_tuxels_ += cal.bezel_top; |
- y_num_tuxels_ -= cal.bezel_top + cal.bezel_bottom; |
- |
- VLOG(1) << "applying touch calibration: " |
- << base::StringPrintf("[%d, %d, %d, %d]", |
- cal.bezel_left, |
- cal.bezel_right, |
- cal.bezel_top, |
- cal.bezel_bottom); |
} |
bool TouchEventConverterEvdev::Reinitialize() { |
@@ -195,29 +118,19 @@ void TouchEventConverterEvdev::ProcessAbs(const input_event& input) { |
// TODO(spang): If we have all of major, minor, and orientation, |
// we can scale the ellipse correctly. However on the Pixel we get |
// neither minor nor orientation, so this is all we can do. |
- events_[current_slot_].radius_x_ = |
- TuxelToPixelSize(input.value, x_num_tuxels_, x_num_pixels_) / 2.0f; |
+ events_[current_slot_].radius_x_ = input.value / 2.0f; |
break; |
case ABS_MT_TOUCH_MINOR: |
altered_slots_.set(current_slot_); |
- events_[current_slot_].radius_y_ = |
- TuxelToPixelSize(input.value, y_num_tuxels_, y_num_pixels_) / 2.0f; |
+ events_[current_slot_].radius_y_ = input.value / 2.0f; |
break; |
case ABS_MT_POSITION_X: |
altered_slots_.set(current_slot_); |
- events_[current_slot_].x_ = TuxelsToPixels(input.value, |
- x_min_tuxels_, |
- x_num_tuxels_, |
- x_min_pixels_, |
- x_num_pixels_); |
+ events_[current_slot_].x_ = input.value - x_min_tuxels_; |
break; |
case ABS_MT_POSITION_Y: |
altered_slots_.set(current_slot_); |
- events_[current_slot_].y_ = TuxelsToPixels(input.value, |
- y_min_tuxels_, |
- y_num_tuxels_, |
- y_min_pixels_, |
- y_num_pixels_); |
+ events_[current_slot_].y_ = input.value - y_min_tuxels_; |
break; |
case ABS_MT_TRACKING_ID: |
altered_slots_.set(current_slot_); |