diff options
Diffstat (limited to 'xserver/dix/enterleave.c')
-rw-r--r-- | xserver/dix/enterleave.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/xserver/dix/enterleave.c b/xserver/dix/enterleave.c index c08cc3100..7a3ecf5b0 100644 --- a/xserver/dix/enterleave.c +++ b/xserver/dix/enterleave.c @@ -78,10 +78,19 @@ static WindowPtr FocusWindows[MAXDEVICES]; * window. */ static BOOL -HasPointer(WindowPtr win) +HasPointer(DeviceIntPtr dev, WindowPtr win) { 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++) if (PointerWindows[i] == win) return TRUE; @@ -270,7 +279,7 @@ CoreEnterNotifies(DeviceIntPtr dev, may need to be changed from Virtual to NonlinearVirtual depending on the previous P(W). */ - if (!HasPointer(parent) && !FirstPointerChild(parent)) + if (!HasPointer(dev, parent) && !FirstPointerChild(parent)) CoreEnterLeaveEvent(dev, EnterNotify, mode, detail, parent, child->drawable.id); } @@ -309,7 +318,7 @@ CoreLeaveNotifies(DeviceIntPtr dev, /* If one window has a pointer or a child with a pointer, skip some * work and exit. */ - if (HasPointer(win) || FirstPointerChild(win)) + if (HasPointer(dev, win) || FirstPointerChild(win)) return; 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) */ - if (!HasPointer(A)) + if (!HasPointer(dev, A)) { WindowPtr child = FirstPointerChild(A); if (child) @@ -417,7 +426,7 @@ CoreEnterLeaveNonLinear(DeviceIntPtr dev, The detail may need to be changed from Ancestor to Nonlinear or vice-versa depending on the previous P(W). */ - if (!HasPointer(B)) + if (!HasPointer(dev, B)) { WindowPtr child = FirstPointerChild(B); if (child) @@ -455,7 +464,7 @@ CoreEnterLeaveToAncestor(DeviceIntPtr dev, The detail may need to be changed from Ancestor to Nonlinear or vice versa depending on the the new P(W) */ - if (!HasPointer(A)) + if (!HasPointer(dev, A)) { WindowPtr child = FirstPointerChild(A); if (child) @@ -479,7 +488,7 @@ CoreEnterLeaveToAncestor(DeviceIntPtr dev, P(W) changes from a descendant to W itself. The subwindow 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); } @@ -507,7 +516,7 @@ CoreEnterLeaveToDescendant(DeviceIntPtr dev, 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 */ - if (!HasPointer(A)) + if (!HasPointer(dev, A)) 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 or vice-versa depending on the previous P(W). */ - if (!HasPointer(B)) + if (!HasPointer(dev, B)) { WindowPtr child = FirstPointerChild(B); if (child) @@ -1077,7 +1086,7 @@ CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev, for (i = 0; i < nscreens; i++) { - root = WindowTable[i]; + root = screenInfo.screens[i]->root; if (!HasOtherPointer(root, GetPairedDevice(dev)) && !FirstFocusChild(root)) { /* If pointer was on PointerRootWin and changes to NoneWin, and @@ -1138,7 +1147,7 @@ CoreFocusToPointerRootOrNone(DeviceIntPtr dev, for (i = 0; i < nscreens; i++) { - root = WindowTable[i]; + root = screenInfo.screens[i]->root; if (!HasFocus(root) && !FirstFocusChild(root)) { CoreFocusEvent(dev, FocusIn, mode, B ? NotifyPointerRoot : NotifyDetailNone, root); @@ -1169,7 +1178,7 @@ CoreFocusFromPointerRootOrNone(DeviceIntPtr dev, for (i = 0; i < nscreens; i++) { - root = WindowTable[i]; + root = screenInfo.screens[i]->root; if (!HasFocus(root) && !FirstFocusChild(root)) { /* If pointer was on PointerRootWin and changes to NoneWin, and @@ -1279,7 +1288,7 @@ DeviceFocusEvents(DeviceIntPtr dev, NotifyPointer); /* Notify all the roots */ for (i = 0; i < nscreens; i++) - DeviceFocusEvent(dev, XI_FocusOut, mode, out, WindowTable[i]); + DeviceFocusEvent(dev, XI_FocusOut, mode, out, screenInfo.screens[i]->root); } else { @@ -1293,7 +1302,7 @@ DeviceFocusEvents(DeviceIntPtr dev, } /* Notify all the roots */ for (i = 0; i < nscreens; i++) - DeviceFocusEvent(dev, XI_FocusIn, mode, in, WindowTable[i]); + DeviceFocusEvent(dev, XI_FocusIn, mode, in, screenInfo.screens[i]->root); if (to == PointerRootWin) DeviceFocusInEvents(dev, RootWindow(dev), sprite->win, mode, NotifyPointer); } @@ -1305,7 +1314,7 @@ DeviceFocusEvents(DeviceIntPtr dev, DeviceFocusOutEvents(dev, sprite->win, RootWindow(dev), mode, NotifyPointer); for (i = 0; i < nscreens; i++) - DeviceFocusEvent(dev, XI_FocusOut, mode, out, WindowTable[i]); + DeviceFocusEvent(dev, XI_FocusOut, mode, out, screenInfo.screens[i]->root); if (to->parent != NullWindow) DeviceFocusInEvents(dev, RootWindow(dev), to, mode, NotifyNonlinearVirtual); DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to); |