diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-11-06 10:27:25 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-11-19 12:12:23 +1000 |
commit | fd214aabf77c44ba0ca3fd438f0c3c8eb22c7211 (patch) | |
tree | 1d74e5ba62bfb4a451ef3cc1d19a37baa9de56f7 | |
parent | 011f8458805e443ac9130865d2840a929a00cabf (diff) |
input: drop FP1616 macro
The double_to_f1616() functions do the same thing, and they're tested.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | Xi/xiquerypointer.c | 17 | ||||
-rw-r--r-- | dix/enterleave.c | 5 | ||||
-rw-r--r-- | dix/eventconvert.c | 4 | ||||
-rw-r--r-- | dix/events.c | 8 | ||||
-rw-r--r-- | include/eventconvert.h | 2 | ||||
-rw-r--r-- | test/xi2/protocol-eventconvert.c | 4 |
6 files changed, 20 insertions, 20 deletions
diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c index 7e6852dd0..e9bdd428d 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 431566ffe..54f4b8554 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 41a3174a6..2e422d7a1 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 e790bfc20..3282ef818 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 4c56d534a..01172f0ee 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) * (1 << 16)) - _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 1188e8b25..bb3177cc1 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++) { |