Prep work for splitting things up better

Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 src/filter-private.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/filter.c         | 49 +++---------------------------------------------
 2 files changed, 56 insertions(+), 46 deletions(-)

diff --git a/src/filter-private.h b/src/filter-private.h
index 6ccbf97f..91a1eb7d 100644
--- a/src/filter-private.h
+++ b/src/filter-private.h
@@ -51,4 +51,57 @@ struct motion_filter {
        struct motion_filter_interface *interface;
 };
 
+struct pointer_tracker {
+       struct device_float_coords delta; /* delta to most recent event */
+       uint64_t time;  /* us */
+       uint32_t dir;
+};
+
+struct pointer_trackers {
+       struct pointer_tracker *trackers;
+       size_t ntrackers;
+       unsigned int cur_tracker;
+};
+
+void init_trackers(struct pointer_trackers *trackers,
+                  size_t ntrackers);
+void
+feed_trackers(struct pointer_trackers *trackers,
+             const struct device_float_coords *delta,
+             uint64_t time);
+
+struct pointer_tracker *
+tracker_by_offset(struct pointer_trackers *trackers, unsigned int offset);
+
+/* Convert speed/velocity from units/us to units/ms */
+static inline double
+v_us2ms(double units_per_us)
+{
+       return units_per_us * 1000.0;
+}
+
+static inline double
+v_us2s(double units_per_us)
+{
+       return units_per_us * 1000000.0;
+}
+
+/* Convert speed/velocity from units/ms to units/us */
+static inline double
+v_ms2us(double units_per_ms)
+{
+       return units_per_ms/1000.0;
+}
+
+static inline struct normalized_coords
+normalize_for_dpi(const struct device_float_coords *coords, int dpi)
+{
+       struct normalized_coords norm;
+
+       norm.x = coords->x * DEFAULT_MOUSE_DPI/dpi;
+       norm.y = coords->y * DEFAULT_MOUSE_DPI/dpi;
+
+       return norm;
+}
+
 #endif
diff --git a/src/filter.c b/src/filter.c
index d12b1147..28e39c9c 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -42,37 +42,6 @@
  */
 #define TP_MAGIC_SLOWDOWN 0.37 /* unitless factor */
 
-/* Convert speed/velocity from units/us to units/ms */
-static inline double
-v_us2ms(double units_per_us)
-{
-       return units_per_us * 1000.0;
-}
-
-static inline double
-v_us2s(double units_per_us)
-{
-       return units_per_us * 1000000.0;
-}
-
-/* Convert speed/velocity from units/ms to units/us */
-static inline double
-v_ms2us(double units_per_ms)
-{
-       return units_per_ms/1000.0;
-}
-
-static inline struct normalized_coords
-normalize_for_dpi(const struct device_float_coords *coords, int dpi)
-{
-       struct normalized_coords norm;
-
-       norm.x = coords->x * DEFAULT_MOUSE_DPI/dpi;
-       norm.y = coords->y * DEFAULT_MOUSE_DPI/dpi;
-
-       return norm;
-}
-
 struct normalized_coords
 filter_dispatch(struct motion_filter *filter,
                const struct device_float_coords *unaccelerated,
@@ -161,18 +130,6 @@ filter_get_type(struct motion_filter *filter)
 #define MOTION_TIMEOUT         ms2us(1000)
 #define NUM_POINTER_TRACKERS   16
 
-struct pointer_tracker {
-       struct device_float_coords delta; /* delta to most recent event */
-       uint64_t time;  /* us */
-       uint32_t dir;
-};
-
-struct pointer_trackers {
-       struct pointer_tracker *trackers;
-       size_t ntrackers;
-       unsigned int cur_tracker;
-};
-
 struct pointer_accelerator {
        struct motion_filter base;
 
@@ -224,7 +181,7 @@ struct trackpoint_accelerator {
        double offset; /* offset of the function */
 };
 
-static void
+void
 init_trackers(struct pointer_trackers *trackers,
              size_t ntrackers)
 {
@@ -234,7 +191,7 @@ init_trackers(struct pointer_trackers *trackers,
        trackers->cur_tracker = 0;
 }
 
-static void
+void
 feed_trackers(struct pointer_trackers *trackers,
              const struct device_float_coords *delta,
              uint64_t time)
@@ -258,7 +215,7 @@ feed_trackers(struct pointer_trackers *trackers,
        ts[current].dir = device_float_get_direction(*delta);
 }
 
-static struct pointer_tracker *
+struct pointer_tracker *
 tracker_by_offset(struct pointer_trackers *trackers, unsigned int offset)
 {
        unsigned int index =
-- 
2.14.3

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to