From 769531b9ccade723a56498b0888af58d085fec9e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 18 Feb 2011 14:19:18 +1000 Subject: [PATCH] Add mode field to pointer movement hooks. Preparation work for pointer barriers. Reviewed-by: Adam Jackson Signed-off-by: Peter Hutterer --- dix/getevents.c | 12 +++++++++--- mi/mipointer.c | 6 +++++- mi/mipointer.h | 1 + 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/dix/getevents.c b/dix/getevents.c index 5b8e3798d..cba616311 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -812,7 +812,11 @@ accelPointer(DeviceIntPtr dev, int first, int num, int *valuators, CARD32 ms) * miPointerSetPosition() and then scale back into device coordinates (if * needed). miPSP will change x/y if the screen was crossed. * + * The coordinates provided are always absolute. The parameter mode whether + * it was relative or absolute movement that landed us at those coordinates. + * * @param dev The device to be moved. + * @param mode Movement mode (Absolute or Relative) * @param x Pointer to current x-axis value, may be modified. * @param y Pointer to current y-axis value, may be modified. * @param x_frac Fractional part of current x-axis value, may be modified. @@ -824,7 +828,8 @@ accelPointer(DeviceIntPtr dev, int first, int num, int *valuators, CARD32 ms) * @param screeny_frac Fractional part of screen y coordinate, as above. */ static void -positionSprite(DeviceIntPtr dev, int *x, int *y, float x_frac, float y_frac, +positionSprite(DeviceIntPtr dev, int mode, + int *x, int *y, float x_frac, float y_frac, ScreenPtr scr, int *screenx, int *screeny, float *screenx_frac, float *screeny_frac) { int old_screenx, old_screeny; @@ -863,7 +868,7 @@ positionSprite(DeviceIntPtr dev, int *x, int *y, float x_frac, float y_frac, old_screeny = *screeny; /* This takes care of crossing screens for us, as well as clipping * to the current screen. */ - miPointerSetPosition(dev, screenx, screeny); + miPointerSetPosition(dev, mode, screenx, screeny); if(!IsMaster(dev) || !IsFloating(dev)) { DeviceIntPtr master = GetMaster(dev, MASTER_POINTER); @@ -1194,7 +1199,8 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, set_raw_valuators(raw, &mask, raw->valuators.data); - positionSprite(pDev, &x, &y, x_frac, y_frac, scr, &cx, &cy, &cx_frac, &cy_frac); + positionSprite(pDev, (flags & POINTER_ABSOLUTE) ? Absolute : Relative, + &x, &y, x_frac, y_frac, scr, &cx, &cy, &cx_frac, &cy_frac); updateHistory(pDev, &mask, ms); /* Update the valuators with the true value sent to the client*/ diff --git a/mi/mipointer.c b/mi/mipointer.c index 209ea06be..520583f46 100644 --- a/mi/mipointer.c +++ b/mi/mipointer.c @@ -560,14 +560,18 @@ miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen, * This function is called during the pointer update path in * GetPointerEvents and friends (and the same in the xwin DDX). * + * The coordinates provided are always absolute. The parameter mode whether + * it was relative or absolute movement that landed us at those coordinates. + * * @param pDev The device to move + * @param mode Movement mode (Absolute or Relative) * @param[in,out] x The x coordiante in screen coordinates (in regards to total * desktop size) * @param[in,out] y The y coordiante in screen coordinates (in regards to total * desktop size) */ void -miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y) +miPointerSetPosition(DeviceIntPtr pDev, int mode, int *x, int *y) { miPointerScreenPtr pScreenPriv; ScreenPtr pScreen; diff --git a/mi/mipointer.h b/mi/mipointer.h index 3c8611022..539096e78 100644 --- a/mi/mipointer.h +++ b/mi/mipointer.h @@ -133,6 +133,7 @@ extern _X_EXPORT void miPointerGetPosition( * x and y are modified in-place. */ extern _X_EXPORT void miPointerSetPosition( DeviceIntPtr pDev, + int mode, int *x, int *y);