Skip to content

Commit

Permalink
Tap drag lock timeout: make value configureable by users
Browse files Browse the repository at this point in the history
  • Loading branch information
p2rkw committed Jan 21, 2018
1 parent da1adc9 commit cbbbec0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
13 changes: 8 additions & 5 deletions driver/mprops.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# define LOG_DEBUG_PROPS LOG_DISABLED
#endif

#define MAX_INT_VALUES 4
#define MAX_INT_VALUES 5
#define MAX_FLOAT_VALUES 4
#define MAX_BUTTON_VALUES 6

Expand Down Expand Up @@ -253,7 +253,8 @@ void mprops_init(struct MConfig* cfg, InputInfoPtr local) {
ivals[1] = cfg->drag_timeout;
ivals[2] = cfg->drag_wait;
ivals[3] = cfg->drag_dist;
mprops.drag_settings = atom_init_integer(local->dev, MTRACK_PROP_DRAG_SETTINGS, 4, ivals, 32);
ivals[4] = cfg->drag_lock_timeout;
mprops.drag_settings = atom_init_integer(local->dev, MTRACK_PROP_DRAG_SETTINGS, 5, ivals, 32);

ivals[0] = cfg->axis_x_invert;
ivals[1] = cfg->axis_y_invert;
Expand Down Expand Up @@ -704,7 +705,7 @@ int mprops_set_property(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop
}
#endif
else if (property == mprops.drag_settings) {
if (prop->size != 4 || prop->format != 32 || prop->type != XA_INTEGER)
if (prop->size != 5 || prop->format != 32 || prop->type != XA_INTEGER)
return BadMatch;

ivals32 = (uint32_t*)prop->data;
Expand All @@ -716,8 +717,10 @@ int mprops_set_property(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop
cfg->drag_timeout = ivals32[1];
cfg->drag_wait = ivals32[2];
cfg->drag_dist = ivals32[3];
LOG_DEBUG_PROPS("set drag settings to %d %d %d %d\n",
cfg->drag_enable, cfg->drag_timeout, cfg->drag_wait, cfg->drag_dist);
cfg->drag_lock_timeout = ivals32[4];

LOG_DEBUG_PROPS("set drag settings to %d %d %d %d %d\n",
cfg->drag_enable, cfg->drag_timeout, cfg->drag_wait, cfg->drag_dist, cfg->drag_lock_timeout);
}
}
else if (property == mprops.axis_invert) {
Expand Down
1 change: 1 addition & 0 deletions include/mconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
#define DEFAULT_DRAG_TIMEOUT 350
#define DEFAULT_DRAG_WAIT 40
#define DEFAULT_DRAG_DIST 200
#define DEFAULT_DRAG_LOCK_TIMEOUT 500
#define DEFAULT_AXIS_X_INVERT 0
#define DEFAULT_AXIS_Y_INVERT 0
#define DEFAULT_SENSITIVITY 1.0
Expand Down
2 changes: 1 addition & 1 deletion include/mprops.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
// int, 4 values - up button, down button, left button, right button
#define MTRACK_PROP_HOLD1_MOVE3_BUTTONS "Trackpad Hold1Move3 Buttons"

// int, 4 values - enable, timeout, wait, dist
// int, 5 values - enable, timeout, wait, dist, lock timeout
#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"
Expand Down
2 changes: 2 additions & 0 deletions src/mconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ void mconfig_configure(struct MConfig* cfg,
cfg->drag_timeout = MAXVAL(xf86SetIntOption(opts, "TapDragTime", DEFAULT_DRAG_TIMEOUT), 1);
cfg->drag_wait = MAXVAL(xf86SetIntOption(opts, "TapDragWait", DEFAULT_DRAG_WAIT), 0);
cfg->drag_dist = MAXVAL(xf86SetIntOption(opts, "TapDragDist", DEFAULT_DRAG_DIST), 0);
cfg->drag_lock_timeout = xf86SetIntOption(opts, "TapDragLockTimeout", DEFAULT_DRAG_LOCK_TIMEOUT);

cfg->axis_x_invert = xf86SetBoolOption(opts, "AxisXInvert", DEFAULT_AXIS_X_INVERT);
cfg->axis_y_invert = xf86SetBoolOption(opts, "AxisYInvert", DEFAULT_AXIS_Y_INVERT);
cfg->sensitivity = MAXVAL(xf86SetRealOption(opts, "Sensitivity", DEFAULT_SENSITIVITY), 0);
Expand Down

0 comments on commit cbbbec0

Please sign in to comment.