[PATCH xserver 03/14 v2] dix: Add valuator_mask_set_absolute_unaccelerated
Jonas Ådahl
jadahl at gmail.com
Tue Sep 13 07:16:57 UTC 2016
Add a valuator mask setter for setting absolute coordinate combined
with unaccelerated motion deltas. This will later be used by Xwayland
to combine a wl_pointer.motion() event with the unaccelerated delta of
a wp_relative_pointer.relative_motion() event.
Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
---
No changes since v1.
dix/inpututils.c | 13 +++++++++++++
include/input.h | 5 ++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/dix/inpututils.c b/dix/inpututils.c
index 5b7da3a..6bff9ef 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -636,6 +636,19 @@ valuator_mask_drop_unaccelerated(ValuatorMask *mask)
mask->has_unaccelerated = FALSE;
}
+void
+valuator_mask_set_absolute_unaccelerated(ValuatorMask *mask,
+ int valuator,
+ int absolute,
+ double unaccel)
+{
+ BUG_WARN_MSG(mask->last_bit != -1 && !mask->has_unaccelerated,
+ "Do not mix valuator types, zero mask first\n");
+ _valuator_mask_set_double(mask, valuator, absolute);
+ mask->has_unaccelerated = TRUE;
+ mask->unaccelerated[valuator] = unaccel;
+}
+
/**
* Set both accelerated and unaccelerated value for this mask.
*/
diff --git a/include/input.h b/include/input.h
index e0f6b9b..c7b1e91 100644
--- a/include/input.h
+++ b/include/input.h
@@ -675,12 +675,15 @@ extern _X_EXPORT Bool valuator_mask_fetch(const ValuatorMask *mask,
int valnum, int *val);
extern _X_EXPORT Bool valuator_mask_fetch_double(const ValuatorMask *mask,
int valnum, double *val);
-
extern _X_EXPORT Bool valuator_mask_has_unaccelerated(const ValuatorMask *mask);
extern _X_EXPORT void valuator_mask_set_unaccelerated(ValuatorMask *mask,
int valuator,
double accel,
double unaccel);
+extern _X_EXPORT void valuator_mask_set_absolute_unaccelerated(ValuatorMask *mask,
+ int valuator,
+ int absolute,
+ double unaccel);
extern _X_EXPORT double valuator_mask_get_accelerated(const ValuatorMask *mask,
int valuator);
extern _X_EXPORT double valuator_mask_get_unaccelerated(const ValuatorMask *mask,
--
2.7.4
More information about the xorg-devel
mailing list