summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9d745e3)
In a moment, we are going to make the in-use representation of the
sensitivity more complicated. We will need accessor methods for use
by the configuration machinery.
Provide these accessor methods now, to reduce noise in the substantive
patch. For now they just access the single double.
Rename the variable so that we catch all of the references.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
ivals[0] = cfg->trackpad_disable;
mprops.trackpad_disable = atom_init_integer(local->dev, MTRACK_PROP_TRACKPAD_DISABLE, 1, ivals, 8);
ivals[0] = cfg->trackpad_disable;
mprops.trackpad_disable = atom_init_integer(local->dev, MTRACK_PROP_TRACKPAD_DISABLE, 1, ivals, 8);
- fvals[0] = (float)cfg->sensitivity;
+ fvals[0] = (float)mconfig_get_sensitivity(cfg);
mprops.sensitivity = atom_init_float(local->dev, MTRACK_PROP_SENSITIVITY, 1, fvals, mprops.float_type);
ivals[0] = cfg->touch_down;
mprops.sensitivity = atom_init_float(local->dev, MTRACK_PROP_SENSITIVITY, 1, fvals, mprops.float_type);
ivals[0] = cfg->touch_down;
return BadMatch;
if (!checkonly) {
return BadMatch;
if (!checkonly) {
- cfg->sensitivity = fvals[0];
+ mconfig_set_sensitivity(cfg, fvals[0]);
- xf86Msg(X_INFO, "mtrack: set sensitivity to %f\n", cfg->sensitivity);
+ xf86Msg(X_INFO, "mtrack: set sensitivity to %f\n", mconfig_get_sensitivity(cfg));
int drag_timeout; // How long to wait for a move after tapping? > 0
int drag_wait; // How long to wait before triggering button down? >= 0
int drag_dist; // How far is the finger allowed to move during wait time? >= 0
int drag_timeout; // How long to wait for a move after tapping? > 0
int drag_wait; // How long to wait before triggering button down? >= 0
int drag_dist; // How far is the finger allowed to move during wait time? >= 0
- double sensitivity; // Mouse movement multiplier. >= 0
+ double sensitivity_val; // Mouse movement multiplier. >= 0
};
/* Load the MConfig struct with its defaults.
*/
void mconfig_defaults(struct MConfig* cfg);
};
/* Load the MConfig struct with its defaults.
*/
void mconfig_defaults(struct MConfig* cfg);
+/* Set and read ->sensitivity_val
+ *
+ * Configuration code must always use these get/set functions.
+ *
+ * Runtime code which uses the sensitivity to process events is
+ * expected to access the value in cfg directly.
+ */
+void mconfig_set_sensitivity(struct MConfig *cfg, double sensitivity);
+double mconfig_get_sensitivity(const struct MConfig *cfg);
+
/* Initialize the MConfig struct.
*/
void mconfig_init(struct MConfig* cfg,
/* Initialize the MConfig struct.
*/
void mconfig_init(struct MConfig* cfg,
{
if ((gs->move_type == GS_MOVE || !timercmp(&gs->time, &gs->move_wait, <)) && (dx != 0 || dy != 0)) {
if (trigger_drag_start(gs, cfg, dx, dy)) {
{
if ((gs->move_type == GS_MOVE || !timercmp(&gs->time, &gs->move_wait, <)) && (dx != 0 || dy != 0)) {
if (trigger_drag_start(gs, cfg, dx, dy)) {
- gs->move_dx = (int)(dx*cfg->sensitivity);
- gs->move_dy = (int)(dy*cfg->sensitivity);
+ gs->move_dx = (int)(dx*cfg->sensitivity_val);
+ gs->move_dy = (int)(dy*cfg->sensitivity_val);
gs->move_type = GS_MOVE;
gs->move_dist = 0;
gs->move_dir = TR_NONE;
gs->move_type = GS_MOVE;
gs->move_dist = 0;
gs->move_dir = TR_NONE;
+void mconfig_set_sensitivity(struct MConfig *cfg, double sensitivity)
+{
+ cfg->sensitivity_val = sensitivity;
+}
+
+double mconfig_get_sensitivity(const struct MConfig * cfg)
+{
+ return cfg->sensitivity_val;
+}
+
void mconfig_defaults(struct MConfig* cfg)
{
// Configure MTState
void mconfig_defaults(struct MConfig* cfg)
{
// Configure MTState
cfg->rotate_rt_btn = DEFAULT_ROTATE_RT_BTN;
cfg->drag_enable = DEFAULT_DRAG_ENABLE;
cfg->drag_timeout = DEFAULT_DRAG_TIMEOUT;
cfg->rotate_rt_btn = DEFAULT_ROTATE_RT_BTN;
cfg->drag_enable = DEFAULT_DRAG_ENABLE;
cfg->drag_timeout = DEFAULT_DRAG_TIMEOUT;
- cfg->sensitivity = DEFAULT_SENSITIVITY;
+ mconfig_set_sensitivity(cfg, DEFAULT_SENSITIVITY);
}
void mconfig_init(struct MConfig* cfg,
}
void mconfig_init(struct MConfig* cfg,
cfg->drag_dist = MAXVAL(xf86SetIntOption(opts, "TapDragDist", DEFAULT_DRAG_DIST), 0);
cfg->axis_x_invert = xf86SetBoolOption(opts, "AxisXInvert", DEFAULT_AXIS_X_INVERT);
cfg->axis_y_invert = xf86SetBoolOption(opts, "AxisYInvert", DEFAULT_AXIS_Y_INVERT);
cfg->drag_dist = MAXVAL(xf86SetIntOption(opts, "TapDragDist", DEFAULT_DRAG_DIST), 0);
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);
+ mconfig_set_sensitivity(cfg, MAXVAL(xf86SetRealOption(opts, "Sensitivity", DEFAULT_SENSITIVITY), 0));