Change axis events to carry all directions
[platform/upstream/libinput.git] / src / evdev-mt-touchpad.h
index cc04dc9..5807f08 100644 (file)
@@ -42,6 +42,15 @@ enum touchpad_event {
        TOUCHPAD_EVENT_BUTTON_RELEASE   = (1 << 2),
 };
 
+enum touchpad_model {
+       MODEL_UNKNOWN = 0,
+       MODEL_SYNAPTICS,
+       MODEL_ALPS,
+       MODEL_APPLETOUCH,
+       MODEL_ELANTECH,
+       MODEL_UNIBODY_MACBOOK
+};
+
 enum touch_state {
        TOUCH_NONE = 0,
        TOUCH_BEGIN,
@@ -94,6 +103,25 @@ enum tp_tap_touch_state {
        TAP_TOUCH_STATE_DEAD,           /**< exceeded motion/timeout */
 };
 
+/* For edge scrolling, so we only care about right and bottom */
+enum tp_edge {
+       EDGE_NONE = 0,
+       EDGE_RIGHT = (1 << 0),
+       EDGE_BOTTOM = (1 << 1),
+};
+
+enum tp_edge_scroll_touch_state {
+       EDGE_SCROLL_TOUCH_STATE_NONE,
+       EDGE_SCROLL_TOUCH_STATE_EDGE_NEW,
+       EDGE_SCROLL_TOUCH_STATE_EDGE,
+       EDGE_SCROLL_TOUCH_STATE_AREA,
+};
+
+enum tp_twofinger_scroll_state {
+       TWOFINGER_SCROLL_STATE_NONE,
+       TWOFINGER_SCROLL_STATE_ACTIVE,
+};
+
 struct tp_motion {
        int32_t x;
        int32_t y;
@@ -142,6 +170,14 @@ struct tp_touch {
        } tap;
 
        struct {
+               enum tp_edge_scroll_touch_state edge_state;
+               uint32_t edge;
+               int direction;
+               double threshold;
+               struct libinput_timer timer;
+       } scroll;
+
+       struct {
                bool is_palm;
                int32_t x, y;  /* first coordinates if is_palm == true */
                uint32_t time; /* first timestamp if is_palm == true */
@@ -156,6 +192,7 @@ struct tp_dispatch {
        unsigned int slot;                      /* current slot */
        bool has_mt;
        bool semi_mt;
+       enum touchpad_model model;
 
        unsigned int real_touches;              /* number of slots */
        unsigned int ntouches;                  /* no slots inc. fakes */
@@ -202,8 +239,11 @@ struct tp_dispatch {
        } buttons;                              /* physical buttons */
 
        struct {
-               struct libinput_device_config_natural_scroll config;
-               bool natural_scrolling_enabled;
+               struct libinput_device_config_scroll_method config_method;
+               enum libinput_config_scroll_method method;
+               int32_t right_edge;
+               int32_t bottom_edge;
+               enum tp_twofinger_scroll_state twofinger_state;
        } scroll;
 
        enum touchpad_event queued;
@@ -225,6 +265,9 @@ struct tp_dispatch {
        struct {
                struct libinput_device_config_send_events config;
                enum libinput_config_send_events_mode current_mode;
+               bool trackpoint_active;
+               struct libinput_event_listener trackpoint_listener;
+               struct libinput_timer trackpoint_timer;
        } sendevents;
 };
 
@@ -237,6 +280,12 @@ tp_get_delta(struct tp_touch *t, double *dx, double *dy);
 void
 tp_set_pointer(struct tp_dispatch *tp, struct tp_touch *t);
 
+void
+tp_filter_motion(struct tp_dispatch *tp,
+                double *dx, double *dy,
+                double *dx_unaccel, double *dy_unaccel,
+                uint64_t time);
+
 int
 tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time);
 
@@ -244,7 +293,7 @@ int
 tp_init_tap(struct tp_dispatch *tp);
 
 void
-tp_destroy_tap(struct tp_dispatch *tp);
+tp_remove_tap(struct tp_dispatch *tp);
 
 int
 tp_init_buttons(struct tp_dispatch *tp, struct evdev_device *device);
@@ -255,7 +304,7 @@ tp_init_softbuttons(struct tp_dispatch *tp,
                    double topbutton_size_mult);
 
 void
-tp_destroy_buttons(struct tp_dispatch *tp);
+tp_remove_buttons(struct tp_dispatch *tp);
 
 int
 tp_process_button(struct tp_dispatch *tp,
@@ -288,4 +337,25 @@ tp_tap_suspend(struct tp_dispatch *tp, uint64_t time);
 void
 tp_tap_resume(struct tp_dispatch *tp, uint64_t time);
 
+bool
+tp_tap_dragging(struct tp_dispatch *tp);
+
+int
+tp_edge_scroll_init(struct tp_dispatch *tp, struct evdev_device *device);
+
+void
+tp_remove_edge_scroll(struct tp_dispatch *tp);
+
+void
+tp_edge_scroll_handle_state(struct tp_dispatch *tp, uint64_t time);
+
+int
+tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time);
+
+void
+tp_edge_scroll_stop_events(struct tp_dispatch *tp, uint64_t time);
+
+int
+tp_edge_scroll_touch_active(struct tp_dispatch *tp, struct tp_touch *t);
+
 #endif