[PATCH] input: add POINTER_NORAW to avoid generation of raw events (#30068)

Peter Hutterer peter.hutterer at who-t.net
Thu Jun 23 18:02:23 PDT 2011


RawEvents are supposed to be events coming from the driver. When warping the
pointer, this should not generate a raw event.

X.Org Bug 30068 <http://bugs.freedesktop.org/show_bug.cgi?id=30068>

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 dix/getevents.c |   18 +++++++++++-------
 include/input.h |    9 +++++----
 mi/mipointer.c  |    2 +-
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/dix/getevents.c b/dix/getevents.c
index c935c97..fbc15e0 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1164,14 +1164,17 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons
 
     events = UpdateFromMaster(events, pDev, DEVCHANGE_POINTER_EVENT, &num_events);
 
-    raw = &events->raw_event;
-    events++;
-    num_events++;
-
     valuator_mask_copy(&mask, mask_in);
 
-    init_raw(pDev, raw, ms, type, buttons);
-    set_raw_valuators(raw, &mask, raw->valuators.data_raw);
+    if ((flags & POINTER_NORAW) == 0)
+    {
+	raw = &events->raw_event;
+	events++;
+	num_events++;
+
+	init_raw(pDev, raw, ms, type, buttons);
+	set_raw_valuators(raw, &mask, raw->valuators.data_raw);
+    }
 
     if (flags & POINTER_ABSOLUTE)
     {
@@ -1210,7 +1213,8 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons
         moveRelative(pDev, &x, &y, &mask);
     }
 
-    set_raw_valuators(raw, &mask, raw->valuators.data);
+    if ((flags & POINTER_NORAW) == 0)
+	set_raw_valuators(raw, &mask, raw->valuators.data);
 
     positionSprite(pDev, (flags & POINTER_ABSOLUTE) ? Absolute : Relative,
                    &x, &y, x_frac, y_frac, scr, &cx, &cy, &cx_frac, &cy_frac);
diff --git a/include/input.h b/include/input.h
index 56847ed..5377a0c 100644
--- a/include/input.h
+++ b/include/input.h
@@ -62,10 +62,11 @@ SOFTWARE.
 #define DEVICE_OFF	2
 #define DEVICE_CLOSE	3
 
-#define POINTER_RELATIVE (1 << 1)
-#define POINTER_ABSOLUTE (1 << 2)
-#define POINTER_ACCELERATE (1 << 3)
-#define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */
+#define POINTER_RELATIVE	(1 << 1)
+#define POINTER_ABSOLUTE	(1 << 2)
+#define POINTER_ACCELERATE	(1 << 3)
+#define POINTER_SCREEN		(1 << 4)	/* Data in screen coordinates */
+#define POINTER_NORAW		(1 << 5)	/* Don't generate RawEvents */
 
 /*int constants for pointer acceleration schemes*/
 #define PtrAccelNoOp            0
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 322be9e..7680ca1 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -683,7 +683,7 @@ miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
 
     valuator_mask_set_range(&mask, 0, 2, valuators);
     nevents = GetPointerEvents(events, pDev, MotionNotify, 0,
-                               POINTER_SCREEN | POINTER_ABSOLUTE, &mask);
+                               POINTER_SCREEN | POINTER_ABSOLUTE | POINTER_NORAW, &mask);
 
     OsBlockSignals();
 #ifdef XQUARTZ
-- 
1.7.5.4



More information about the xorg-devel mailing list