summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2008-12-19 21:05:09 +1000
committerKeith Packard <keithp@keithp.com>2009-01-09 11:21:39 -0800
commitc75445754e283dc2a306ef1cf2bbd94b40423640 (patch)
tree633517fa98a6dc99a0e47ddd44d8d34b9e25cc3e /dix
parentceeb62f892a1a4df9ef1054d2c9ba12e26d55ef2 (diff)
dix: add a few auxiliary functions for the updated focus model.
SetFocusIn and SetFocusOut, including the static array to keep all focus windows. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 673eb23aac578dcdc04e2a99d1fa5c2987eb58b8)
Diffstat (limited to 'dix')
-rw-r--r--dix/enterleave.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/dix/enterleave.c b/dix/enterleave.c
index 105b184ef..659ae052f 100644
--- a/dix/enterleave.c
+++ b/dix/enterleave.c
@@ -55,6 +55,7 @@
*/
static WindowPtr PointerWindows[MAXDEVICES];
+static WindowPtr FocusWindows[MAXDEVICES];
/**
* Return TRUE if @win has a pointer within its boundaries, excluding child
@@ -72,6 +73,17 @@ HasPointer(WindowPtr win)
return FALSE;
}
+static BOOL
+HasFocus(WindowPtr win)
+{
+ int i;
+ for (i = 0; i < MAXDEVICES; i++)
+ if (FocusWindows[i] == win)
+ return TRUE;
+
+ return FALSE;
+}
+
/**
* Search for the first window below @win that has a pointer directly within
* it's boundaries (excluding boundaries of its own descendants).
@@ -92,6 +104,28 @@ FirstPointerChild(WindowPtr win)
return NULL;
}
+/**
+ * Search for the first window below @win that has a pointer directly within
+ * it's boundaries (excluding boundaries of its own descendants).
+ *
+ * @return The child window that has the pointer within its boundaries or
+ * NULL.
+ */
+static WindowPtr
+FirstFocusChild(WindowPtr win)
+{
+ int i;
+ for (i = 0; i < MAXDEVICES; i++)
+ {
+ if (FocusWindows[i] && FocusWindows[i] != PointerRootWin &&
+ IsParent(win, FocusWindows[i]))
+ return FocusWindows[i];
+ }
+
+ return NULL;
+}
+
+
/**
* Set the presence flag for @dev to mark that it is now in @win.
@@ -111,6 +145,26 @@ LeaveWindow(DeviceIntPtr dev, WindowPtr win, int mode)
PointerWindows[dev->id] = NULL;
}
+/**
+ * Set the presence flag for @dev to mark that it is now in @win.
+ */
+void
+SetFocusIn(DeviceIntPtr dev, WindowPtr win)
+{
+ FocusWindows[dev->id] = win;
+}
+
+/**
+ * Unset the presence flag for @dev to mark that it is not in @win anymore.
+ */
+void
+SetFocusOut(DeviceIntPtr dev, WindowPtr win)
+{
+ FocusWindows[dev->id] = NULL;
+}
+
+
+
/**
* @return The window that is the first ancestor of both a and b.