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

peter.hutterer at who-t.net peter.hutterer at who-t.net
Fri Nov 14 02:51:13 PST 2008


From: Peter Hutterer <peter.hutterer at redhat.com>

These replace the ENTER_LEAVE_SEMAPHORE_* macros. Unused currently.

Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>
---
 dix/enterleave.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/dix/enterleave.c b/dix/enterleave.c
index 11929c6..79d15fd 100644
--- a/dix/enterleave.c
+++ b/dix/enterleave.c
@@ -34,6 +34,44 @@
 #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;
+}
+
+/**
+ * Set the presence flag for @dev to mark that it is now in @win.
+ */
+static void
+EnterWindow(DeviceIntPtr dev, WindowPtr win, int mode)
+{
+
+    if (dev->isMaster && mode != NotifyGrab)
+        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)
+{
+    if (dev->isMaster && mode != NotifyUngrab)
+        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




More information about the xorg mailing list