aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/eventconvert.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-10-27 08:37:52 +0200
committermarha <marha@users.sourceforge.net>2011-10-27 08:37:52 +0200
commit2a9be4af293f20fa33cc34fbc3b72e2235d91090 (patch)
treed41608bda1d56be1aa96857dee20e988b53760a3 /xorg-server/dix/eventconvert.c
parent9d53da0fbb9ae6df9a38ad40df4f53cd28287235 (diff)
parentd662d461634660f5c0f3998b5eb7d7ed3bd5a25f (diff)
downloadvcxsrv-2a9be4af293f20fa33cc34fbc3b72e2235d91090.tar.gz
vcxsrv-2a9be4af293f20fa33cc34fbc3b72e2235d91090.tar.bz2
vcxsrv-2a9be4af293f20fa33cc34fbc3b72e2235d91090.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'xorg-server/dix/eventconvert.c')
-rw-r--r--xorg-server/dix/eventconvert.c67
1 files changed, 57 insertions, 10 deletions
diff --git a/xorg-server/dix/eventconvert.c b/xorg-server/dix/eventconvert.c
index 5269e53bc..d7b161e02 100644
--- a/xorg-server/dix/eventconvert.c
+++ b/xorg-server/dix/eventconvert.c
@@ -43,10 +43,13 @@
#include "inputstr.h"
#include "misc.h"
#include "eventstr.h"
+#include "exevents.h"
#include "exglobals.h"
#include "eventconvert.h"
+#include "inpututils.h"
#include "xiquerydevice.h"
#include "xkbsrv.h"
+#include "inpututils.h"
static int countValuators(DeviceEvent *ev, int *first);
@@ -482,6 +485,40 @@ appendValuatorInfo(DeviceChangedEvent *dce, xXIValuatorInfo *info, int axisnumbe
}
static int
+appendScrollInfo(DeviceChangedEvent *dce, xXIScrollInfo *info, int axisnumber)
+{
+ if (dce->valuators[axisnumber].scroll.type == SCROLL_TYPE_NONE)
+ return 0;
+
+ info->type = XIScrollClass;
+ info->length = sizeof(xXIScrollInfo)/4;
+ info->number = axisnumber;
+ switch(dce->valuators[axisnumber].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", dce->valuators[axisnumber].scroll.type);
+ break;
+ }
+ info->increment = double_to_fp3232(dce->valuators[axisnumber].scroll.increment);
+ info->sourceid = dce->sourceid;
+
+ info->flags = 0;
+
+ if (dce->valuators[axisnumber].scroll.flags & SCROLL_FLAG_DONT_EMULATE)
+ info->flags |= XIScrollFlagNoEmulation;
+ if (dce->valuators[axisnumber].scroll.flags & SCROLL_FLAG_PREFERRED)
+ info->flags |= XIScrollFlagPreferred;
+
+ return info->length * 4;
+}
+
+static int
eventToDeviceChanged(DeviceChangedEvent *dce, xEvent **xi)
{
xXIDeviceChangedEvent *dcce;
@@ -496,8 +533,16 @@ eventToDeviceChanged(DeviceChangedEvent *dce, xEvent **xi)
len += pad_to_int32(bits_to_bytes(dce->buttons.num_buttons));
}
if (dce->num_valuators)
+ {
+ int i;
+
len += sizeof(xXIValuatorInfo) * dce->num_valuators;
+ for (i = 0; i < dce->num_valuators; i++)
+ if (dce->valuators[i].scroll.type != SCROLL_TYPE_NONE)
+ len += sizeof(xXIScrollInfo);
+ }
+
nkeys = (dce->keys.max_keycode > 0) ?
dce->keys.max_keycode - dce->keys.min_keycode + 1 : 0;
if (nkeys > 0)
@@ -543,6 +588,15 @@ eventToDeviceChanged(DeviceChangedEvent *dce, xEvent **xi)
dcce->num_classes += dce->num_valuators;
for (i = 0; i < dce->num_valuators; i++)
ptr += appendValuatorInfo(dce, (xXIValuatorInfo*)ptr, i);
+
+ for (i = 0; i < dce->num_valuators; i++)
+ {
+ if (dce->valuators[i].scroll.type != SCROLL_TYPE_NONE)
+ {
+ dcce->num_classes++;
+ ptr += appendScrollInfo(dce, (xXIScrollInfo*)ptr, i);
+ }
+ }
}
*xi = (xEvent*)dcce;
@@ -633,9 +687,7 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
if (BitIsOn(ev->valuators.mask, i))
{
SetBit(ptr, i);
- axisval->integral = trunc(ev->valuators.data[i]);
- axisval->frac = (ev->valuators.data[i] - axisval->integral) *
- (1 << 16) * (1 << 16);
+ *axisval = double_to_fp3232(ev->valuators.data[i]);
axisval++;
}
}
@@ -679,13 +731,8 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
if (BitIsOn(ev->valuators.mask, i))
{
SetBit(ptr, i);
- axisval->integral = trunc(ev->valuators.data[i]);
- axisval->frac = (ev->valuators.data[i] - axisval->integral) *
- (1 << 16) * (1 << 16);
- axisval_raw->integral = trunc(ev->valuators.data_raw[i]);
- axisval_raw->frac =
- (ev->valuators.data_raw[i] - axisval_raw->integral) *
- (1 << 16) * (1 << 16);
+ *axisval = double_to_fp3232(ev->valuators.data[i]);
+ *axisval_raw = double_to_fp3232(ev->valuators.data_raw[i]);
axisval++;
axisval_raw++;
}