aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-06-15 20:27:26 +0200
committermarha <marha@users.sourceforge.net>2015-06-15 20:27:26 +0200
commite8d5e7c4bb11f7fcb0a4ba5c13f43e7929849a2f (patch)
treea88d66b3d34f8e008f08e2bd77889c6c6718ab11 /xorg-server/dix
parent0b3be550b20ad9f991f77bf979b2c306a7d4ef11 (diff)
downloadvcxsrv-e8d5e7c4bb11f7fcb0a4ba5c13f43e7929849a2f.tar.gz
vcxsrv-e8d5e7c4bb11f7fcb0a4ba5c13f43e7929849a2f.tar.bz2
vcxsrv-e8d5e7c4bb11f7fcb0a4ba5c13f43e7929849a2f.zip
fontconfig libX11 libxcb xcb-proto mesa pixman xserver xkeyboard-config git update 15 June 2015release/external
xserver commit fa12f2c150b2f50de9dac4a2b09265f13af353af libxcb commit f85661c3bca97faa72431df92a3867be39a74e23 libxcb/xcb-proto commit fef8a4cdc2cacd9541a656026371a3d338dadb8e xkeyboard-config commit 61fb58a95a071cc1c212f6d3808908c086219fe0 libX11 commit f0286b2770ece10aef5e2e8c004260217f12fd25 pixman commit eebc1b78200aff075dbcae9c8d00edad1f830d91 fontconfig commit f6d61c9beed856a925bd60c025b55284b2d88161 mesa commit 932d1613d1e15ec22555e5ec09105c49eb850e36
Diffstat (limited to 'xorg-server/dix')
-rw-r--r--xorg-server/dix/devices.c4
-rw-r--r--xorg-server/dix/getevents.c27
-rw-r--r--xorg-server/dix/inpututils.c78
3 files changed, 97 insertions, 12 deletions
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c
index 1f8dabddd..9b0c7d296 100644
--- a/xorg-server/dix/devices.c
+++ b/xorg-server/dix/devices.c
@@ -177,8 +177,8 @@ DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
if (!isfinite(f[i]))
return BadValue;
- if (!dev->valuator)
- return BadMatch;
+ if (!dev->valuator)
+ return BadMatch;
if (!checkonly)
DeviceSetTransform(dev, f);
diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c
index d0a87f7b1..fa5890eec 100644
--- a/xorg-server/dix/getevents.c
+++ b/xorg-server/dix/getevents.c
@@ -208,14 +208,25 @@ init_raw(DeviceIntPtr dev, RawDeviceEvent *event, Time ms, int type, int detail)
}
static void
-set_raw_valuators(RawDeviceEvent *event, ValuatorMask *mask, double *data)
+set_raw_valuators(RawDeviceEvent *event, ValuatorMask *mask,
+ BOOL use_unaccel, double *data)
{
int i;
+ use_unaccel = use_unaccel && valuator_mask_has_unaccelerated(mask);
+
for (i = 0; i < valuator_mask_size(mask); i++) {
if (valuator_mask_isset(mask, i)) {
+ double v;
+
SetBit(event->valuators.mask, i);
- data[i] = valuator_mask_get_double(mask, i);
+
+ if (use_unaccel)
+ v = valuator_mask_get_unaccelerated(mask, i);
+ else
+ v = valuator_mask_get_double(mask, i);
+
+ data[i] = v;
}
}
}
@@ -1388,9 +1399,11 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
num_events++;
init_raw(pDev, raw, ms, type, buttons);
- set_raw_valuators(raw, &mask, raw->valuators.data_raw);
+ set_raw_valuators(raw, &mask, TRUE, raw->valuators.data_raw);
}
+ valuator_mask_drop_unaccelerated(&mask);
+
/* valuators are in driver-native format (rel or abs) */
if (flags & POINTER_ABSOLUTE) {
@@ -1403,7 +1416,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
transformAbsolute(pDev, &mask);
clipAbsolute(pDev, &mask);
if ((flags & POINTER_NORAW) == 0 && raw)
- set_raw_valuators(raw, &mask, raw->valuators.data);
+ set_raw_valuators(raw, &mask, FALSE, raw->valuators.data);
}
else {
transformRelative(pDev, &mask);
@@ -1411,7 +1424,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
if (flags & POINTER_ACCELERATE)
accelPointer(pDev, &mask, ms);
if ((flags & POINTER_NORAW) == 0 && raw)
- set_raw_valuators(raw, &mask, raw->valuators.data);
+ set_raw_valuators(raw, &mask, FALSE, raw->valuators.data);
moveRelative(pDev, flags, &mask);
}
@@ -1916,7 +1929,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
events++;
num_events++;
init_raw(dev, raw, ms, type, client_id);
- set_raw_valuators(raw, &mask, raw->valuators.data_raw);
+ set_raw_valuators(raw, &mask, TRUE, raw->valuators.data_raw);
}
event = &events->device_event;
@@ -1978,7 +1991,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
screeny = dev->spriteInfo->sprite->hotPhys.y;
}
if (need_rawevent)
- set_raw_valuators(raw, &mask, raw->valuators.data);
+ set_raw_valuators(raw, &mask, FALSE, raw->valuators.data);
/* Indirect device touch coordinates are not used for cursor positioning.
* They are merely informational, and are provided in device coordinates.
diff --git a/xorg-server/dix/inpututils.c b/xorg-server/dix/inpututils.c
index 5c2a32d1c..136398842 100644
--- a/xorg-server/dix/inpututils.c
+++ b/xorg-server/dix/inpututils.c
@@ -505,15 +505,23 @@ valuator_mask_isset(const ValuatorMask *mask, int valuator)
return mask->last_bit >= valuator && BitIsOn(mask->mask, valuator);
}
+static inline void
+_valuator_mask_set_double(ValuatorMask *mask, int valuator, double data)
+{
+ mask->last_bit = max(valuator, mask->last_bit);
+ SetBit(mask->mask, valuator);
+ mask->valuators[valuator] = data;
+}
+
/**
* Set the valuator to the given floating-point data.
*/
void
valuator_mask_set_double(ValuatorMask *mask, int valuator, double data)
{
- mask->last_bit = max(valuator, mask->last_bit);
- SetBit(mask->mask, valuator);
- mask->valuators[valuator] = data;
+ BUG_WARN_MSG(mask->has_unaccelerated,
+ "Do not mix valuator types, zero mask first\n");
+ _valuator_mask_set_double(mask, valuator, data);
}
/**
@@ -594,11 +602,15 @@ valuator_mask_unset(ValuatorMask *mask, int valuator)
ClearBit(mask->mask, valuator);
mask->valuators[valuator] = 0.0;
+ mask->unaccelerated[valuator] = 0.0;
for (i = 0; i <= mask->last_bit; i++)
if (valuator_mask_isset(mask, i))
lastbit = max(lastbit, i);
mask->last_bit = lastbit;
+
+ if (mask->last_bit == -1)
+ mask->has_unaccelerated = FALSE;
}
}
@@ -611,6 +623,66 @@ valuator_mask_copy(ValuatorMask *dest, const ValuatorMask *src)
valuator_mask_zero(dest);
}
+Bool
+valuator_mask_has_unaccelerated(const ValuatorMask *mask)
+{
+ return mask->has_unaccelerated;
+}
+
+void
+valuator_mask_drop_unaccelerated(ValuatorMask *mask)
+{
+ memset(mask->unaccelerated, 0, sizeof(mask->unaccelerated));
+ mask->has_unaccelerated = FALSE;
+}
+
+/**
+ * Set both accelerated and unaccelerated value for this mask.
+ */
+void
+valuator_mask_set_unaccelerated(ValuatorMask *mask,
+ int valuator,
+ double accel,
+ 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, accel);
+ mask->has_unaccelerated = TRUE;
+ mask->unaccelerated[valuator] = unaccel;
+}
+
+double
+valuator_mask_get_accelerated(const ValuatorMask *mask,
+ int valuator)
+{
+ return valuator_mask_get_double(mask, valuator);
+}
+
+double
+valuator_mask_get_unaccelerated(const ValuatorMask *mask,
+ int valuator)
+{
+ return mask->unaccelerated[valuator];
+}
+
+Bool
+valuator_mask_fetch_unaccelerated(const ValuatorMask *mask,
+ int valuator,
+ double *accel,
+ double *unaccel)
+{
+ if (valuator_mask_isset(mask, valuator)) {
+ if (accel)
+ *accel = valuator_mask_get_accelerated(mask, valuator);
+ if (unaccel)
+ *unaccel = valuator_mask_get_unaccelerated(mask, valuator);
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
int
CountBits(const uint8_t * mask, int len)
{