summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-04-19 21:53:17 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-04-19 21:53:17 +1000
commit443a69833a29b557f78ec09f9eef395f52a64e10 (patch)
tree2475418a396101a911c6e4352df92a69578d38db
parent516a52f9a5b095ab60086426a1945d30a44e7ef2 (diff)
Convert FP1616 from int32_t to double.
-rw-r--r--src/XExtInt.c17
-rw-r--r--src/XQueryDvPtr.c10
2 files changed, 15 insertions, 12 deletions
diff --git a/src/XExtInt.c b/src/XExtInt.c
index dabe80d..c6c2607 100644
--- a/src/XExtInt.c
+++ b/src/XExtInt.c
@@ -69,6 +69,7 @@ SOFTWARE.
#define ENQUEUE_EVENT True
#define DONT_ENQUEUE False
+#define FP1616toDBL(x) ((x) * 1.0 / (1 << 16))
extern void _xibaddevice(
Display * /* dpy */,
@@ -888,10 +889,10 @@ wireToDeviceEvent(xXIDeviceEvent *in, XIDeviceEvent* out)
out->root = in->root;
out->event = in->event;
out->child = in->child;
- out->root_x = in->root_x.integral;
- out->root_y = in->root_y.integral;
- out->event_x = in->event_x.integral;
- out->event_y = in->event_y.integral;
+ out->root_x = FP1616toDBL(in->root_x);
+ out->root_y = FP1616toDBL(in->root_y);
+ out->event_x = FP1616toDBL(in->event_x);
+ out->event_y = FP1616toDBL(in->event_y);
ptr = (char*)&in[1];
@@ -1030,10 +1031,10 @@ wireToEnterLeave(xXIEnterEvent *in, XIEnterEvent *out)
out->event = in->event;
out->child = in->child;
out->sourceid = in->sourceid;
- out->root_x = in->root_x.integral;
- out->root_y = in->root_y.integral;
- out->event_x = in->event_x.integral;
- out->event_y = in->event_y.integral;
+ out->root_x = FP1616toDBL(in->root_x);
+ out->root_y = FP1616toDBL(in->root_y);
+ out->event_x = FP1616toDBL(in->event_x);
+ out->event_y = FP1616toDBL(in->event_y);
out->mode = in->mode;
out->focus = in->focus;
out->same_screen = in->same_screen;
diff --git a/src/XQueryDvPtr.c b/src/XQueryDvPtr.c
index e1b3332..42715ad 100644
--- a/src/XQueryDvPtr.c
+++ b/src/XQueryDvPtr.c
@@ -38,6 +38,8 @@ in this Software without prior written authorization from The Open Group.
#include <X11/extensions/extutil.h>
#include "XIint.h"
+#define FP1616toDBL(x) ((x) * 1.0 / (1 << 16))
+
Bool
XIQueryDevicePointer(Display *dpy,
int deviceid,
@@ -73,10 +75,10 @@ XIQueryDevicePointer(Display *dpy,
*root = rep.root;
*child = rep.child;
- *root_x = cvtINT16toInt(rep.root_x.integral);
- *root_y = cvtINT16toInt(rep.root_y.integral);
- *win_x = cvtINT16toInt(rep.win_x.integral);
- *win_y = cvtINT16toInt(rep.win_y.integral);
+ *root_x = FP1616toDBL(cvtINT16toInt(rep.root_x));
+ *root_y = FP1616toDBL(cvtINT16toInt(rep.root_y));
+ *win_x = FP1616toDBL(cvtINT16toInt(rep.win_x));
+ *win_y = FP1616toDBL(cvtINT16toInt(rep.win_y));
*mask = rep.mask;
UnlockDisplay(dpy);
SyncHandle();