[PATCH 2/8] Add mode field to pointer movement hooks.

Peter Hutterer peter.hutterer at who-t.net
Mon Feb 21 19:51:18 PST 2011


Preparation work for pointer barriers.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 dix/getevents.c |   12 +++++++++---
 mi/mipointer.c  |   19 ++++++++++++++++++-
 mi/mipointer.h  |    1 +
 3 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/dix/getevents.c b/dix/getevents.c
index 794df42..70f8728 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 (dev->u.master) {
         dev->u.master->last.valuators[0] = *screenx;
@@ -1193,7 +1198,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 554397a..0ecd915 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -483,8 +483,25 @@ miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen,
     pPointer->pScreen = pScreen;
 }
 
+/**
+ * Set the devices' cursor position to the given x/y position.
+ *
+ * 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 3c86110..539096e 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);
 
-- 
1.7.4



More information about the xorg-devel mailing list