#ifndef SHM_0_14_4
#define SHM_0_14_4

#include <X11/Xdefs.h>  // Bool
#include <stddef.h>     // offsetof

// scroll button repeat (min/max)
#define SBR_MIN 10
#define SBR_MAX 1000

// max number of mouse buttons
#define SYN_MAX_BUTTONS 12

typedef enum {
    RT_TAP = 0,                             /* Right top corner */
    RB_TAP,                                 /* Right bottom corner */
    LT_TAP,                                 /* Left top corner */
    LB_TAP,                                 /* Left bottom corner */
    F1_TAP,                                 /* Non-corner tap, one finger */
    F2_TAP,                                 /* Non-corner tap, two fingers */
    F3_TAP,                                 /* Non-corner tap, three fingers */
    MAX_TAP
} TapEvent;


typedef struct {
    unsigned int model_id;                  /* Model-ID */
    unsigned int capabilities;              /* Capabilities */
    unsigned int ext_cap;                   /* Extended Capabilities */
    unsigned int identity;                  /* Identification */
    Bool hasGuest;                          /* Has a guest mouse */
} SynapticsHwInfo;


typedef struct
{
    int version;                            /* Driver version */

    /* Current device state */
    int x, y;                               /* actual x, y coordinates */
    int z;                                  /* pressure value */
    int numFingers;                         /* number of fingers */
    int fingerWidth;                        /* finger width value */
    int left, right, up, down;              /* left/right/up/down buttons */
    Bool multi[8];
    Bool middle;
    int guest_left, guest_mid, guest_right; /* guest device buttons */
    int guest_dx, guest_dy;                 /* guest device movement */

    /* Probed hardware properties */
    SynapticsHwInfo synhw;

    /* Parameter data */
    int left_edge, right_edge, top_edge, bottom_edge; /* edge coordinates absolute */
    int finger_low, finger_high;            /* finger detection values in Z-values */
    int tap_time;
    int tap_move;                           /* max. tapping time and movement in packets and coord. */
    int tap_time_2;                         /* max. tapping time for double taps */
    int click_time;                         /* The duration of a single click */
    Bool fast_taps;                         /* Faster reaction to single taps */
    int emulate_mid_button_time;            /* Max time between left and right button presses to
                                               emulate a middle button press. */
    int scroll_dist_vert;                   /* Scrolling distance in absolute coordinates */
    int scroll_dist_horiz;                  /* Scrolling distance in absolute coordinates */
    double min_speed, max_speed, accl;      /* movement parameters */
    int edge_motion_min_z;                  /* finger pressure at which minimum edge motion speed is set */
    int edge_motion_max_z;                  /* finger pressure at which maximum edge motion speed is set */
    int edge_motion_min_speed;              /* slowest setting for edge motion speed */
    int edge_motion_max_speed;              /* fastest setting for edge motion speed */
    Bool edge_motion_use_always;            /* If false, egde motion is used only when dragging */

    Bool updown_button_scrolling;           /* Up/Down-Button scrolling or middle/double-click */
    Bool leftright_button_scrolling;        /* Left/right-button scrolling, or two lots of middle button */
    Bool updown_button_repeat;              /* If up/down button being used to scroll, auto-repeat?*/
    Bool leftright_button_repeat;           /* If left/right button being used to scroll, auto-repeat? */
    int scroll_button_repeat;               /* time, in milliseconds, between scroll events being
                                             * sent when holding down scroll buttons */
    int touchpad_off;                       /* Switches the touchpad off
                                             * 0 : Not off
                                             * 1 : Off
                                             * 2 : Only tapping and scrolling off
                                             */
    Bool guestmouse_off;                    /* Switches the guest mouse off */
    Bool locked_drags;                      /* Enable locked drags */
    int tap_action[MAX_TAP];                /* Button to report on tap events */
    Bool circular_scrolling;                /* Enable circular scrolling */
    double scroll_dist_circ;                /* Scrolling angle radians */
    int circular_trigger;                   /* Trigger area for circular scrolling */
    Bool circular_pad;                      /* Edge has an oval or circular shape */
    Bool palm_detect;                       /* Enable Palm Detection */
    int palm_min_width;                     /* Palm detection width */
    int palm_min_z;                         /* Palm detection depth */
    double coasting_speed;                  /* Coasting threshold scrolling speed */
} ShmSegment_0_14_4;


#endif
