Xi: send XI2 focus events.
This commit is contained in:
parent
daf7dd3bfe
commit
3f37923a72
|
@ -1164,15 +1164,58 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
|
|||
WindowPtr pWin)
|
||||
{
|
||||
deviceFocus event;
|
||||
xXIFocusInEvent *xi2event;
|
||||
DeviceIntPtr mouse;
|
||||
int btlen, len, i;
|
||||
|
||||
if (type == FocusIn)
|
||||
type = DeviceFocusIn;
|
||||
else
|
||||
type = DeviceFocusOut;
|
||||
mouse = (dev->isMaster || dev->u.master) ? GetPairedDevice(dev) : NULL;
|
||||
|
||||
/* XI 2 event */
|
||||
btlen = (mouse->button) ? (mouse->button->numButtons + 7)/8 : 0;
|
||||
btlen = (btlen + 3)/4;
|
||||
len = sizeof(xXIFocusInEvent) + btlen * 4;
|
||||
|
||||
xi2event = xcalloc(1, len);
|
||||
xi2event->type = GenericEvent;
|
||||
xi2event->extension = IReqCode;
|
||||
xi2event->evtype = type;
|
||||
xi2event->length = (len - sizeof(xEvent))/4;
|
||||
xi2event->buttons_len = btlen;
|
||||
xi2event->detail = detail;
|
||||
xi2event->time = currentTime.milliseconds;
|
||||
xi2event->deviceid = dev->id;
|
||||
xi2event->sourceid = 0; /*XXX */
|
||||
xi2event->mode = mode;
|
||||
xi2event->root_x.integral = mouse->spriteInfo->sprite->hot.x;
|
||||
xi2event->root_y.integral = mouse->spriteInfo->sprite->hot.y;
|
||||
|
||||
for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++)
|
||||
if (BitIsOn(mouse->button->down, i))
|
||||
SetBit(&xi2event[1], i);
|
||||
|
||||
if (dev->key)
|
||||
{
|
||||
xi2event->mods.base_mods = dev->key->xkbInfo->state.base_mods;
|
||||
xi2event->mods.latched_mods = dev->key->xkbInfo->state.latched_mods;
|
||||
xi2event->mods.locked_mods = dev->key->xkbInfo->state.locked_mods;
|
||||
|
||||
xi2event->group.base_group = dev->key->xkbInfo->state.base_group;
|
||||
xi2event->group.latched_group = dev->key->xkbInfo->state.latched_group;
|
||||
xi2event->group.locked_group = dev->key->xkbInfo->state.locked_group;
|
||||
}
|
||||
|
||||
FixUpEventFromWindow(dev, (xEvent*)xi2event, pWin, None, FALSE);
|
||||
|
||||
DeliverEventsToWindow(dev, pWin, (xEvent*)xi2event, 1,
|
||||
GetWindowXI2Mask(dev, pWin, xi2event), NullGrab,
|
||||
dev->id);
|
||||
|
||||
xfree(xi2event);
|
||||
|
||||
/* XI 1.x event */
|
||||
event.deviceid = dev->id;
|
||||
event.mode = mode;
|
||||
event.type = type;
|
||||
event.type = (type == XI_FocusIn) ? DeviceFocusIn : DeviceFocusOut;
|
||||
event.detail = detail;
|
||||
event.window = pWin->drawable.id;
|
||||
event.time = currentTime.milliseconds;
|
||||
|
|
|
@ -629,7 +629,7 @@ DeviceFocusOutEvents(DeviceIntPtr dev,
|
|||
if (ancestor == child)
|
||||
return;
|
||||
for (win = child->parent; win != ancestor; win = win->parent)
|
||||
DeviceFocusEvent(dev, DeviceFocusOut, mode, detail, win);
|
||||
DeviceFocusEvent(dev, XI_FocusOut, mode, detail, win);
|
||||
}
|
||||
|
||||
|
||||
|
@ -650,7 +650,7 @@ DeviceFocusInEvents(DeviceIntPtr dev,
|
|||
if (ancestor == parent || !parent)
|
||||
return;
|
||||
DeviceFocusInEvents(dev, ancestor, parent, mode, detail);
|
||||
DeviceFocusEvent(dev, DeviceFocusIn, mode, detail, parent);
|
||||
DeviceFocusEvent(dev, XI_FocusIn, mode, detail, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1275,21 +1275,21 @@ DeviceFocusEvents(DeviceIntPtr dev,
|
|||
NotifyPointer);
|
||||
/* Notify all the roots */
|
||||
for (i = 0; i < nscreens; i++)
|
||||
DeviceFocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
|
||||
DeviceFocusEvent(dev, XI_FocusOut, mode, out, WindowTable[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsParent(from, sprite->win))
|
||||
DeviceFocusOutEvents(dev, sprite->win, from, mode,
|
||||
NotifyPointer);
|
||||
DeviceFocusEvent(dev, FocusOut, mode, NotifyNonlinear, from);
|
||||
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyNonlinear, from);
|
||||
/* next call catches the root too, if the screen changed */
|
||||
DeviceFocusOutEvents(dev, from->parent, NullWindow, mode,
|
||||
NotifyNonlinearVirtual);
|
||||
}
|
||||
/* Notify all the roots */
|
||||
for (i = 0; i < nscreens; i++)
|
||||
DeviceFocusEvent(dev, FocusIn, mode, in, WindowTable[i]);
|
||||
DeviceFocusEvent(dev, XI_FocusIn, mode, in, WindowTable[i]);
|
||||
if (to == PointerRootWin)
|
||||
DeviceFocusInEvents(dev, RootWindow(dev), sprite->win, mode, NotifyPointer);
|
||||
}
|
||||
|
@ -1301,10 +1301,10 @@ DeviceFocusEvents(DeviceIntPtr dev,
|
|||
DeviceFocusOutEvents(dev, sprite->win, RootWindow(dev), mode,
|
||||
NotifyPointer);
|
||||
for (i = 0; i < nscreens; i++)
|
||||
DeviceFocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
|
||||
DeviceFocusEvent(dev, XI_FocusOut, mode, out, WindowTable[i]);
|
||||
if (to->parent != NullWindow)
|
||||
DeviceFocusInEvents(dev, RootWindow(dev), to, mode, NotifyNonlinearVirtual);
|
||||
DeviceFocusEvent(dev, FocusIn, mode, NotifyNonlinear, to);
|
||||
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to);
|
||||
if (IsParent(to, sprite->win))
|
||||
DeviceFocusInEvents(dev, to, sprite->win, mode, NotifyPointer);
|
||||
}
|
||||
|
@ -1312,10 +1312,10 @@ DeviceFocusEvents(DeviceIntPtr dev,
|
|||
{
|
||||
if (IsParent(to, from))
|
||||
{
|
||||
DeviceFocusEvent(dev, FocusOut, mode, NotifyAncestor, from);
|
||||
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyAncestor, from);
|
||||
DeviceFocusOutEvents(dev, from->parent, to, mode,
|
||||
NotifyVirtual);
|
||||
DeviceFocusEvent(dev, FocusIn, mode, NotifyInferior, to);
|
||||
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyInferior, to);
|
||||
if ((IsParent(to, sprite->win)) &&
|
||||
(sprite->win != from) &&
|
||||
(!IsParent(from, sprite->win)) &&
|
||||
|
@ -1331,9 +1331,9 @@ DeviceFocusEvents(DeviceIntPtr dev,
|
|||
(!IsParent(sprite->win, to)))
|
||||
DeviceFocusOutEvents(dev, sprite->win, from, mode,
|
||||
NotifyPointer);
|
||||
DeviceFocusEvent(dev, FocusOut, mode, NotifyInferior, from);
|
||||
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyInferior, from);
|
||||
DeviceFocusInEvents(dev, from, to, mode, NotifyVirtual);
|
||||
DeviceFocusEvent(dev, FocusIn, mode, NotifyAncestor, to);
|
||||
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyAncestor, to);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1343,13 +1343,13 @@ DeviceFocusEvents(DeviceIntPtr dev,
|
|||
if (IsParent(from, sprite->win))
|
||||
DeviceFocusOutEvents(dev, sprite->win, from, mode,
|
||||
NotifyPointer);
|
||||
DeviceFocusEvent(dev, FocusOut, mode, NotifyNonlinear, from);
|
||||
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyNonlinear, from);
|
||||
if (from->parent != NullWindow)
|
||||
DeviceFocusOutEvents(dev, from->parent, common, mode,
|
||||
NotifyNonlinearVirtual);
|
||||
if (to->parent != NullWindow)
|
||||
DeviceFocusInEvents(dev, common, to, mode, NotifyNonlinearVirtual);
|
||||
DeviceFocusEvent(dev, FocusIn, mode, NotifyNonlinear, to);
|
||||
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to);
|
||||
if (IsParent(to, sprite->win))
|
||||
DeviceFocusInEvents(dev, to, sprite->win, mode, NotifyPointer);
|
||||
}
|
||||
|
|
|
@ -2160,7 +2160,7 @@ static Window FindChildForEvent(DeviceIntPtr dev, WindowPtr event)
|
|||
* @param child Child window setting for event (if applicable)
|
||||
* @param calcChild If True, calculate the child window.
|
||||
*/
|
||||
static void
|
||||
void
|
||||
FixUpEventFromWindow(
|
||||
DeviceIntPtr pDev,
|
||||
xEvent *xE,
|
||||
|
|
Loading…
Reference in New Issue