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.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c
index 7a24b801e..efe0c4287 100644
--- a/xorg-server/dix/getevents.c
+++ b/xorg-server/dix/getevents.c
@@ -62,6 +62,16 @@
#include "extnsionst.h"
#include "listdev.h" /* for sizing up DeviceClassesChangedEvent */
+#ifdef _MSC_VER
+#include <math.h>
+
+float roundf(float f)
+{
+ return ((f<0.0f) ? ceil(f-.5) : floor (f+.5));
+}
+#define lroundf(val) ((int)roundf(val))
+#endif
+
/* Number of motion history events to store. */
#define MOTION_HISTORY_SIZE 256
@@ -887,7 +897,7 @@ GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type,
RawDeviceEvent *raw;
/* refuse events from disabled devices */
- if (!pDev->enabled)
+ if (!pDev || !pDev->enabled)
return 0;
if (!events ||!pDev->key || !pDev->focus || !pDev->kbdfeed ||