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>
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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))
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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))
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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++) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user