From: Ian Jackson Date: Sat, 23 Apr 2016 19:26:53 +0000 (+0100) Subject: Button zones: Export bottom_edge_zones in MTRACK_PROP_BUTTON_EMULATE_SETTINGS X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=xf86-input-mtrack.git;a=commitdiff_plain;h=70cf2dcd96a95258c646573c3ed0cd14bdb8096e;hp=898a7d315ac511bbdc3c1d424cb7ae23e71bc191 Button zones: Export bottom_edge_zones in MTRACK_PROP_BUTTON_EMULATE_SETTINGS For backward compatibility this property can now be either 3 or 4 items. When we generate it, we generate 4 items, but we accept setting only 3 items. Signed-off-by: Ian Jackson --- diff --git a/driver/mprops.c b/driver/mprops.c index 3ded861..59bc993 100644 --- a/driver/mprops.c +++ b/driver/mprops.c @@ -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 } } diff --git a/include/mprops.h b/include/mprops.h index 6672741..236dc8a 100644 --- a/include/mprops.h +++ b/include/mprops.h @@ -44,7 +44,7 @@ #define MTRACK_PROP_PRESSURE "Trackpad Touch Pressure" // int, 2 values - enable buttons, has integrated button #define MTRACK_PROP_BUTTON_SETTINGS "Trackpad Button Settings" -// int, 3 values - enable button zones, button move emulation, emulation touch expiration +// int, 3-4 values - enable button zones, button move emulation, emulation touch expiration[, enable bottom edge zones] #define MTRACK_PROP_BUTTON_EMULATE_SETTINGS "Trackpad Button Emulation Settings" // int, 3 values - button to emulate with 1 touch, 2 touches, 3 touches #define MTRACK_PROP_BUTTON_EMULATE_VALUES "Trackpad Button Emulation Values"