chiark / gitweb /
Offsets: Introduce cfg->pad_xmin and ymin, and cap_get_xmin, ymin
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 23 Apr 2016 22:17:51 +0000 (23:17 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 26 Apr 2016 19:42:32 +0000 (20:42 +0100)
These are going to be needed to cope properly with pads whose origins
are not at (0,0).

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
include/capabilities.h
include/mconfig.h
src/capabilities.c
src/mconfig.c

index 65777d3..69affb4 100644 (file)
@@ -44,6 +44,9 @@ int get_cap_wsize(const struct Capabilities *cap);
 int get_cap_xmid(const struct Capabilities *cap);
 int get_cap_ymid(const struct Capabilities *cap);
 
+int get_cap_xmin(const struct Capabilities *cap);
+int get_cap_ymin(const struct Capabilities *cap);
+
 int get_cap_xflip(const struct Capabilities *cap, int x);
 int get_cap_yflip(const struct Capabilities *cap, int y);
 
index 2c3c86f..e14d53c 100644 (file)
@@ -97,6 +97,8 @@ struct MConfig {
        int touch_max;          // Maximum touch value.
        int pad_width;          // Width of the touchpad.
        int pad_height;         // Height of the touchpad.
+       int pad_xmin;           // Minimum x coordinate.
+       int pad_ymin;           // Minimum y coordinate.
 
        // Set by config.
        int touch_down;         // When is a finger touching? 0 - 100 (percentage)
index 310ee0b..d95de60 100644 (file)
@@ -151,6 +151,18 @@ int get_cap_ymid(const struct Capabilities *cap)
        return (y->maximum + y->minimum) >> 1;
 }
 
+int get_cap_xmin(const struct Capabilities *cap)
+{
+       const struct input_absinfo *x = &cap->abs[MTDEV_POSITION_X];
+       return x->minimum;
+}
+
+int get_cap_ymin(const struct Capabilities *cap)
+{
+       const struct input_absinfo *y = &cap->abs[MTDEV_POSITION_Y];
+       return y->minimum;
+}
+
 int get_cap_xflip(const struct Capabilities *cap, int x)
 {
        const struct input_absinfo *i = &cap->abs[MTDEV_POSITION_X];
index 761b9a1..b68c63c 100644 (file)
@@ -86,6 +86,8 @@ void mconfig_init(struct MConfig* cfg,
        cfg->touch_minor = caps->has_abs[MTDEV_TOUCH_MINOR];
        cfg->pad_width = get_cap_xsize(caps);
        cfg->pad_height = get_cap_ysize(caps);
+       cfg->pad_xmin = get_cap_xmin(caps);
+       cfg->pad_ymin = get_cap_ymin(caps);
        
        if (caps->has_abs[MTDEV_TOUCH_MAJOR] && caps->has_abs[MTDEV_WIDTH_MAJOR]) {
                cfg->touch_type = MCFG_SCALE;