diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-23 20:12:59 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-23 20:12:59 +0000 |
commit | 38191afc4c8573ee57312a580a22196df9817eed (patch) | |
tree | 4d187fa6f7921d3b157c5c49f0b6c528baf7ad44 /ui/base | |
parent | 1effbd4b2add4102733dc85a9fd8e4502830613c (diff) | |
download | chromium_src-38191afc4c8573ee57312a580a22196df9817eed.zip chromium_src-38191afc4c8573ee57312a580a22196df9817eed.tar.gz chromium_src-38191afc4c8573ee57312a580a22196df9817eed.tar.bz2 |
Move Ozone event stuff to ui/events
BUG=none
R=rjkroege@chromium.org
Review URL: https://codereview.chromium.org/23465037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224774 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base')
-rw-r--r-- | ui/base/ozone/evdev/key_event_converter_ozone.cc | 64 | ||||
-rw-r--r-- | ui/base/ozone/evdev/key_event_converter_ozone.h | 27 | ||||
-rw-r--r-- | ui/base/ozone/evdev/touch_event_converter_ozone.cc | 190 | ||||
-rw-r--r-- | ui/base/ozone/evdev/touch_event_converter_ozone.h | 81 | ||||
-rw-r--r-- | ui/base/ozone/evdev/touch_event_converter_ozone_unittest.cc | 396 | ||||
-rw-r--r-- | ui/base/ozone/event_converter_ozone.cc | 33 | ||||
-rw-r--r-- | ui/base/ozone/event_converter_ozone.h | 38 | ||||
-rw-r--r-- | ui/base/ozone/event_factory_delegate_ozone.h | 29 | ||||
-rw-r--r-- | ui/base/ozone/event_factory_ozone.cc | 109 | ||||
-rw-r--r-- | ui/base/ozone/event_factory_ozone.h | 60 | ||||
-rw-r--r-- | ui/base/ozone/events_ozone.cc | 157 |
11 files changed, 0 insertions, 1184 deletions
diff --git a/ui/base/ozone/evdev/key_event_converter_ozone.cc b/ui/base/ozone/evdev/key_event_converter_ozone.cc deleted file mode 100644 index 66ec892..0000000 --- a/ui/base/ozone/evdev/key_event_converter_ozone.cc +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/base/ozone/evdev/key_event_converter_ozone.h" - -#include <linux/input.h> - -#include "ui/events/event.h" -#include "ui/events/keycodes/keyboard_codes.h" - -namespace { - -ui::KeyboardCode KeyboardCodeFromButton(int code) { - switch (code) { - case KEY_VOLUMEDOWN: - return ui::VKEY_VOLUME_DOWN; - - case KEY_VOLUMEUP: - return ui::VKEY_VOLUME_UP; - - case KEY_POWER: - return ui::VKEY_POWER; - } - - LOG(ERROR) << "Unknown key code: " << code; - return static_cast<ui::KeyboardCode>(0); -} - -} // namespace - -namespace ui { - -// TODO(rjkroege): Stop leaking file descriptor. -KeyEventConverterOzone::KeyEventConverterOzone() {} -KeyEventConverterOzone::~KeyEventConverterOzone() {} - -void KeyEventConverterOzone::OnFileCanReadWithoutBlocking(int fd) { - input_event inputs[4]; - ssize_t read_size = read(fd, inputs, sizeof(inputs)); - if (read_size <= 0) - return; - - CHECK_EQ(read_size % sizeof(*inputs), 0u); - for (unsigned i = 0; i < read_size / sizeof(*inputs); ++i) { - const input_event& input = inputs[i]; - if (input.type == EV_KEY) { - scoped_ptr<KeyEvent> key( - new KeyEvent(input.value == 1 ? ET_KEY_PRESSED : ET_KEY_RELEASED, - KeyboardCodeFromButton(input.code), - 0, - true)); - DispatchEvent(key.PassAs<ui::Event>()); - } else if (input.type == EV_SYN) { - // TODO(sadrul): Handle this case appropriately. - } - } -} - -void KeyEventConverterOzone::OnFileCanWriteWithoutBlocking(int fd) { - NOTREACHED(); -} - -} // namespace ui diff --git a/ui/base/ozone/evdev/key_event_converter_ozone.h b/ui/base/ozone/evdev/key_event_converter_ozone.h deleted file mode 100644 index 2ce3c22..0000000 --- a/ui/base/ozone/evdev/key_event_converter_ozone.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_BASE_OZONE_EVDEV_KEY_EVENT_CONVERTER_OZONE_H_ -#define UI_BASE_OZONE_EVDEV_KEY_EVENT_CONVERTER_OZONE_H_ - -#include "ui/base/ozone/event_converter_ozone.h" - -namespace ui { - -class KeyEventConverterOzone : public EventConverterOzone { - public: - KeyEventConverterOzone(); - virtual ~KeyEventConverterOzone(); - - private: - // Overidden from base::MessagePumpLibevent::Watcher. - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; - virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; - - DISALLOW_COPY_AND_ASSIGN(KeyEventConverterOzone); -}; - -} // namspace ui - -#endif // UI_BASE_OZONE_EVDEV_KEY_EVENT_CONVERTER_OZONE_H_ diff --git a/ui/base/ozone/evdev/touch_event_converter_ozone.cc b/ui/base/ozone/evdev/touch_event_converter_ozone.cc deleted file mode 100644 index e34adcd..0000000 --- a/ui/base/ozone/evdev/touch_event_converter_ozone.cc +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/base/ozone/evdev/touch_event_converter_ozone.h" - -#include <fcntl.h> -#include <linux/input.h> -#include <poll.h> -#include <stdio.h> -#include <unistd.h> - -#include <cmath> -#include <limits> - -#include "base/bind.h" -#include "base/callback.h" -#include "base/logging.h" -#include "base/message_loop/message_loop.h" -#include "base/message_loop/message_pump_ozone.h" -#include "ui/base/ozone/surface_factory_ozone.h" -#include "ui/events/event.h" -#include "ui/events/event_constants.h" - -namespace { - -// Number is determined empirically. -// TODO(rjkroege): Configure this per device. -const float kFingerWidth = 25.f; - -} // namespace - -namespace ui { - -TouchEventConverterOzone::TouchEventConverterOzone(int fd, int id) - : pressure_min_(0), - pressure_max_(0), - x_scale_(1.), - y_scale_(1.), - x_max_(std::numeric_limits<int>::max()), - y_max_(std::numeric_limits<int>::max()), - current_slot_(0), - fd_(fd), - id_(id) { - Init(); -} - -TouchEventConverterOzone::~TouchEventConverterOzone() { - if (close(fd_) < 0) - DLOG(WARNING) << "failed close on /dev/input/event" << id_; -} - -void TouchEventConverterOzone::Init() { - input_absinfo abs = {}; - if (ioctl(fd_, EVIOCGABS(ABS_MT_SLOT), &abs) != -1) { - CHECK_GE(abs.maximum, abs.minimum); - CHECK_GE(abs.minimum, 0); - } else { - DLOG(WARNING) << "failed ioctl EVIOCGABS ABS_MT_SLOT event" << id_; - } - if (ioctl(fd_, EVIOCGABS(ABS_MT_PRESSURE), &abs) != -1) { - pressure_min_ = abs.minimum; - pressure_max_ = abs.maximum; - } else { - DLOG(WARNING) << "failed ioctl EVIOCGABS ABS_MT_PRESSURE event" << id_; - } - int x_min = 0, x_max = 0; - if (ioctl(fd_, EVIOCGABS(ABS_MT_POSITION_X), &abs) != -1) { - x_min = abs.minimum; - x_max = abs.maximum; - } else { - LOG(WARNING) << "failed ioctl EVIOCGABS ABS_X event" << id_; - } - int y_min = 0, y_max = 0; - if (ioctl(fd_, EVIOCGABS(ABS_MT_POSITION_Y), &abs) != -1) { - y_min = abs.minimum; - y_max = abs.maximum; - } else { - LOG(WARNING) << "failed ioctl EVIOCGABS ABS_Y event" << id_; - } - if (x_max && y_max && SurfaceFactoryOzone::GetInstance()) { - const char* display = - SurfaceFactoryOzone::GetInstance()->DefaultDisplaySpec(); - int screen_width, screen_height; - int sc = sscanf(display, "%dx%d", &screen_width, &screen_height); - if (sc == 2) { - x_scale_ = (double)screen_width / (x_max - x_min); - y_scale_ = (double)screen_height / (y_max - y_min); - x_max_ = screen_width - 1; - y_max_ = screen_height - 1; - LOG(INFO) << "touch input x_scale=" << x_scale_ - << " y_scale=" << y_scale_; - } else { - LOG(WARNING) << "malformed display spec from " - << "SurfaceFactoryOzone::DefaultDisplaySpec"; - } - } -} - -void TouchEventConverterOzone::OnFileCanWriteWithoutBlocking(int /* fd */) { - // Read-only file-descriptors. - NOTREACHED(); -} - -void TouchEventConverterOzone::OnFileCanReadWithoutBlocking(int fd) { - input_event inputs[MAX_FINGERS * 6 + 1]; - ssize_t read_size = read(fd, inputs, sizeof(inputs)); - if (read_size <= 0) - return; - - for (unsigned i = 0; i < read_size / sizeof(*inputs); i++) { - const input_event& input = inputs[i]; - if (input.type == EV_ABS) { - switch (input.code) { - case ABS_MT_TOUCH_MAJOR: - altered_slots_.set(current_slot_); - events_[current_slot_].major_ = input.value; - break; - case ABS_X: - case ABS_MT_POSITION_X: - altered_slots_.set(current_slot_); - events_[current_slot_].x_ = roundf(input.value * x_scale_); - break; - case ABS_Y: - case ABS_MT_POSITION_Y: - altered_slots_.set(current_slot_); - events_[current_slot_].y_ = roundf(input.value * y_scale_); - break; - case ABS_MT_TRACKING_ID: - altered_slots_.set(current_slot_); - if (input.value < 0) { - events_[current_slot_].type_ = ET_TOUCH_RELEASED; - } else { - events_[current_slot_].finger_ = input.value; - events_[current_slot_].type_ = ET_TOUCH_PRESSED; - } - break; - case ABS_MT_PRESSURE: - case ABS_PRESSURE: - altered_slots_.set(current_slot_); - events_[current_slot_].pressure_ = input.value - pressure_min_; - events_[current_slot_].pressure_ /= pressure_max_ - pressure_min_; - break; - case ABS_MT_SLOT: - current_slot_ = input.value; - altered_slots_.set(current_slot_); - break; - default: - NOTREACHED(); - } - } else if (input.type == EV_SYN) { - switch (input.code) { - case SYN_REPORT: - for (int j = 0; j < MAX_FINGERS; j++) { - if (altered_slots_[j]) { - // TODO(rjkroege): Support elliptical finger regions. - scoped_ptr<TouchEvent> tev(new TouchEvent( - events_[j].type_, - gfx::Point(std::min(x_max_, events_[j].x_), - std::min(y_max_, events_[j].y_)), - /* flags */ 0, - /* touch_id */ j, - base::TimeDelta::FromMicroseconds( - input.time.tv_sec * 1000000 + input.time.tv_usec), - events_[j].pressure_ * kFingerWidth, - events_[j].pressure_ * kFingerWidth, - /* angle */ 0., - events_[j].pressure_)); - DispatchEvent(tev.PassAs<ui::Event>()); - - // Subsequent events for this finger will be touch-move until it - // is released. - events_[j].type_ = ET_TOUCH_MOVED; - } - } - altered_slots_.reset(); - break; - case SYN_MT_REPORT: - case SYN_CONFIG: - case SYN_DROPPED: - NOTREACHED() << "SYN_MT events not supported."; - break; - } - } else { - NOTREACHED(); - } - } -} - -} // namespace ui diff --git a/ui/base/ozone/evdev/touch_event_converter_ozone.h b/ui/base/ozone/evdev/touch_event_converter_ozone.h deleted file mode 100644 index 62f1bfe..0000000 --- a/ui/base/ozone/evdev/touch_event_converter_ozone.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_BASE_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_OZONE_H_ -#define UI_BASE_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_OZONE_H_ - -#include <bitset> - -#include "base/compiler_specific.h" -#include "ui/base/ozone/event_converter_ozone.h" -#include "ui/base/ui_export.h" -#include "ui/events/event_constants.h" - -namespace ui { - -class TouchEvent; - -class UI_EXPORT TouchEventConverterOzone : public EventConverterOzone { - public: - enum { - MAX_FINGERS = 11 - }; - TouchEventConverterOzone(int fd, int id); - virtual ~TouchEventConverterOzone(); - - private: - friend class MockTouchEventConverterOzone; - - // Unsafe part of initialization. - void Init(); - - // Overidden from base::MessagePumpLibevent::Watcher. - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; - virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; - - // Pressure values. - int pressure_min_; - int pressure_max_; // Used to normalize pressure values. - - // Touch scaling. - float x_scale_; - float y_scale_; - - // Maximum coordinate-values allowed for the events. - int x_max_; - int y_max_; - - // Touch point currently being updated from the /dev/input/event* stream. - int current_slot_; - - // File descriptor for the /dev/input/event* instance. - int fd_; - - // Number corresponding to * in the source evdev device: /dev/input/event* - int id_; - - // Bit field tracking which in-progress touch points have been modified - // without a syn event. - std::bitset<MAX_FINGERS> altered_slots_; - - struct InProgressEvents { - int x_; - int y_; - int id_; // Device reported "unique" touch point id; -1 means not active - int finger_; // "Finger" id starting from 0; -1 means not active - - EventType type_; - int major_; - float pressure_; - }; - - // In-progress touch points. - InProgressEvents events_[MAX_FINGERS]; - - DISALLOW_COPY_AND_ASSIGN(TouchEventConverterOzone); -}; - -} // namespace ui - -#endif // UI_BASE_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_OZONE_H_ diff --git a/ui/base/ozone/evdev/touch_event_converter_ozone_unittest.cc b/ui/base/ozone/evdev/touch_event_converter_ozone_unittest.cc deleted file mode 100644 index b75741d..0000000 --- a/ui/base/ozone/evdev/touch_event_converter_ozone_unittest.cc +++ /dev/null @@ -1,396 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <errno.h> -#include <fcntl.h> -#include <linux/input.h> -#include <unistd.h> - -#include <vector> - -#include "base/memory/scoped_ptr.h" -#include "base/memory/scoped_vector.h" -#include "base/message_loop/message_loop.h" -#include "base/posix/eintr_wrapper.h" -#include "base/run_loop.h" -#include "base/time/time.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "ui/base/ozone/evdev/touch_event_converter_ozone.h" -#include "ui/events/event.h" - -namespace { - -static int SetNonBlocking(int fd) { - int flags = fcntl(fd, F_GETFL, 0); - if (flags == -1) - flags = 0; - return fcntl(fd, F_SETFL, flags | O_NONBLOCK); -} - -} // namespace - -namespace ui { - -class MockTouchEventConverterOzone : public TouchEventConverterOzone, - public base::MessageLoop::Dispatcher { - public: - MockTouchEventConverterOzone(int a, int b); - virtual ~MockTouchEventConverterOzone() {}; - - void ConfigureReadMock(struct input_event* queue, - long read_this_many, - long queue_index); - - unsigned size() { return dispatched_events_.size(); } - TouchEvent* event(unsigned index) { return dispatched_events_[index]; } - - // Actually dispatch the event reader code. - void ReadNow() { - OnFileCanReadWithoutBlocking(read_pipe_); - base::RunLoop().RunUntilIdle(); - } - - virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; - - private: - int read_pipe_; - int write_pipe_; - - ScopedVector<TouchEvent> dispatched_events_; - - DISALLOW_COPY_AND_ASSIGN(MockTouchEventConverterOzone); -}; - -MockTouchEventConverterOzone::MockTouchEventConverterOzone(int a, int b) - : TouchEventConverterOzone(a, b) { - pressure_min_ = 30; - pressure_max_ = 60; - - int fds[2]; - - DCHECK(pipe(fds) >= 0) << "pipe() failed, errno: " << errno; - DCHECK(SetNonBlocking(fds[0]) == 0) - << "SetNonBlocking for pipe fd[0] failed, errno: " << errno; - DCHECK(SetNonBlocking(fds[1]) == 0) - << "SetNonBlocking for pipe fd[0] failed, errno: " << errno; - read_pipe_ = fds[0]; - write_pipe_ = fds[1]; -} - -bool MockTouchEventConverterOzone::Dispatch(const base::NativeEvent& event) { - ui::TouchEvent* ev = new ui::TouchEvent(event); - dispatched_events_.push_back(ev); - return true; -} - -void MockTouchEventConverterOzone::ConfigureReadMock(struct input_event* queue, - long read_this_many, - long queue_index) { - int nwrite = HANDLE_EINTR(write(write_pipe_, - queue + queue_index, - sizeof(struct input_event) * read_this_many)); - DCHECK(nwrite == - static_cast<int>(sizeof(struct input_event) * read_this_many)) - << "write() failed, errno: " << errno; -} - -} // namespace ui - -// Test fixture. -class TouchEventConverterOzoneTest : public testing::Test { - public: - TouchEventConverterOzoneTest() {} - - // Overridden from testing::Test: - virtual void SetUp() OVERRIDE { - loop_ = new base::MessageLoop(base::MessageLoop::TYPE_UI); - device_ = new ui::MockTouchEventConverterOzone(-1, 2); - base::MessagePumpOzone::Current()->AddDispatcherForRootWindow(device_); - } - virtual void TearDown() OVERRIDE { - delete device_; - delete loop_; - } - - ui::MockTouchEventConverterOzone* device() { return device_; } - - private: - base::MessageLoop* loop_; - ui::MockTouchEventConverterOzone* device_; - DISALLOW_COPY_AND_ASSIGN(TouchEventConverterOzoneTest); -}; - -// TODO(rjkroege): Test for valid handling of time stamps. -TEST_F(TouchEventConverterOzoneTest, TouchDown) { - ui::MockTouchEventConverterOzone* dev = device(); - - struct input_event mock_kernel_queue[] = { - {{0, 0}, EV_ABS, ABS_MT_TRACKING_ID, 684}, - {{0, 0}, EV_ABS, ABS_MT_TOUCH_MAJOR, 3}, - {{0, 0}, EV_ABS, ABS_MT_PRESSURE, 45}, - {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 42}, - {{0, 0}, EV_ABS, ABS_MT_POSITION_Y, 51}, {{0, 0}, EV_SYN, SYN_REPORT, 0} - }; - - dev->ConfigureReadMock(mock_kernel_queue, 1, 0); - dev->ReadNow(); - EXPECT_EQ(0u, dev->size()); - - dev->ConfigureReadMock(mock_kernel_queue, 2, 1); - dev->ReadNow(); - EXPECT_EQ(0u, dev->size()); - - dev->ConfigureReadMock(mock_kernel_queue, 3, 3); - dev->ReadNow(); - EXPECT_EQ(1u, dev->size()); - - ui::TouchEvent* event = dev->event(0); - EXPECT_FALSE(event == NULL); - - EXPECT_EQ(ui::ET_TOUCH_PRESSED, event->type()); - EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), event->time_stamp()); - EXPECT_EQ(42, event->x()); - EXPECT_EQ(51, event->y()); - EXPECT_EQ(0, event->touch_id()); - EXPECT_FLOAT_EQ(.5f, event->force()); - EXPECT_FLOAT_EQ(0.f, event->rotation_angle()); -} - -TEST_F(TouchEventConverterOzoneTest, NoEvents) { - ui::MockTouchEventConverterOzone* dev = device(); - dev->ConfigureReadMock(NULL, 0, 0); - EXPECT_EQ(0u, dev->size()); -} - -TEST_F(TouchEventConverterOzoneTest, TouchMove) { - ui::MockTouchEventConverterOzone* dev = device(); - - struct input_event mock_kernel_queue_press[] = { - {{0, 0}, EV_ABS, ABS_MT_TRACKING_ID, 684}, - {{0, 0}, EV_ABS, ABS_MT_TOUCH_MAJOR, 3}, - {{0, 0}, EV_ABS, ABS_MT_PRESSURE, 45}, - {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 42}, - {{0, 0}, EV_ABS, ABS_MT_POSITION_Y, 51}, {{0, 0}, EV_SYN, SYN_REPORT, 0} - }; - - struct input_event mock_kernel_queue_move1[] = { - {{0, 0}, EV_ABS, ABS_MT_PRESSURE, 50}, - {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 42}, - {{0, 0}, EV_ABS, ABS_MT_POSITION_Y, 43}, {{0, 0}, EV_SYN, SYN_REPORT, 0} - }; - - struct input_event mock_kernel_queue_move2[] = { - {{0, 0}, EV_ABS, ABS_MT_POSITION_Y, 42}, {{0, 0}, EV_SYN, SYN_REPORT, 0} - }; - - // Setup and discard a press. - dev->ConfigureReadMock(mock_kernel_queue_press, 6, 0); - dev->ReadNow(); - EXPECT_EQ(1u, dev->size()); - - dev->ConfigureReadMock(mock_kernel_queue_move1, 4, 0); - dev->ReadNow(); - EXPECT_EQ(2u, dev->size()); - ui::TouchEvent* event = dev->event(1); - EXPECT_FALSE(event == NULL); - - EXPECT_EQ(ui::ET_TOUCH_MOVED, event->type()); - EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), event->time_stamp()); - EXPECT_EQ(42, event->x()); - EXPECT_EQ(43, event->y()); - EXPECT_EQ(0, event->touch_id()); - EXPECT_FLOAT_EQ(2.f / 3.f, event->force()); - EXPECT_FLOAT_EQ(0.f, event->rotation_angle()); - - dev->ConfigureReadMock(mock_kernel_queue_move2, 2, 0); - dev->ReadNow(); - EXPECT_EQ(3u, dev->size()); - event = dev->event(2); - EXPECT_FALSE(event == NULL); - - EXPECT_EQ(ui::ET_TOUCH_MOVED, event->type()); - EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), event->time_stamp()); - EXPECT_EQ(42, event->x()); - EXPECT_EQ(42, event->y()); - EXPECT_EQ(0, event->touch_id()); - EXPECT_FLOAT_EQ(2.f / 3.f, event->force()); - EXPECT_FLOAT_EQ(0.f, event->rotation_angle()); -} - -TEST_F(TouchEventConverterOzoneTest, TouchRelease) { - ui::MockTouchEventConverterOzone* dev = device(); - - struct input_event mock_kernel_queue_press[] = { - {{0, 0}, EV_ABS, ABS_MT_TRACKING_ID, 684}, - {{0, 0}, EV_ABS, ABS_MT_TOUCH_MAJOR, 3}, - {{0, 0}, EV_ABS, ABS_MT_PRESSURE, 45}, - {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 42}, - {{0, 0}, EV_ABS, ABS_MT_POSITION_Y, 51}, {{0, 0}, EV_SYN, SYN_REPORT, 0} - }; - - struct input_event mock_kernel_queue_release[] = { - {{0, 0}, EV_ABS, ABS_MT_TRACKING_ID, -1}, {{0, 0}, EV_SYN, SYN_REPORT, 0} - }; - - // Setup and discard a press. - dev->ConfigureReadMock(mock_kernel_queue_press, 6, 0); - dev->ReadNow(); - EXPECT_EQ(1u, dev->size()); - ui::TouchEvent* event = dev->event(0); - EXPECT_FALSE(event == NULL); - - dev->ConfigureReadMock(mock_kernel_queue_release, 2, 0); - dev->ReadNow(); - EXPECT_EQ(2u, dev->size()); - event = dev->event(1); - EXPECT_FALSE(event == NULL); - - EXPECT_EQ(ui::ET_TOUCH_RELEASED, event->type()); - EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), event->time_stamp()); - EXPECT_EQ(42, event->x()); - EXPECT_EQ(51, event->y()); - EXPECT_EQ(0, event->touch_id()); - EXPECT_FLOAT_EQ(.5f, event->force()); - EXPECT_FLOAT_EQ(0.f, event->rotation_angle()); -} - -TEST_F(TouchEventConverterOzoneTest, TwoFingerGesture) { - ui::MockTouchEventConverterOzone* dev = device(); - - ui::TouchEvent* ev0; - ui::TouchEvent* ev1; - - struct input_event mock_kernel_queue_press0[] = { - {{0, 0}, EV_ABS, ABS_MT_TRACKING_ID, 684}, - {{0, 0}, EV_ABS, ABS_MT_TOUCH_MAJOR, 3}, - {{0, 0}, EV_ABS, ABS_MT_PRESSURE, 45}, - {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 42}, - {{0, 0}, EV_ABS, ABS_MT_POSITION_Y, 51}, {{0, 0}, EV_SYN, SYN_REPORT, 0} - }; - // Setup and discard a press. - dev->ConfigureReadMock(mock_kernel_queue_press0, 6, 0); - dev->ReadNow(); - EXPECT_EQ(1u, dev->size()); - - struct input_event mock_kernel_queue_move0[] = { - {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 40}, {{0, 0}, EV_SYN, SYN_REPORT, 0} - }; - // Setup and discard a move. - dev->ConfigureReadMock(mock_kernel_queue_move0, 2, 0); - dev->ReadNow(); - EXPECT_EQ(2u, dev->size()); - - struct input_event mock_kernel_queue_move0press1[] = { - {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 40}, {{0, 0}, EV_SYN, SYN_REPORT, 0}, - {{0, 0}, EV_ABS, ABS_MT_SLOT, 1}, {{0, 0}, EV_ABS, ABS_MT_TRACKING_ID, 686}, - {{0, 0}, EV_ABS, ABS_MT_TOUCH_MAJOR, 3}, - {{0, 0}, EV_ABS, ABS_MT_PRESSURE, 45}, - {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 101}, - {{0, 0}, EV_ABS, ABS_MT_POSITION_Y, 102}, {{0, 0}, EV_SYN, SYN_REPORT, 0} - }; - // Move on 0, press on 1. - dev->ConfigureReadMock(mock_kernel_queue_move0press1, 9, 0); - dev->ReadNow(); - EXPECT_EQ(4u, dev->size()); - ev0 = dev->event(2); - ev1 = dev->event(3); - - // Move - EXPECT_EQ(ui::ET_TOUCH_MOVED, ev0->type()); - EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), ev0->time_stamp()); - EXPECT_EQ(40, ev0->x()); - EXPECT_EQ(51, ev0->y()); - EXPECT_EQ(0, ev0->touch_id()); - EXPECT_FLOAT_EQ(.5f, ev0->force()); - EXPECT_FLOAT_EQ(0.f, ev0->rotation_angle()); - - // Press - EXPECT_EQ(ui::ET_TOUCH_PRESSED, ev1->type()); - EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), ev1->time_stamp()); - EXPECT_EQ(101, ev1->x()); - EXPECT_EQ(102, ev1->y()); - EXPECT_EQ(1, ev1->touch_id()); - EXPECT_FLOAT_EQ(.5f, ev1->force()); - EXPECT_FLOAT_EQ(0.f, ev1->rotation_angle()); - - // Stationary 0, Moves 1. - struct input_event mock_kernel_queue_stationary0_move1[] = { - {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 40}, {{0, 0}, EV_SYN, SYN_REPORT, 0} - }; - dev->ConfigureReadMock(mock_kernel_queue_stationary0_move1, 2, 0); - dev->ReadNow(); - EXPECT_EQ(5u, dev->size()); - ev1 = dev->event(4); - - EXPECT_EQ(ui::ET_TOUCH_MOVED, ev1->type()); - EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), ev1->time_stamp()); - EXPECT_EQ(40, ev1->x()); - EXPECT_EQ(102, ev1->y()); - EXPECT_EQ(1, ev1->touch_id()); - - EXPECT_FLOAT_EQ(.5f, ev1->force()); - EXPECT_FLOAT_EQ(0.f, ev1->rotation_angle()); - - // Move 0, stationary 1. - struct input_event mock_kernel_queue_move0_stationary1[] = { - {{0, 0}, EV_ABS, ABS_MT_SLOT, 0}, {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 39}, - {{0, 0}, EV_SYN, SYN_REPORT, 0} - }; - dev->ConfigureReadMock(mock_kernel_queue_move0_stationary1, 3, 0); - dev->ReadNow(); - EXPECT_EQ(6u, dev->size()); - ev0 = dev->event(5); - - EXPECT_EQ(ui::ET_TOUCH_MOVED, ev0->type()); - EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), ev0->time_stamp()); - EXPECT_EQ(39, ev0->x()); - EXPECT_EQ(51, ev0->y()); - EXPECT_EQ(0, ev0->touch_id()); - EXPECT_FLOAT_EQ(.5f, ev0->force()); - EXPECT_FLOAT_EQ(0.f, ev0->rotation_angle()); - - // Release 0, move 1. - struct input_event mock_kernel_queue_release0_move1[] = { - {{0, 0}, EV_ABS, ABS_MT_TRACKING_ID, -1}, {{0, 0}, EV_ABS, ABS_MT_SLOT, 1}, - {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 38}, {{0, 0}, EV_SYN, SYN_REPORT, 0} - }; - dev->ConfigureReadMock(mock_kernel_queue_release0_move1, 4, 0); - dev->ReadNow(); - EXPECT_EQ(8u, dev->size()); - ev0 = dev->event(6); - ev1 = dev->event(7); - - EXPECT_EQ(ui::ET_TOUCH_RELEASED, ev0->type()); - EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), ev0->time_stamp()); - EXPECT_EQ(39, ev0->x()); - EXPECT_EQ(51, ev0->y()); - EXPECT_EQ(0, ev0->touch_id()); - EXPECT_FLOAT_EQ(.5f, ev0->force()); - EXPECT_FLOAT_EQ(0.f, ev0->rotation_angle()); - - EXPECT_EQ(ui::ET_TOUCH_MOVED, ev1->type()); - EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), ev1->time_stamp()); - EXPECT_EQ(38, ev1->x()); - EXPECT_EQ(102, ev1->y()); - EXPECT_EQ(1, ev1->touch_id()); - EXPECT_FLOAT_EQ(.5f, ev1->force()); - EXPECT_FLOAT_EQ(0.f, ev1->rotation_angle()); - - // Release 1. - struct input_event mock_kernel_queue_release1[] = { - {{0, 0}, EV_ABS, ABS_MT_TRACKING_ID, -1}, {{0, 0}, EV_SYN, SYN_REPORT, 0}, - }; - dev->ConfigureReadMock(mock_kernel_queue_release1, 2, 0); - dev->ReadNow(); - EXPECT_EQ(9u, dev->size()); - ev1 = dev->event(8); - - EXPECT_EQ(ui::ET_TOUCH_RELEASED, ev1->type()); - EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), ev1->time_stamp()); - EXPECT_EQ(38, ev1->x()); - EXPECT_EQ(102, ev1->y()); - EXPECT_EQ(1, ev1->touch_id()); - EXPECT_FLOAT_EQ(.5f, ev1->force()); - EXPECT_FLOAT_EQ(0.f, ev1->rotation_angle()); -} diff --git a/ui/base/ozone/event_converter_ozone.cc b/ui/base/ozone/event_converter_ozone.cc deleted file mode 100644 index 95d52f8..0000000 --- a/ui/base/ozone/event_converter_ozone.cc +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/base/ozone/event_converter_ozone.h" - -#include "base/bind.h" -#include "base/message_loop/message_loop.h" -#include "base/message_loop/message_pump_ozone.h" -#include "ui/events/event.h" - -namespace { - -void DispatchEventHelper(scoped_ptr<ui::Event> key) { - base::MessagePumpOzone::Current()->Dispatch(key.get()); -} - -} // namespace - -namespace ui { - -EventConverterOzone::EventConverterOzone() { -} - -EventConverterOzone::~EventConverterOzone() { -} - -void EventConverterOzone::DispatchEvent(scoped_ptr<ui::Event> event) { - base::MessageLoop::current()->PostTask( - FROM_HERE, base::Bind(&DispatchEventHelper, base::Passed(&event))); -} - -} // namespace ui diff --git a/ui/base/ozone/event_converter_ozone.h b/ui/base/ozone/event_converter_ozone.h deleted file mode 100644 index 58db836..0000000 --- a/ui/base/ozone/event_converter_ozone.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_BASE_OZONE_EVENT_CONVERTER_OZONE_H_ -#define UI_BASE_OZONE_EVENT_CONVERTER_OZONE_H_ - -#include "base/memory/scoped_ptr.h" -#include "base/message_loop/message_pump_libevent.h" - -namespace ui { -class Event; - -// In ozone, Chrome reads events from file descriptors created from Linux device -// drivers. The |MessagePumpLibevent::Watcher| parent class provides the -// functionality to watch a file descriptor for the arrival of new data and -// notify its subclasses. Device-specific event converters turn bytes read from -// the file descriptor into |ui::Event| instances. This class provides the -// functionality needed in common across all converters: dispatching the -// |ui::Event| to aura. -class EventConverterOzone : public base::MessagePumpLibevent::Watcher { - public: - EventConverterOzone(); - virtual ~EventConverterOzone(); - - protected: - // Subclasses should use this method to post a task that will dispatch - // |event| from the UI message loop. This method takes ownership of - // |event|. |event| will be deleted at the end of the posted task. - void DispatchEvent(scoped_ptr<ui::Event> event); - - private: - DISALLOW_COPY_AND_ASSIGN(EventConverterOzone); -}; - -} // namespace ui - -#endif // UI_BASE_OZONE_EVENT_CONVERTER_OZONE_H_ diff --git a/ui/base/ozone/event_factory_delegate_ozone.h b/ui/base/ozone/event_factory_delegate_ozone.h deleted file mode 100644 index 04d427d..0000000 --- a/ui/base/ozone/event_factory_delegate_ozone.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_BASE_OZONE_EVENT_FACTORY_DELEGATE_OZONE_H_ -#define UI_BASE_OZONE_EVENT_FACTORY_DELEGATE_OZONE_H_ - -namespace ui { -class Event; -class EventFactoryOzone; - -// An embedder can install an instance of this interface to take control of -// what |EventConverterOzone| objects get created on the creation of -// the |RootWindowHostOzone| object. -class UI_EXPORT EventFactoryDelegateOzone { - public: - EventFactoryDelegateOzone(); - virtual ~EventFactoryDelegateOzone(); - - // Override this method with embedder-appropriate converter creation. - virtual void CreateStartupEventConverters(EventFactoryOzone* factory) = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(EventFactoryDelegateOzone); -}; - -} // namespace ui - -#endif // UI_BASE_OZONE_EVENT_FACTORY_DELEGATE_OZONE_H_ diff --git a/ui/base/ozone/event_factory_ozone.cc b/ui/base/ozone/event_factory_ozone.cc deleted file mode 100644 index d008047..0000000 --- a/ui/base/ozone/event_factory_ozone.cc +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/base/ozone/event_factory_ozone.h" - -#include <errno.h> -#include <fcntl.h> -#include <linux/input.h> -#include <poll.h> -#include <unistd.h> - -#include "base/message_loop/message_pump_ozone.h" -#include "base/stl_util.h" -#include "base/strings/stringprintf.h" -#include "ui/base/ozone/evdev/key_event_converter_ozone.h" -#include "ui/base/ozone/evdev/touch_event_converter_ozone.h" -#include "ui/base/ozone/event_factory_delegate_ozone.h" - -namespace ui { - -// static -EventFactoryDelegateOzone* EventFactoryOzone::delegate_ = NULL; - -EventFactoryOzone::EventFactoryOzone() {} - -EventFactoryOzone::~EventFactoryOzone() { - // Always delete watchers before converters to prevent a possible race. - STLDeleteValues<std::map<int, FDWatcher> >(&watchers_); - STLDeleteValues<std::map<int, Converter> >(&converters_); -} - -void EventFactoryOzone::CreateStartupEventConverters() { - if (delegate_) { - delegate_->CreateStartupEventConverters(this); - return; - } - - // If there is no |delegate_| set, read events from /dev/input/* - - // The number of devices in the directory is unknown without reading - // the contents of the directory. Further, with hot-plugging, the entries - // might decrease during the execution of this loop. So exciting from the - // loop on the first failure of open below is both cheaper and more - // reliable. - for (int id = 0; true; id++) { - std::string path = base::StringPrintf("/dev/input/event%d", id); - int fd = open(path.c_str(), O_RDONLY | O_NONBLOCK); - if (fd < 0) { - DLOG(ERROR) << "Cannot open '" << path << "': " << strerror(errno); - break; - } - size_t evtype = 0; - COMPILE_ASSERT(sizeof(evtype) * 8 >= EV_MAX, evtype_wide_enough); - if (ioctl(fd, EVIOCGBIT(0, sizeof(evtype)), &evtype) == -1) { - DLOG(ERROR) << "failed ioctl EVIOCGBIT 0" << path; - close(fd); - continue; - } - - scoped_ptr<EventConverterOzone> converter; - // TODO(rjkroege) Add more device types. Support hot-plugging. - if (evtype & (1 << EV_ABS)) - converter.reset(new TouchEventConverterOzone(fd, id)); - else if (evtype & (1 << EV_KEY)) - converter.reset(new KeyEventConverterOzone()); - - if (converter) { - AddEventConverter(fd, converter.Pass()); - } else { - close(fd); - } - } -} - -void EventFactoryOzone::SetEventFactoryDelegateOzone( - EventFactoryDelegateOzone* delegate) { - // It should be unnecessary to call this more than once. - DCHECK(!delegate_); - delegate_ = delegate; -} - -void EventFactoryOzone::AddEventConverter( - int fd, - scoped_ptr<EventConverterOzone> converter) { - CHECK(watchers_.count(fd) == 0 && converters_.count(fd) == 0); - - FDWatcher watcher = new base::MessagePumpLibevent::FileDescriptorWatcher(); - - base::MessagePumpOzone::Current()->WatchFileDescriptor( - fd, - true, - base::MessagePumpLibevent::WATCH_READ, - watcher, - converter.get()); - - converters_[fd] = converter.release(); - watchers_[fd] = watcher; -} - -void EventFactoryOzone::RemoveEventConverter(int fd) { - // Always delete watchers before converters to prevent a possible race. - delete watchers_[fd]; - delete converters_[fd]; - watchers_.erase(fd); - converters_.erase(fd); -} - -} // namespace ui diff --git a/ui/base/ozone/event_factory_ozone.h b/ui/base/ozone/event_factory_ozone.h deleted file mode 100644 index b88654e..0000000 --- a/ui/base/ozone/event_factory_ozone.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_BASE_OZONE_EVENT_FACTORY_OZONE_H_ -#define UI_BASE_OZONE_EVENT_FACTORY_OZONE_H_ - -#include <map> - -#include "base/memory/scoped_ptr.h" -#include "base/message_loop/message_pump_libevent.h" -#include "ui/base/ozone/event_converter_ozone.h" -#include "ui/base/ui_export.h" - -namespace ui { - -class EventFactoryDelegateOzone; - -// Creates and dispatches |ui.Event|'s. Ozone assumes that events arrive on file -// descriptors with one |EventConverterOzone| instance for each descriptor. -// Ozone presumes that the set of file desctiprtors can vary at runtime so this -// class supports dynamically adding and removing |EventConverterOzone| -// instances as necessary. -class UI_EXPORT EventFactoryOzone { - public: - EventFactoryOzone(); - ~EventFactoryOzone(); - - // Sets an optional delegate responsible for creating the starting set of - // EventConvertOzones under management. This permits embedders to override the - // Linux /dev/input/*-based default as desired. The caller must manage the - // scope of this object. - static void SetEventFactoryDelegateOzone(EventFactoryDelegateOzone* delegate); - - // Called from RootWindowHostOzone to create the starting set of event - // converters. - void CreateStartupEventConverters(); - - // Add an |EventConverterOzone| instances for the given file descriptor. - // Transfers ownership of the |EventConverterOzone| to this class. - void AddEventConverter(int fd, scoped_ptr<EventConverterOzone> converter); - - // Remote the |EventConverterOzone| - void RemoveEventConverter(int fd); - - private: - // |EventConverterOzone| for each file descriptor. - typedef EventConverterOzone* Converter; - typedef base::MessagePumpLibevent::FileDescriptorWatcher* FDWatcher; - std::map<int, Converter> converters_; - std::map<int, FDWatcher> watchers_; - - static EventFactoryDelegateOzone* delegate_; - - DISALLOW_COPY_AND_ASSIGN(EventFactoryOzone); -}; - -} // namespace ui - -#endif // UI_BASE_OZONE_EVENT_FACTORY_OZONE_H_ diff --git a/ui/base/ozone/events_ozone.cc b/ui/base/ozone/events_ozone.cc deleted file mode 100644 index 0db40f4..0000000 --- a/ui/base/ozone/events_ozone.cc +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/events/event.h" -#include "ui/events/event_constants.h" -#include "ui/events/event_utils.h" - -namespace ui { - -void UpdateDeviceList() { NOTIMPLEMENTED(); } - -base::TimeDelta EventTimeFromNative(const base::NativeEvent& native_event) { - const ui::Event* event = static_cast<const ui::Event*>(native_event); - return event->time_stamp(); -} - -int EventFlagsFromNative(const base::NativeEvent& native_event) { - const ui::Event* event = static_cast<const ui::Event*>(native_event); - return event->flags(); -} - -EventType EventTypeFromNative(const base::NativeEvent& native_event) { - const ui::Event* event = static_cast<const ui::Event*>(native_event); - return event->type(); -} - -gfx::Point EventSystemLocationFromNative( - const base::NativeEvent& native_event) { - const ui::LocatedEvent* e = - static_cast<const ui::LocatedEvent*>(native_event); - DCHECK(e->IsMouseEvent() || e->IsTouchEvent() || e->IsGestureEvent() || - e->IsScrollEvent()); - return e->location(); -} - -gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) { - return EventSystemLocationFromNative(native_event); -} - -int GetChangedMouseButtonFlagsFromNative( - const base::NativeEvent& native_event) { - const ui::MouseEvent* event = - static_cast<const ui::MouseEvent*>(native_event); - DCHECK(event->IsMouseEvent()); - return event->changed_button_flags(); -} - -KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { - const ui::KeyEvent* event = static_cast<const ui::KeyEvent*>(native_event); - DCHECK(event->IsKeyEvent()); - return event->key_code(); -} - -bool IsMouseEvent(const base::NativeEvent& native_event) { - const ui::Event* e = static_cast<const ui::Event*>(native_event); - return e->IsMouseEvent(); -} - -gfx::Vector2d GetMouseWheelOffset(const base::NativeEvent& native_event) { - const ui::MouseWheelEvent* event = - static_cast<const ui::MouseWheelEvent*>(native_event); - DCHECK(event->type() == ET_MOUSEWHEEL); - return event->offset(); -} - -void ClearTouchIdIfReleased(const base::NativeEvent& xev) { -} - -int GetTouchId(const base::NativeEvent& native_event) { - const ui::TouchEvent* event = - static_cast<const ui::TouchEvent*>(native_event); - DCHECK(event->IsTouchEvent()); - return event->touch_id(); -} - -float GetTouchRadiusX(const base::NativeEvent& native_event) { - const ui::TouchEvent* event = - static_cast<const ui::TouchEvent*>(native_event); - DCHECK(event->IsTouchEvent()); - return event->radius_x(); -} - -float GetTouchRadiusY(const base::NativeEvent& native_event) { - const ui::TouchEvent* event = - static_cast<const ui::TouchEvent*>(native_event); - DCHECK(event->IsTouchEvent()); - return event->radius_y(); -} - -float GetTouchAngle(const base::NativeEvent& native_event) { - const ui::TouchEvent* event = - static_cast<const ui::TouchEvent*>(native_event); - DCHECK(event->IsTouchEvent()); - return event->rotation_angle(); -} - -float GetTouchForce(const base::NativeEvent& native_event) { - const ui::TouchEvent* event = - static_cast<const ui::TouchEvent*>(native_event); - DCHECK(event->IsTouchEvent()); - return event->force(); -} - -bool GetScrollOffsets(const base::NativeEvent& native_event, - float* x_offset, - float* y_offset, - float* x_offset_ordinal, - float* y_offset_ordinal, - int* finger_count) { - NOTIMPLEMENTED(); - return false; -} - -bool GetFlingData(const base::NativeEvent& native_event, - float* vx, - float* vy, - float* vx_ordinal, - float* vy_ordinal, - bool* is_cancel) { - NOTIMPLEMENTED(); - return false; -} - -bool GetGestureTimes(const base::NativeEvent& native_event, - double* start_time, - double* end_time) { - *start_time = 0; - *end_time = 0; - return false; -} - -void SetNaturalScroll(bool /* enabled */) { NOTIMPLEMENTED(); } - -bool IsNaturalScrollEnabled() { return false; } - -bool IsTouchpadEvent(const base::NativeEvent& event) { - NOTIMPLEMENTED(); - return false; -} - -bool IsNoopEvent(const base::NativeEvent& event) { - NOTIMPLEMENTED(); - return false; -} - -base::NativeEvent CreateNoopEvent() { - NOTIMPLEMENTED(); - return NULL; -} - -int GetModifiersFromKeyState() { - NOTIMPLEMENTED(); - return 0; -} - -} // namespace ui |