diff options
author | Peter Hutterer <peter.hutterer@redhat.com> | 2008-11-14 15:27:19 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@redhat.com> | 2008-11-25 09:21:45 +1000 |
commit | 7d3e595f93dcd3d334e766a9dea602c05affdbaf (patch) | |
tree | ae493806a1a4fc6cba9e25e5b70202c33800e4b3 /dix | |
parent | 6bdc963cdabb4a2e77de7f00a1d062aa2b873f9b (diff) |
dix: Add EnterWindow, LeaveWindow, HasPointer auxiliary functions.
These replace the ENTER_LEAVE_SEMAPHORE_* macros. Unused currently.
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
Diffstat (limited to 'dix')
-rw-r--r-- | dix/enterleave.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/dix/enterleave.c b/dix/enterleave.c index 11929c6fe..57d1f1e09 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 |