chiark / gitweb /
Button zones: Export bottom_edge_zones in MTRACK_PROP_BUTTON_EMULATE_SETTINGS
[xf86-input-mtrack.git] / driver / mprops.c
index 3ded861f3255058efc70213873860325f1815f15..59bc993dd369fd90a099039bfb9cee4f0900fc62 100644 (file)
@@ -105,7 +105,8 @@ void mprops_init(struct MConfig* cfg, InputInfoPtr local) {
        ivals[0] = cfg->button_zones;
        ivals[1] = cfg->button_move;
        ivals[2] = cfg->button_expire;
-       mprops.button_emulate_settings = atom_init_integer(local->dev, MTRACK_PROP_BUTTON_EMULATE_SETTINGS, 3, ivals, 16);
+       ivals[3] = cfg->bottom_edge_zones;
+       mprops.button_emulate_settings = atom_init_integer(local->dev, MTRACK_PROP_BUTTON_EMULATE_SETTINGS, 4, ivals, 16);
 
        ivals[0] = cfg->button_1touch;
        ivals[1] = cfg->button_2touch;
@@ -271,20 +272,27 @@ int mprops_set_property(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop
                }
        }
        else if (property == mprops.button_emulate_settings) {
-               if (prop->size != 3 || prop->format != 16 || prop->type != XA_INTEGER)
+               if (prop->size < 3 || prop->size > 4 || prop->format != 16 || prop->type != XA_INTEGER)
                        return BadMatch;
 
                ivals16 = (uint16_t*)prop->data;
                if (!VALID_BOOL(ivals16[0]) || !VALID_BOOL(ivals16[1]) || ivals16[2] < 0)
                        return BadMatch;
 
+               if (prop->size >= 4) {
+                       if (!VALID_BOOL(ivals16[3]))
+                               return BadMatch;
+               }
+
                if (!checkonly) {
                        cfg->button_zones = ivals16[0];
                        cfg->button_move = ivals16[1];
                        cfg->button_expire = ivals16[2];
+                       if (prop->size >= 4)
+                               cfg->bottom_edge_zones = ivals16[3];
 #ifdef DEBUG_PROPS
-                       xf86Msg(X_INFO, "mtrack: set button emulate settings to %d %d %d\n",
-                               cfg->button_zones, cfg->button_move, cfg->button_expire);
+                       xf86Msg(X_INFO, "mtrack: set button emulate settings to %d %d %d %d\n",
+                               cfg->button_zones, cfg->button_move, cfg->button_expire, cfg->bottom_edge_zones);
 #endif
                }
        }