aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xi
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-10-05 17:37:34 +0200
committermarha <marha@users.sourceforge.net>2011-10-05 17:37:34 +0200
commitf7025b4baa1ba35ee796785641f04eac5bedb0a6 (patch)
tree3df62b7b501a478e212397883657a8a8be4db7a3 /xorg-server/Xi
parent60adbfdea1ee754341d64454274e7aa83bae8971 (diff)
downloadvcxsrv-f7025b4baa1ba35ee796785641f04eac5bedb0a6.tar.gz
vcxsrv-f7025b4baa1ba35ee796785641f04eac5bedb0a6.tar.bz2
vcxsrv-f7025b4baa1ba35ee796785641f04eac5bedb0a6.zip
mkfontscale pixman xserver xtrans libX11 libXdmcp libxcb libXmu mesa git update 5 oct 2011
Diffstat (limited to 'xorg-server/Xi')
-rw-r--r--xorg-server/Xi/exevents.c64
-rw-r--r--xorg-server/Xi/xiproperty.c5
-rw-r--r--xorg-server/Xi/xiquerydevice.c73
-rw-r--r--xorg-server/Xi/xiquerydevice.h1
-rw-r--r--xorg-server/Xi/xiwarppointer.c2
5 files changed, 134 insertions, 11 deletions
diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c
index 38089a27c..74a78ecf2 100644
--- a/xorg-server/Xi/exevents.c
+++ b/xorg-server/Xi/exevents.c
@@ -774,12 +774,9 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
for (i = 0; i <= last_valuator && i < v->numAxes; i++)
{
+ /* XXX: Relative/Absolute mode */
if (BitIsOn(&event->valuators.mask, i))
- {
- /* XXX: Relative/Absolute mode */
v->axisVal[i] = event->valuators.data[i];
- v->axisVal[i] += (event->valuators.data_frac[i] * 1.0f / (1 << 16) / (1 << 16));
- }
}
if (event->type == ET_KeyPress) {
@@ -1070,16 +1067,16 @@ InitProximityClassDeviceStruct(DeviceIntPtr dev)
*
* @see InitValuatorClassDeviceStruct
*/
-void
+Bool
InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int maxval,
int resolution, int min_res, int max_res, int mode)
{
AxisInfoPtr ax;
- if (!dev || !dev->valuator || minval > maxval)
- return;
+ if (!dev || !dev->valuator || (minval > maxval && mode == Absolute))
+ return FALSE;
if (axnum >= dev->valuator->numAxes)
- return;
+ return FALSE;
ax = dev->valuator->axes + axnum;
@@ -1093,6 +1090,57 @@ InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int
if (mode & OutOfProximity)
dev->proximity->in_proximity = FALSE;
+
+ return SetScrollValuator(dev, axnum, SCROLL_TYPE_NONE, 0, SCROLL_FLAG_NONE);
+}
+
+/**
+ * Set the given axis number as a scrolling valuator.
+ */
+Bool
+SetScrollValuator(DeviceIntPtr dev, int axnum, enum ScrollType type, double increment, int flags)
+{
+ AxisInfoPtr ax;
+ int *current_ax;
+
+ if (!dev || !dev->valuator || axnum >= dev->valuator->numAxes)
+ return FALSE;
+
+ switch (type)
+ {
+ case SCROLL_TYPE_VERTICAL:
+ current_ax = &dev->valuator->v_scroll_axis;
+ break;
+ case SCROLL_TYPE_HORIZONTAL:
+ current_ax = &dev->valuator->h_scroll_axis;
+ break;
+ case SCROLL_TYPE_NONE:
+ ax = &dev->valuator->axes[axnum];
+ ax->scroll.type = type;
+ return TRUE;
+ default:
+ return FALSE;
+ }
+
+ if (increment == 0.0)
+ return FALSE;
+
+ if (*current_ax != -1 && axnum != *current_ax)
+ {
+ ax = &dev->valuator->axes[*current_ax];
+ if (ax->scroll.type == type &&
+ (flags & SCROLL_FLAG_PREFERRED) && (ax->scroll.flags & SCROLL_FLAG_PREFERRED))
+ return FALSE;
+ }
+ *current_ax = axnum;
+
+ ax = &dev->valuator->axes[axnum];
+ ax->scroll.type = type;
+ ax->scroll.increment = increment;
+ ax->scroll.flags = flags;
+ /* FIXME: generate DeviceChanged Events */
+
+ return TRUE;
}
static void
diff --git a/xorg-server/Xi/xiproperty.c b/xorg-server/Xi/xiproperty.c
index fa0d81188..14f1491b6 100644
--- a/xorg-server/Xi/xiproperty.c
+++ b/xorg-server/Xi/xiproperty.c
@@ -52,11 +52,14 @@ static struct dev_properties
} dev_properties[] = {
{0, XI_PROP_ENABLED},
{0, XI_PROP_XTEST_DEVICE},
+
{0, XATOM_FLOAT},
+
{0, ACCEL_PROP_PROFILE_NUMBER},
{0, ACCEL_PROP_CONSTANT_DECELERATION},
{0, ACCEL_PROP_ADAPTIVE_DECELERATION},
{0, ACCEL_PROP_VELOCITY_SCALING},
+
{0, AXIS_LABEL_PROP},
{0, AXIS_LABEL_PROP_REL_X},
{0, AXIS_LABEL_PROP_REL_Y},
@@ -68,6 +71,8 @@ static struct dev_properties
{0, AXIS_LABEL_PROP_REL_DIAL},
{0, AXIS_LABEL_PROP_REL_WHEEL},
{0, AXIS_LABEL_PROP_REL_MISC},
+ {0, AXIS_LABEL_PROP_REL_VSCROLL},
+ {0, AXIS_LABEL_PROP_REL_HSCROLL},
{0, AXIS_LABEL_PROP_ABS_X},
{0, AXIS_LABEL_PROP_ABS_Y},
{0, AXIS_LABEL_PROP_ABS_Z},
diff --git a/xorg-server/Xi/xiquerydevice.c b/xorg-server/Xi/xiquerydevice.c
index 902eb918c..9961d1b6f 100644
--- a/xorg-server/Xi/xiquerydevice.c
+++ b/xorg-server/Xi/xiquerydevice.c
@@ -229,7 +229,16 @@ SizeDeviceClasses(DeviceIntPtr dev)
}
if (dev->valuator)
- len += sizeof(xXIValuatorInfo) * dev->valuator->numAxes;
+ {
+ int i;
+ len += (sizeof(xXIValuatorInfo)) * dev->valuator->numAxes;
+
+ for (i = 0; i < dev->valuator->numAxes; i++) {
+ if (dev->valuator->axes[i].scroll.type != SCROLL_TYPE_NONE)
+ len += sizeof(xXIScrollInfo);
+ }
+ }
+
return len;
}
@@ -369,6 +378,56 @@ SwapValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info)
swaps(&info->sourceid);
}
+int
+ListScrollInfo(DeviceIntPtr dev, xXIScrollInfo *info, int axisnumber)
+{
+ ValuatorClassPtr v = dev->valuator;
+ AxisInfoPtr axis = &v->axes[axisnumber];
+
+ if (axis->scroll.type == SCROLL_TYPE_NONE)
+ return 0;
+
+ info->type = XIScrollClass;
+ info->length = sizeof(xXIScrollInfo)/4;
+ info->number = axisnumber;
+ switch(axis->scroll.type)
+ {
+ case SCROLL_TYPE_VERTICAL:
+ info->scroll_type = XIScrollTypeVertical;
+ break;
+ case SCROLL_TYPE_HORIZONTAL:
+ info->scroll_type = XIScrollTypeHorizontal;
+ break;
+ default:
+ ErrorF("[Xi] Unknown scroll type %d. This is a bug.\n", axis->scroll.type);
+ break;
+ }
+ info->increment.integral = (int)axis->scroll.increment;
+ info->increment.frac = (unsigned int)(axis->scroll.increment * (1UL << 16) * (1UL << 16));
+ info->sourceid = v->sourceid;
+
+ info->flags = 0;
+
+ if (axis->scroll.flags & SCROLL_FLAG_DONT_EMULATE)
+ info->flags |= XIScrollFlagNoEmulation;
+ if (axis->scroll.flags & SCROLL_FLAG_PREFERRED)
+ info->flags |= XIScrollFlagPreferred;
+
+ return info->length * 4;
+}
+
+static void
+SwapScrollInfo(DeviceIntPtr dev, xXIScrollInfo* info)
+{
+ swaps(&info->type);
+ swaps(&info->length);
+ swaps(&info->number);
+ swaps(&info->sourceid);
+ swaps(&info->scroll_type);
+ swapl(&info->increment.integral);
+ swapl(&info->increment.frac);
+}
+
int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
{
DeviceIntPtr master = GetMaster(dev, MASTER_ATTACHED);
@@ -458,6 +517,15 @@ ListDeviceClasses(ClientPtr client, DeviceIntPtr dev,
total_len += len;
}
+ for (i = 0; dev->valuator && i < dev->valuator->numAxes; i++)
+ {
+ len = ListScrollInfo(dev, (xXIScrollInfo*)any, i);
+ if (len)
+ (*nclasses)++;
+ any += len;
+ total_len += len;
+ }
+
return total_len;
}
@@ -484,6 +552,9 @@ SwapDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo* info)
case XIValuatorClass:
SwapValuatorInfo(dev, (xXIValuatorInfo*)any);
break;
+ case XIScrollClass:
+ SwapScrollInfo(dev, (xXIScrollInfo*)any);
+ break;
}
any += len * 4;
diff --git a/xorg-server/Xi/xiquerydevice.h b/xorg-server/Xi/xiquerydevice.h
index 02f06591e..9db6aa293 100644
--- a/xorg-server/Xi/xiquerydevice.h
+++ b/xorg-server/Xi/xiquerydevice.h
@@ -44,4 +44,5 @@ int ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info, Bool reportState);
int ListKeyInfo(DeviceIntPtr dev, xXIKeyInfo* info);
int ListValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info,
int axisnumber, Bool reportState);
+int ListScrollInfo(DeviceIntPtr dev, xXIScrollInfo* info, int axisnumber);
#endif /* QUERYDEV_H */
diff --git a/xorg-server/Xi/xiwarppointer.c b/xorg-server/Xi/xiwarppointer.c
index 8fcb4d16b..11ab241b5 100644
--- a/xorg-server/Xi/xiwarppointer.c
+++ b/xorg-server/Xi/xiwarppointer.c
@@ -190,8 +190,6 @@ ProcXIWarpPointer(ClientPtr client)
/* if we don't update the device, we get a jump next time it moves */
pDev->last.valuators[0] = x;
pDev->last.valuators[1] = y;
- pDev->last.remainder[0] = 0;
- pDev->last.remainder[1] = 0;
miPointerUpdateSprite(pDev);
/* FIXME: XWarpPointer is supposed to generate an event. It doesn't do it