Xi: only DeliverFocusedEvents if the event is not a pointer event.

A pointer device may have a focus class, but even if so, pointer events must
be delivered to the sprite window, not the focus window.
This commit is contained in:
Peter Hutterer 2008-04-10 14:36:57 +09:30
parent 4824942527
commit a88386ee27
3 changed files with 30 additions and 3 deletions

View File

@ -104,6 +104,32 @@ RegisterOtherDevice(DeviceIntPtr device)
device->public.realInputProc = ProcessOtherEvent;
}
_X_EXPORT Bool
IsPointerEvent(xEvent* xE)
{
switch(xE->u.u.type)
{
case ButtonPress:
case ButtonRelease:
case MotionNotify:
case EnterNotify:
case LeaveNotify:
return TRUE;
default:
if (xE->u.u.type == DeviceButtonPress ||
xE->u.u.type == DeviceButtonRelease ||
xE->u.u.type == DeviceMotionNotify ||
xE->u.u.type == DeviceEnterNotify ||
xE->u.u.type == DeviceLeaveNotify ||
xE->u.u.type == ProximityIn ||
xE->u.u.type == ProximityOut)
{
return TRUE;
}
}
return FALSE;
}
/**
* Copy the device->key into master->key and send a mapping notify to the
* clients if appropriate.
@ -830,7 +856,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
if (grab)
DeliverGrabbedEvent(xE, device, deactivateDeviceGrab, count);
else if (device->focus)
else if (device->focus && !IsPointerEvent(xE))
DeliverFocusedEvent(device, xE, GetSpriteWindow(device), count);
else
DeliverDeviceEvents(GetSpriteWindow(device), xE, NullGrab, NullWindow,

View File

@ -1397,7 +1397,7 @@ ComputeFreezes(void)
replayDev->spriteInfo->sprite->spriteTrace[i])
{
if (!CheckDeviceGrabs(replayDev, xE, i+1, count)) {
if (replayDev->focus)
if (replayDev->focus && !IsPointerEvent(xE))
DeliverFocusedEvent(replayDev, xE, w, count);
else
DeliverDeviceEvents(w, xE, NullGrab, NullWindow,
@ -1407,7 +1407,7 @@ ComputeFreezes(void)
}
}
/* must not still be in the same stack */
if (replayDev->focus)
if (replayDev->focus && !IsPointerEvent(xE))
DeliverFocusedEvent(replayDev, xE, w, count);
else
DeliverDeviceEvents(w, xE, NullGrab, NullWindow, replayDev, count);

View File

@ -615,6 +615,7 @@ extern int XItoCoreType(int xi_type);
extern Bool DevHasCursor(DeviceIntPtr pDev);
extern Bool IsPointerDevice( DeviceIntPtr dev);
extern Bool IsKeyboardDevice(DeviceIntPtr dev);
extern Bool IsPointerEvent(xEvent* xE);
/*
* These are deprecated compatibility functions and will be removed soon!