#ifndef UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_
#define UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_
#include <bitset>
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/message_loop/message_pump_libevent.h"
#include "ui/events/event_constants.h"
#include "ui/events/events_export.h"
#include "ui/events/ozone/evdev/event_converter_evdev.h"
#include "ui/events/ozone/evdev/event_device_info.h"
namespace ui {
class TouchEvent;
class EVENTS_EXPORT TouchEventConverterEvdev
: public EventConverterEvdev,
base::MessagePumpLibevent::Watcher {
public:
enum {
MAX_FINGERS = 11
};
TouchEventConverterEvdev(int fd,
base::FilePath path,
const EventDeviceInfo& info);
virtual ~TouchEventConverterEvdev();
virtual void Start() OVERRIDE;
virtual void Stop() OVERRIDE;
private:
friend class MockTouchEventConverterEvdev;
void Init();
virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;
int pressure_min_;
int pressure_max_;
float x_scale_;
float y_scale_;
int x_min_;
int x_max_;
int y_min_;
int y_max_;
int current_slot_;
int fd_;
base::FilePath path_;
std::bitset<MAX_FINGERS> altered_slots_;
struct InProgressEvents {
int x_;
int y_;
int id_;
int finger_;
EventType type_;
int major_;
float pressure_;
};
InProgressEvents events_[MAX_FINGERS];
base::MessagePumpLibevent::FileDescriptorWatcher controller_;
DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdev);
};
}
#endif