From 3430546f6ca1846636f79efda49f4fdf3cc480b6 Mon Sep 17 00:00:00 2001
From: Greg Alexander <gitgreg@galexander.org>
Date: Thu, 28 Feb 2013 09:00:46 -0500
Subject: [PATCH 2/3] added Bottom Edge to the X input properties

---
 driver/mprops.c  |   19 +++++++++++++++++++
 include/mprops.h |    3 +++
 2 files changed, 22 insertions(+)

diff --git a/driver/mprops.c b/driver/mprops.c
index 3ded861..2592835 100644
--- a/driver/mprops.c
+++ b/driver/mprops.c
@@ -192,6 +192,9 @@ void mprops_init(struct MConfig* cfg, InputInfoPtr local) {
 	ivals[0] = cfg->axis_x_invert;
 	ivals[1] = cfg->axis_y_invert;
 	mprops.axis_invert = atom_init_integer(local->dev, MTRACK_PROP_AXIS_INVERT, 2, ivals, 8);
+
+	ivals[0] = cfg->bottom_edge;
+	mprops.bottom_edge = atom_init_integer(local->dev, MTRACK_PROP_BOTTOM_EDGE, 1, ivals, 8);
 }
 
 int mprops_set_property(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, BOOL checkonly) {
@@ -634,6 +637,22 @@ int mprops_set_property(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop
 #endif
 		}
 	}
+	else if (property == mprops.bottom_edge) {
+		if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
+			return BadMatch;
+
+		ivals8 = (uint8_t*)prop->data;
+		if (!VALID_PCNT(ivals8[0]))
+			return BadMatch;
+
+		if (!checkonly) {
+			cfg->bottom_edge = ivals8[0];
+#ifdef DEBUG_PROPS
+			xf86Msg(X_INFO, "mtrack: set bottom edge to %d\n",
+				cfg->bottom_edge);
+#endif
+		}
+	}
 
 	return Success;
 }
diff --git a/include/mprops.h b/include/mprops.h
index 6672741..587b220 100644
--- a/include/mprops.h
+++ b/include/mprops.h
@@ -86,6 +86,8 @@
 #define MTRACK_PROP_DRAG_SETTINGS "Trackpad Drag Settings"
 // int, 2 values - invert x axis, invert y axis
 #define MTRACK_PROP_AXIS_INVERT "Trackpad Axis Inversion"
+// int, 1 value - size of edge region that is ignored
+#define MTRACK_PROP_BOTTOM_EDGE "Bottom Edge"
 
 struct MProps {
 	// Properties Config
@@ -118,6 +120,7 @@ struct MProps {
 	Atom rotate_buttons;
 	Atom drag_settings;
 	Atom axis_invert;
+	Atom bottom_edge;
 };
 
 void mprops_init(struct MConfig* cfg, InputInfoPtr local);
-- 
1.7.10.4

