[PATCH 4/7] (updated) dix: Add EnterWindow, LeaveWindow, HasPointer auxiliary functions.

Peter Hutterer peter.hutterer at who-t.net
Tue Nov 18 18:06:03 PST 2008


These replace the ENTER_LEAVE_SEMAPHORE_* macros. Unused currently.

Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>
---

The newly added HasOtherPointer() function is needed to provide correct
enter/leave event handling during active grabs.

 dix/enterleave.c |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/dix/enterleave.c b/dix/enterleave.c
index 11929c6..57d1f1e 100644
--- a/dix/enterleave.c
+++ b/dix/enterleave.c
@@ -34,6 +34,56 @@
 #include "enterleave.h"
 
 /**
+ * Return TRUE if @win has a pointer within its boundaries, excluding child
+ * window.
+ */
+static BOOL
+HasPointer(WindowPtr win)
+{
+    int i;
+
+    for (i = 0; i < sizeof(win->enterleave); i++)
+        if (win->enterleave[i])
+            return TRUE;
+
+    return FALSE;
+}
+
+static BOOL
+HasOtherPointer(WindowPtr win, DeviceIntPtr dev)
+{
+    int i;
+
+    for (i = 0; i < sizeof(win->enterleave); i++)
+        if (win->enterleave[i] &&
+            !(i == dev->id/8 && win->enterleave[i] == (1 << (dev->id % 8))))
+        {
+            return TRUE;
+        }
+
+    return FALSE;
+}
+
+/**
+ * Set the presence flag for @dev to mark that it is now in @win.
+ */
+static void
+EnterWindow(DeviceIntPtr dev, WindowPtr win, int mode)
+{
+    win->enterleave[dev->id/8] |= (1 << (dev->id % 8));
+}
+
+/**
+ * Unset the presence flag for @dev to mark that it is not in @win anymore.
+ */
+static void
+LeaveWindow(DeviceIntPtr dev, WindowPtr win, int mode)
+{
+    win->enterleave[dev->id/8] &= ~(1 << (dev->id % 8));
+}
+
+
+/**
  * @return The window that is the first ancestor of both a and b.
  */
 WindowPtr
-- 
1.6.0.3

Cheers,
  Peter



More information about the xorg mailing list