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>
This commit is contained in:
Peter Hutterer 2008-11-14 15:27:19 +10:00
parent 6bdc963cda
commit 7d3e595f93
1 changed files with 50 additions and 0 deletions

View File

@ -33,6 +33,56 @@
#include "exglobals.h"
#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.
*/