Merge remote branch 'whot/for-keith'

This commit is contained in:
Keith Packard 2010-07-21 11:56:39 -07:00
commit 9fbbff3c04
2 changed files with 34 additions and 25 deletions

View File

@ -78,10 +78,19 @@ static WindowPtr FocusWindows[MAXDEVICES];
* window. * window.
*/ */
static BOOL static BOOL
HasPointer(WindowPtr win) HasPointer(DeviceIntPtr dev, WindowPtr win)
{ {
int i; int i;
/* FIXME: The enter/leave model does not cater for grabbed devices. For
* now, a quickfix: if the device about to send an enter/leave event to
* a window is grabbed, assume there is no pointer in that window.
* Fixes fdo 27804.
* There isn't enough beer in my fridge to fix this properly.
*/
if (dev->deviceGrab.grab)
return FALSE;
for (i = 0; i < MAXDEVICES; i++) for (i = 0; i < MAXDEVICES; i++)
if (PointerWindows[i] == win) if (PointerWindows[i] == win)
return TRUE; return TRUE;
@ -270,7 +279,7 @@ CoreEnterNotifies(DeviceIntPtr dev,
may need to be changed from Virtual to NonlinearVirtual depending may need to be changed from Virtual to NonlinearVirtual depending
on the previous P(W). */ on the previous P(W). */
if (!HasPointer(parent) && !FirstPointerChild(parent)) if (!HasPointer(dev, parent) && !FirstPointerChild(parent))
CoreEnterLeaveEvent(dev, EnterNotify, mode, detail, parent, CoreEnterLeaveEvent(dev, EnterNotify, mode, detail, parent,
child->drawable.id); child->drawable.id);
} }
@ -309,7 +318,7 @@ CoreLeaveNotifies(DeviceIntPtr dev,
/* If one window has a pointer or a child with a pointer, skip some /* If one window has a pointer or a child with a pointer, skip some
* work and exit. */ * work and exit. */
if (HasPointer(win) || FirstPointerChild(win)) if (HasPointer(dev, win) || FirstPointerChild(win))
return; return;
CoreEnterLeaveEvent(dev, LeaveNotify, mode, detail, win, child->drawable.id); CoreEnterLeaveEvent(dev, LeaveNotify, mode, detail, win, child->drawable.id);
@ -373,7 +382,7 @@ CoreEnterLeaveNonLinear(DeviceIntPtr dev,
vice versa depending on the the new P(W) vice versa depending on the the new P(W)
*/ */
if (!HasPointer(A)) if (!HasPointer(dev, A))
{ {
WindowPtr child = FirstPointerChild(A); WindowPtr child = FirstPointerChild(A);
if (child) if (child)
@ -417,7 +426,7 @@ CoreEnterLeaveNonLinear(DeviceIntPtr dev,
The detail may need to be changed from Ancestor to Nonlinear The detail may need to be changed from Ancestor to Nonlinear
or vice-versa depending on the previous P(W). */ or vice-versa depending on the previous P(W). */
if (!HasPointer(B)) if (!HasPointer(dev, B))
{ {
WindowPtr child = FirstPointerChild(B); WindowPtr child = FirstPointerChild(B);
if (child) if (child)
@ -455,7 +464,7 @@ CoreEnterLeaveToAncestor(DeviceIntPtr dev,
The detail may need to be changed from Ancestor to Nonlinear or The detail may need to be changed from Ancestor to Nonlinear or
vice versa depending on the the new P(W) vice versa depending on the the new P(W)
*/ */
if (!HasPointer(A)) if (!HasPointer(dev, A))
{ {
WindowPtr child = FirstPointerChild(A); WindowPtr child = FirstPointerChild(A);
if (child) if (child)
@ -479,7 +488,7 @@ CoreEnterLeaveToAncestor(DeviceIntPtr dev,
P(W) changes from a descendant to W itself. The subwindow P(W) changes from a descendant to W itself. The subwindow
field should be set to the child containing the old P(W) <<< WRONG */ field should be set to the child containing the old P(W) <<< WRONG */
if (!HasPointer(B)) if (!HasPointer(dev, B))
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B, None); CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B, None);
} }
@ -507,7 +516,7 @@ CoreEnterLeaveToDescendant(DeviceIntPtr dev,
P(W) changes from W to a descendant of W. The subwindow field P(W) changes from W to a descendant of W. The subwindow field
is set to the child containing the new P(W) <<< THIS IS WRONG */ is set to the child containing the new P(W) <<< THIS IS WRONG */
if (!HasPointer(A)) if (!HasPointer(dev, A))
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, None); CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, None);
@ -531,7 +540,7 @@ CoreEnterLeaveToDescendant(DeviceIntPtr dev,
The detail may need to be changed from Ancestor to Nonlinear The detail may need to be changed from Ancestor to Nonlinear
or vice-versa depending on the previous P(W). */ or vice-versa depending on the previous P(W). */
if (!HasPointer(B)) if (!HasPointer(dev, B))
{ {
WindowPtr child = FirstPointerChild(B); WindowPtr child = FirstPointerChild(B);
if (child) if (child)

View File

@ -523,7 +523,7 @@ ProcXkbBell(ClientPtr client)
DeviceIntPtr other; DeviceIntPtr other;
for (other = inputInfo.devices; other; other = other->next) for (other = inputInfo.devices; other; other = other->next)
{ {
if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
{ {
rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixBellAccess); rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixBellAccess);
if (rc == Success) if (rc == Success)
@ -606,7 +606,7 @@ ProcXkbLatchLockState(ClientPtr client)
status = Success; status = Success;
for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) { for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) {
if ((tmpd == dev) || (!IsMaster(tmpd) && tmpd->u.master == dev)) { if ((tmpd == dev) || (!IsMaster(tmpd) && GetMaster(tmpd, MASTER_KEYBOARD) == dev)) {
if (!tmpd->key || !tmpd->key->xkbInfo) if (!tmpd->key || !tmpd->key->xkbInfo)
continue; continue;
@ -748,7 +748,7 @@ ProcXkbSetControls(ClientPtr client)
for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) { for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) {
if (!tmpd->key || !tmpd->key->xkbInfo) if (!tmpd->key || !tmpd->key->xkbInfo)
continue; continue;
if ((tmpd == dev) || (!IsMaster(tmpd) && tmpd->u.master == dev)) { if ((tmpd == dev) || (!IsMaster(tmpd) && GetMaster(tmpd, MASTER_KEYBOARD) == dev)) {
xkbi = tmpd->key->xkbInfo; xkbi = tmpd->key->xkbInfo;
ctrl = xkbi->desc->ctrls; ctrl = xkbi->desc->ctrls;
new = *ctrl; new = *ctrl;
@ -2558,7 +2558,7 @@ ProcXkbSetMap(ClientPtr client)
DeviceIntPtr other; DeviceIntPtr other;
for (other = inputInfo.devices; other; other = other->next) for (other = inputInfo.devices; other; other = other->next)
{ {
if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
{ {
rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
if (rc == Success) if (rc == Success)
@ -2581,7 +2581,7 @@ ProcXkbSetMap(ClientPtr client)
DeviceIntPtr other; DeviceIntPtr other;
for (other = inputInfo.devices; other; other = other->next) for (other = inputInfo.devices; other; other = other->next)
{ {
if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
{ {
rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
if (rc == Success) if (rc == Success)
@ -2887,7 +2887,7 @@ ProcXkbSetCompatMap(ClientPtr client)
DeviceIntPtr other; DeviceIntPtr other;
for (other = inputInfo.devices; other; other = other->next) for (other = inputInfo.devices; other; other = other->next)
{ {
if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
{ {
rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
if (rc == Success) if (rc == Success)
@ -2910,7 +2910,7 @@ ProcXkbSetCompatMap(ClientPtr client)
DeviceIntPtr other; DeviceIntPtr other;
for (other = inputInfo.devices; other; other = other->next) for (other = inputInfo.devices; other; other = other->next)
{ {
if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
{ {
rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
if (rc == Success) if (rc == Success)
@ -3165,7 +3165,7 @@ ProcXkbSetIndicatorMap(ClientPtr client)
DeviceIntPtr other; DeviceIntPtr other;
for (other = inputInfo.devices; other; other = other->next) for (other = inputInfo.devices; other; other = other->next)
{ {
if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
{ {
rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess); rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess);
if (rc == Success) if (rc == Success)
@ -3434,7 +3434,7 @@ ProcXkbSetNamedIndicator(ClientPtr client)
DeviceIntPtr other; DeviceIntPtr other;
for (other = inputInfo.devices; other; other = other->next) for (other = inputInfo.devices; other; other = other->next)
{ {
if ((other != dev) && !IsMaster(other) && (other->u.master == dev) && if ((other != dev) && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev &&
(other->kbdfeed || other->leds) && (other->kbdfeed || other->leds) &&
(XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess) == Success)) (XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess) == Success))
{ {
@ -3458,7 +3458,7 @@ ProcXkbSetNamedIndicator(ClientPtr client)
DeviceIntPtr other; DeviceIntPtr other;
for (other = inputInfo.devices; other; other = other->next) for (other = inputInfo.devices; other; other = other->next)
{ {
if ((other != dev) && !IsMaster(other) && (other->u.master == dev) && if ((other != dev) && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev &&
(other->kbdfeed || other->leds) && (other->kbdfeed || other->leds) &&
(XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess) == Success)) (XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess) == Success))
{ {
@ -4249,7 +4249,7 @@ ProcXkbSetNames(ClientPtr client)
DeviceIntPtr other; DeviceIntPtr other;
for (other = inputInfo.devices; other; other = other->next) for (other = inputInfo.devices; other; other = other->next)
{ {
if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
{ {
rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
@ -4274,7 +4274,7 @@ ProcXkbSetNames(ClientPtr client)
DeviceIntPtr other; DeviceIntPtr other;
for (other = inputInfo.devices; other; other = other->next) for (other = inputInfo.devices; other; other = other->next)
{ {
if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
{ {
rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
@ -5328,7 +5328,7 @@ ProcXkbSetGeometry(ClientPtr client)
DeviceIntPtr other; DeviceIntPtr other;
for (other = inputInfo.devices; other; other = other->next) for (other = inputInfo.devices; other; other = other->next)
{ {
if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
{ {
rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
if (rc == Success) if (rc == Success)
@ -5840,7 +5840,7 @@ ProcXkbGetKbdByName(ClientPtr client)
xkb->ctrls->num_groups= nTG; xkb->ctrls->num_groups= nTG;
for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) { for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) {
if ((tmpd == dev) || (!IsMaster(tmpd) && tmpd->u.master == dev)) { if ((tmpd == dev) || (!IsMaster(tmpd) && GetMaster(tmpd, MASTER_KEYBOARD) == dev)) {
if (tmpd != dev) if (tmpd != dev)
XkbCopyDeviceKeymap(tmpd, dev); XkbCopyDeviceKeymap(tmpd, dev);
@ -6519,7 +6519,7 @@ ProcXkbSetDeviceInfo(ClientPtr client)
DeviceIntPtr other; DeviceIntPtr other;
for (other = inputInfo.devices; other; other = other->next) for (other = inputInfo.devices; other; other = other->next)
{ {
if (((other != dev) && !IsMaster(other) && (other->u.master == dev)) && if (((other != dev) && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev) &&
((stuff->deviceSpec == XkbUseCoreKbd && other->key) || ((stuff->deviceSpec == XkbUseCoreKbd && other->key) ||
(stuff->deviceSpec == XkbUseCorePtr && other->button))) (stuff->deviceSpec == XkbUseCorePtr && other->button)))
{ {
@ -6544,7 +6544,7 @@ ProcXkbSetDeviceInfo(ClientPtr client)
DeviceIntPtr other; DeviceIntPtr other;
for (other = inputInfo.devices; other; other = other->next) for (other = inputInfo.devices; other; other = other->next)
{ {
if (((other != dev) && !IsMaster(other) && (other->u.master == dev)) && if (((other != dev) && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev) &&
((stuff->deviceSpec == XkbUseCoreKbd && other->key) || ((stuff->deviceSpec == XkbUseCoreKbd && other->key) ||
(stuff->deviceSpec == XkbUseCorePtr && other->button))) (stuff->deviceSpec == XkbUseCorePtr && other->button)))
{ {