[PATCH] input: drop FP16161 macro
Peter Hutterer
peter.hutterer at who-t.net
Mon Nov 5 16:40:06 PST 2012
The double_to_f1616() functions do the same thing, and they're tested.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Turns out we already have these functions and the macro was just a leftover
from earlier, happier times.
Xi/xiquerypointer.c | 17 +++++++++--------
dix/enterleave.c | 5 +++--
dix/eventconvert.c | 4 ++--
dix/events.c | 8 ++++----
include/eventconvert.h | 2 --
test/xi2/protocol-eventconvert.c | 4 ++--
6 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c
index 7e6852d..e9bdd42 100644
--- a/Xi/xiquerypointer.c
+++ b/Xi/xiquerypointer.c
@@ -50,6 +50,7 @@
#include "panoramiXsrv.h"
#endif
+#include "inpututils.h"
#include "xiquerypointer.h"
/***********************************************************************
@@ -127,8 +128,8 @@ ProcXIQueryPointer(ClientPtr client)
.sequenceNumber = client->sequence,
.length = 6,
.root = (GetCurrentRootWindow(pDev))->drawable.id,
- .root_x = FP1616(pSprite->hot.x, 0),
- .root_y = FP1616(pSprite->hot.y, 0),
+ .root_x = double_to_fp1616(pSprite->hot.x),
+ .root_y = double_to_fp1616(pSprite->hot.y),
.child = None
};
@@ -166,8 +167,8 @@ ProcXIQueryPointer(ClientPtr client)
if (pSprite->hot.pScreen == pWin->drawable.pScreen) {
rep.same_screen = xTrue;
- rep.win_x = FP1616(pSprite->hot.x - pWin->drawable.x, 0);
- rep.win_y = FP1616(pSprite->hot.y - pWin->drawable.y, 0);
+ rep.win_x = double_to_fp1616(pSprite->hot.x - pWin->drawable.x);
+ rep.win_y = double_to_fp1616(pSprite->hot.y - pWin->drawable.y);
for (t = pSprite->win; t; t = t->parent)
if (t->parent == pWin) {
rep.child = t->drawable.id;
@@ -182,11 +183,11 @@ ProcXIQueryPointer(ClientPtr client)
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- rep.root_x += FP1616(screenInfo.screens[0]->x, 0);
- rep.root_y += FP1616(screenInfo.screens[0]->y, 0);
+ rep.root_x += double_to_fp1616(screenInfo.screens[0]->x);
+ rep.root_y += double_to_fp1616(screenInfo.screens[0]->y);
if (stuff->win == rep.root) {
- rep.win_x += FP1616(screenInfo.screens[0]->x, 0);
- rep.win_y += FP1616(screenInfo.screens[0]->y, 0);
+ rep.win_x += double_to_fp1616(screenInfo.screens[0]->x);
+ rep.win_y += double_to_fp1616(screenInfo.screens[0]->y);
}
}
#endif
diff --git a/dix/enterleave.c b/dix/enterleave.c
index 431566f..54f4b85 100644
--- a/dix/enterleave.c
+++ b/dix/enterleave.c
@@ -39,6 +39,7 @@
#include "enterleave.h"
#include "eventconvert.h"
#include "xkbsrv.h"
+#include "inpututils.h"
/**
* @file
@@ -799,8 +800,8 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
xi2event->deviceid = dev->id;
xi2event->sourceid = dev->id; /* a device doesn't change focus by itself */
xi2event->mode = mode;
- xi2event->root_x = FP1616(mouse->spriteInfo->sprite->hot.x, 0);
- xi2event->root_y = FP1616(mouse->spriteInfo->sprite->hot.y, 0);
+ xi2event->root_x = double_to_fp1616(mouse->spriteInfo->sprite->hot.x);
+ xi2event->root_y = double_to_fp1616(mouse->spriteInfo->sprite->hot.y);
for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++)
if (BitIsOn(mouse->button->down, i))
diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 41a3174..2e422d7 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -673,8 +673,8 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
xde->valuators_len = vallen;
xde->deviceid = ev->deviceid;
xde->sourceid = ev->sourceid;
- xde->root_x = FP1616(ev->root_x, ev->root_x_frac);
- xde->root_y = FP1616(ev->root_y, ev->root_y_frac);
+ xde->root_x = double_to_fp1616(ev->root_x + ev->root_x_frac);
+ xde->root_y = double_to_fp1616(ev->root_y + ev->root_y_frac);
if (ev->type == ET_TouchUpdate)
xde->flags |= (ev->flags & TOUCH_PENDING_END) ? XITouchPendingEnd : 0;
diff --git a/dix/events.c b/dix/events.c
index ddb5b34..c309a00 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2444,8 +2444,8 @@ FixUpEventFromWindow(SpritePtr pSprite,
}
if (pSprite->hot.pScreen == pWin->drawable.pScreen) {
- event->event_x = event->root_x - FP1616(pWin->drawable.x, 0);
- event->event_y = event->root_y - FP1616(pWin->drawable.y, 0);
+ event->event_x = event->root_x - double_to_fp1616(pWin->drawable.x);
+ event->event_y = event->root_y - double_to_fp1616(pWin->drawable.y);
event->child = child;
}
else {
@@ -4573,8 +4573,8 @@ DeviceEnterLeaveEvent(DeviceIntPtr mouse,
event->deviceid = mouse->id;
event->sourceid = sourceid;
event->mode = mode;
- event->root_x = FP1616(mouse->spriteInfo->sprite->hot.x, 0);
- event->root_y = FP1616(mouse->spriteInfo->sprite->hot.y, 0);
+ event->root_x = double_to_fp1616(mouse->spriteInfo->sprite->hot.x);
+ event->root_y = double_to_fp1616(mouse->spriteInfo->sprite->hot.y);
for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++)
if (BitIsOn(mouse->button->down, i))
diff --git a/include/eventconvert.h b/include/eventconvert.h
index cf86eb3..01172f0 100644
--- a/include/eventconvert.h
+++ b/include/eventconvert.h
@@ -29,8 +29,6 @@
#include "events.h"
#include "eventstr.h"
-#define FP1616(integral, frac) ((integral) * (1 << 16) + (frac))
-
_X_EXPORT int EventToCore(InternalEvent *event, xEvent **core, int *count);
_X_EXPORT int EventToXI(InternalEvent *ev, xEvent **xi, int *count);
_X_EXPORT int EventToXI2(InternalEvent *ev, xEvent **xi);
diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
index 1188e8b..bb3177c 100644
--- a/test/xi2/protocol-eventconvert.c
+++ b/test/xi2/protocol-eventconvert.c
@@ -338,8 +338,8 @@ test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent * out, BOOL swap)
assert(out->event_x == 0); /* set in FixUpEventFromWindow */
assert(out->event_y == 0); /* set in FixUpEventFromWindow */
- assert(out->root_x == FP1616(in->root_x, in->root_x_frac));
- assert(out->root_y == FP1616(in->root_y, in->root_y_frac));
+ assert(out->root_x == double_to_fp1616(in->root_x + in->root_x_frac));
+ assert(out->root_y == double_to_fp1616(in->root_y + in->root_y_frac));
buttons = 0;
for (i = 0; i < bits_to_bytes(sizeof(in->buttons)); i++) {
--
1.7.11.7
More information about the xorg-devel
mailing list