aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/getevents.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/dix/getevents.c')
-rw-r--r--xorg-server/dix/getevents.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c
index 71d83c4ba..4cf06406d 100644
--- a/xorg-server/dix/getevents.c
+++ b/xorg-server/dix/getevents.c
@@ -75,6 +75,21 @@ typedef const char *string;
#include <Xserver-dtrace.h>
#endif
+#ifdef _MSC_VER
+#include <math.h>
+
+float roundf(float f)
+{
+ return ((f<0.0f) ? ceil(f-.5) : floor (f+.5));
+}
+double roundd(double f)
+{
+ return ((f<0.0) ? ceil(f-.5) : floor (f+.5));
+}
+#define lroundf(val) ((int)roundf(val))
+#define lround(val) ((int)roundd(val))
+#endif
+
/* Number of motion history events to store. */
#define MOTION_HISTORY_SIZE 256
@@ -1070,7 +1085,7 @@ GetKeyboardEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
#endif
/* refuse events from disabled devices */
- if (!pDev->enabled)
+ if (!pDev || !pDev->enabled)
return 0;
if (!events || !pDev->key || !pDev->focus || !pDev->kbdfeed ||
@@ -1175,9 +1190,15 @@ FreeEventList(InternalEvent *list, int num_events)
static void
transform(struct pixman_f_transform *m, double *x, double *y)
{
- struct pixman_f_vector p = {.v = {*x, *y, 1} };
+ struct pixman_f_vector p;
+
+ p.v[0] = *x;
+ p.v[1] = *y;
+ p.v[2] = 1;
+
pixman_f_transform_point(m, &p);
+
*x = p.v[0];
*y = p.v[1];
}
@@ -1327,7 +1348,6 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
RawDeviceEvent *raw;
double screenx = 0.0, screeny = 0.0; /* desktop coordinate system */
double devx = 0.0, devy = 0.0; /* desktop-wide in device coords */
- int sx, sy; /* for POINTER_SCREEN */
ValuatorMask mask;
ScreenPtr scr;
@@ -1370,11 +1390,8 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
/* valuators are in driver-native format (rel or abs) */
if (flags & POINTER_ABSOLUTE) {
- if (flags & POINTER_SCREEN) { /* valuators are in screen coords */
- sx = valuator_mask_get(&mask, 0);
- sy = valuator_mask_get(&mask, 1);
+ if (flags & POINTER_SCREEN) /* valuators are in screen coords */
scale_from_screen(pDev, &mask);
- }
transformAbsolute(pDev, &mask);
clipAbsolute(pDev, &mask);
@@ -1392,18 +1409,6 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
/* valuators are in device coordinate system in absolute coordinates */
scale_to_desktop(pDev, &mask, &devx, &devy, &screenx, &screeny);
-
- /* #53037 XWarpPointer's scaling back and forth between screen and
- device may leave us with rounding errors. End result is that the
- pointer doesn't end up on the pixel it should.
- Avoid this by forcing screenx/screeny back to what the input
- coordinates were.
- */
- if (flags & POINTER_SCREEN) {
- screenx = sx;
- screeny = sy;
- }
-
scr = positionSprite(pDev, (flags & POINTER_ABSOLUTE) ? Absolute : Relative,
&mask, &devx, &devy, &screenx, &screeny);