[PATCH 1/8] dix: Add IsFloating(device) wrapper.

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


Simplifies check for floating devices.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 dix/events.c  |    7 +++++++
 include/dix.h |    1 +
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 07f8b05..d2be84f 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -328,6 +328,13 @@ IsMaster(DeviceIntPtr dev)
     return dev->type == MASTER_POINTER || dev->type == MASTER_KEYBOARD;
 }
 
+Bool
+IsFloating(DeviceIntPtr dev)
+{
+    return GetMaster(dev, MASTER_KEYBOARD) == NULL;
+}
+
+
 /**
  * Max event opcode.
  */
diff --git a/include/dix.h b/include/dix.h
index 12e4b59..3f99098 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -570,6 +570,7 @@ extern Bool _X_EXPORT IsPointerDevice( DeviceIntPtr dev);
 extern Bool _X_EXPORT IsKeyboardDevice(DeviceIntPtr dev);
 extern Bool IsPointerEvent(InternalEvent *event);
 extern _X_EXPORT Bool IsMaster(DeviceIntPtr dev);
+extern _X_EXPORT Bool IsFloating(DeviceIntPtr dev);
 
 extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
 extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what);
-- 
1.7.4



More information about the xorg-devel mailing list