diff options
Diffstat (limited to 'xorg-server/dix/getevents.c')
-rw-r--r-- | xorg-server/dix/getevents.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c index 4fbaa6c94..7242c2c79 100644 --- a/xorg-server/dix/getevents.c +++ b/xorg-server/dix/getevents.c @@ -74,6 +74,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 @@ -1042,7 +1057,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 || @@ -1147,9 +1162,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]; } |