summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-09-30 09:24:56 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-09-30 09:24:56 +1000
commit4c6bc0e76599dbe5ede2e1f48c9936a0e996b638 (patch)
tree5148df7b67e42eb61ad990847ff7e8b47164a239 /include
parent057cc92ebfeebe81b7d01ff2c6aa2c066c8d1a64 (diff)
parent3304bbff9b4ed63f1a47410a5320a136420ba2c6 (diff)
Merge branch 'smooth-scrolling' into next
Diffstat (limited to 'include')
-rw-r--r--include/eventstr.h11
-rw-r--r--include/exevents.h25
-rw-r--r--include/input.h6
-rw-r--r--include/inputstr.h23
-rw-r--r--include/inpututils.h2
-rw-r--r--include/ptrveloc.h32
-rw-r--r--include/xserver-properties.h2
7 files changed, 75 insertions, 26 deletions
diff --git a/include/eventstr.h b/include/eventstr.h
index 049688ca0..2de077fd2 100644
--- a/include/eventstr.h
+++ b/include/eventstr.h
@@ -95,8 +95,7 @@ struct _DeviceEvent
struct {
uint8_t mask[(MAX_VALUATORS + 7)/8]; /**< Valuator mask */
uint8_t mode[(MAX_VALUATORS + 7)/8]; /**< Valuator mode (Abs or Rel)*/
- int32_t data[MAX_VALUATORS]; /**< Valuator data */
- int32_t data_frac[MAX_VALUATORS]; /**< Fractional part for data */
+ double data[MAX_VALUATORS]; /**< Valuator data */
} valuators;
struct {
uint32_t base; /**< XKB base modifiers */
@@ -113,6 +112,7 @@ struct _DeviceEvent
Window root; /**< Root window of the event */
int corestate; /**< Core key/button state BEFORE the event */
int key_repeat; /**< Internally-generated key repeat event */
+ uint32_t flags; /**< Flags to be copied into the generated event */
};
@@ -198,11 +198,10 @@ struct _RawDeviceEvent
} detail;
struct {
uint8_t mask[(MAX_VALUATORS + 7)/8]; /**< Valuator mask */
- int32_t data[MAX_VALUATORS]; /**< Valuator data */
- int32_t data_frac[MAX_VALUATORS]; /**< Fractional part for data */
- int32_t data_raw[MAX_VALUATORS]; /**< Valuator data as posted */
- int32_t data_raw_frac[MAX_VALUATORS];/**< Fractional part for data_raw */
+ double data[MAX_VALUATORS]; /**< Valuator data */
+ double data_raw[MAX_VALUATORS]; /**< Valuator data as posted */
} valuators;
+ uint32_t flags; /**< Flags to be copied into the generated event */
};
#ifdef XQUARTZ
diff --git a/include/exevents.h b/include/exevents.h
index 2b226986b..4fe6c61a9 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -37,10 +37,26 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* Interface available to drivers *
***************************************************************/
+/**
+ * Scroll flags for ::SetScrollValuator.
+ */
+enum ScrollFlags {
+ SCROLL_FLAG_NONE = 0,
+ /**
+ * Do not emulate legacy button events for valuator events on this axis.
+ */
+ SCROLL_FLAG_DONT_EMULATE = (1 << 1),
+ /**
+ * This axis is the preferred axis for valuator emulation for this axis'
+ * scroll type.
+ */
+ SCROLL_FLAG_PREFERRED = (1 << 2)
+};
+
extern _X_EXPORT int InitProximityClassDeviceStruct(
DeviceIntPtr /* dev */);
-extern _X_EXPORT void InitValuatorAxisStruct(
+extern _X_EXPORT Bool InitValuatorAxisStruct(
DeviceIntPtr /* dev */,
int /* axnum */,
Atom /* label */,
@@ -51,6 +67,13 @@ extern _X_EXPORT void InitValuatorAxisStruct(
int /* max_res */,
int /* mode */);
+extern _X_EXPORT Bool SetScrollValuator(
+ DeviceIntPtr /* dev */,
+ int /* axnum */,
+ enum ScrollType /* type */,
+ double /* increment */,
+ int /* flags */);
+
/* Input device properties */
extern _X_EXPORT void XIDeleteAllDeviceProperties(
DeviceIntPtr /* device */
diff --git a/include/input.h b/include/input.h
index 0258f4f18..6ba1ab200 100644
--- a/include/input.h
+++ b/include/input.h
@@ -68,6 +68,7 @@ SOFTWARE.
#define POINTER_ACCELERATE (1 << 3)
#define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */
#define POINTER_NORAW (1 << 5) /* Don't generate RawEvents */
+#define POINTER_EMULATED (1 << 6) /* Event was emulated from another event */
/*int constants for pointer acceleration schemes*/
#define PtrAccelNoOp 0
@@ -583,6 +584,9 @@ extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask,
extern _X_EXPORT void valuator_mask_set(ValuatorMask *mask,
int valuator,
int data);
+extern _X_EXPORT void valuator_mask_set_double(ValuatorMask *mask,
+ int valuator,
+ double data);
extern _X_EXPORT void valuator_mask_zero(ValuatorMask *mask);
extern _X_EXPORT int valuator_mask_size(const ValuatorMask *mask);
extern _X_EXPORT int valuator_mask_isset(const ValuatorMask *mask, int bit);
@@ -591,6 +595,8 @@ extern _X_EXPORT int valuator_mask_num_valuators(const ValuatorMask *mask);
extern _X_EXPORT void valuator_mask_copy(ValuatorMask *dest,
const ValuatorMask *src);
extern _X_EXPORT int valuator_mask_get(const ValuatorMask *mask, int valnum);
+extern _X_EXPORT double valuator_mask_get_double(const ValuatorMask *mask,
+ int valnum);
/* InputOption handling interface */
extern _X_EXPORT InputOption* input_option_new(InputOption *list, const char *key, const char *value);
diff --git a/include/inputstr.h b/include/inputstr.h
index 480e95671..9d4108ef5 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -75,6 +75,16 @@ extern _X_EXPORT int CountBits(const uint8_t *mask, int len);
#define XI2MASKSIZE ((XI2LASTEVENT + 7)/8) /* no of bits for masks */
/**
+ * Scroll types for ::SetScrollValuator and the scroll type in the
+ * ::ScrollInfoPtr.
+ */
+enum ScrollType {
+ SCROLL_TYPE_NONE = 0, /**< Not a scrolling valuator */
+ SCROLL_TYPE_VERTICAL = 8,
+ SCROLL_TYPE_HORIZONTAL = 9,
+};
+
+/**
* This struct stores the core event mask for each client except the client
* that created the window.
*
@@ -252,6 +262,12 @@ typedef struct _KeyClassRec {
struct _XkbSrvInfo *xkbInfo;
} KeyClassRec, *KeyClassPtr;
+typedef struct _ScrollInfo {
+ enum ScrollType type;
+ double increment;
+ int flags;
+} ScrollInfo, *ScrollInfoPtr;
+
typedef struct _AxisInfo {
int resolution;
int min_resolution;
@@ -260,6 +276,7 @@ typedef struct _AxisInfo {
int max_value;
Atom label;
CARD8 mode;
+ ScrollInfo scroll;
} AxisInfo, *AxisInfoPtr;
typedef struct _ValuatorAccelerationRec {
@@ -283,6 +300,8 @@ typedef struct _ValuatorClassRec {
unsigned short numAxes;
double *axisVal; /* always absolute, but device-coord system */
ValuatorAccelerationRec accelScheme;
+ int h_scroll_axis; /* horiz smooth-scrolling axis */
+ int v_scroll_axis; /* vert smooth-scrolling axis */
} ValuatorClassRec;
typedef struct _ButtonClassRec {
@@ -521,10 +540,10 @@ typedef struct _DeviceIntRec {
* remainder supports acceleration
*/
struct {
- int valuators[MAX_VALUATORS];
- float remainder[MAX_VALUATORS];
+ double valuators[MAX_VALUATORS];
int numValuators;
DeviceIntPtr slave;
+ ValuatorMask *scroll;
} last;
/* Input device property handling. */
diff --git a/include/inpututils.h b/include/inpututils.h
index 63e1a263a..47e242d87 100644
--- a/include/inpututils.h
+++ b/include/inpututils.h
@@ -34,7 +34,7 @@
struct _ValuatorMask {
int8_t last_bit; /* highest bit set in mask */
uint8_t mask[(MAX_VALUATORS + 7)/8];
- int valuators[MAX_VALUATORS]; /* valuator data */
+ double valuators[MAX_VALUATORS]; /* valuator data */
};
extern void verify_internal_event(const InternalEvent *ev);
diff --git a/include/ptrveloc.h b/include/ptrveloc.h
index 6ca309c8c..4f76b0094 100644
--- a/include/ptrveloc.h
+++ b/include/ptrveloc.h
@@ -47,9 +47,9 @@ struct _DeviceVelocityRec;
* profile
* returns actual acceleration depending on velocity, acceleration control,...
*/
-typedef float (*PointerAccelerationProfileFunc)
+typedef double (*PointerAccelerationProfileFunc)
(DeviceIntPtr dev, struct _DeviceVelocityRec* vel,
- float velocity, float threshold, float accelCoeff);
+ double velocity, double threshold, double accelCoeff);
/**
* a motion history, with just enough information to
@@ -57,8 +57,8 @@ typedef float (*PointerAccelerationProfileFunc)
* a more or less straight line
*/
typedef struct _MotionTracker {
- int dx, dy; /* accumulated delta for each axis */
- int time; /* time of creation */
+ double dx, dy; /* accumulated delta for each axis */
+ int time; /* time of creation */
int dir; /* initial direction bitfield */
} MotionTracker, *MotionTrackerPtr;
@@ -69,17 +69,17 @@ typedef struct _DeviceVelocityRec {
MotionTrackerPtr tracker;
int num_tracker;
int cur_tracker; /* current index */
- float velocity; /* velocity as guessed by algorithm */
- float last_velocity; /* previous velocity estimate */
- int last_dx; /* last time-difference */
- int last_dy ; /* phase of last/current estimate */
- float corr_mul; /* config: multiply this into velocity */
- float const_acceleration; /* config: (recipr.) const deceleration */
- float min_acceleration; /* config: minimum acceleration */
+ double velocity; /* velocity as guessed by algorithm */
+ double last_velocity; /* previous velocity estimate */
+ double last_dx; /* last time-difference */
+ double last_dy; /* phase of last/current estimate */
+ double corr_mul; /* config: multiply this into velocity */
+ double const_acceleration; /* config: (recipr.) const deceleration */
+ double min_acceleration; /* config: minimum acceleration */
short reset_time; /* config: reset non-visible state after # ms */
short use_softening; /* config: use softening of mouse values */
- float max_rel_diff; /* config: max. relative difference */
- float max_diff; /* config: max. difference */
+ double max_rel_diff; /* config: max. relative difference */
+ double max_diff; /* config: max. difference */
int initial_range; /* config: max. offset used as initial velocity */
Bool average_accel; /* config: average acceleration over velocity */
PointerAccelerationProfileFunc Profile;
@@ -107,11 +107,11 @@ extern _X_EXPORT void
InitTrackers(DeviceVelocityPtr vel, int ntracker);
extern _X_EXPORT BOOL
-ProcessVelocityData2D(DeviceVelocityPtr vel, int dx, int dy, int time);
+ProcessVelocityData2D(DeviceVelocityPtr vel, double dx, double dy, int time);
-extern _X_EXPORT float
+extern _X_EXPORT double
BasicComputeAcceleration(DeviceIntPtr dev, DeviceVelocityPtr vel,
- float velocity, float threshold, float acc);
+ double velocity, double threshold, double acc);
extern _X_EXPORT void
FreeVelocityData(DeviceVelocityPtr vel);
diff --git a/include/xserver-properties.h b/include/xserver-properties.h
index bf50042d0..18b54ba32 100644
--- a/include/xserver-properties.h
+++ b/include/xserver-properties.h
@@ -77,6 +77,8 @@
#define AXIS_LABEL_PROP_REL_DIAL "Rel Dial"
#define AXIS_LABEL_PROP_REL_WHEEL "Rel Vert Wheel"
#define AXIS_LABEL_PROP_REL_MISC "Rel Misc"
+#define AXIS_LABEL_PROP_REL_VSCROLL "Rel Vert Scroll"
+#define AXIS_LABEL_PROP_REL_HSCROLL "Rel Horiz Scroll"
/*
* Absolute axes