dix: float slave devices during passive grabs.

Exception - implicit passive grabs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2009-06-01 17:14:06 +10:00
parent f56ad22e8f
commit 1cd7ed75d9

View File

@ -1506,7 +1506,7 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
Bool isPassive = autoGrab & ~ImplicitGrabMask; Bool isPassive = autoGrab & ~ImplicitGrabMask;
/* slave devices need to float for the duration of the grab. */ /* slave devices need to float for the duration of the grab. */
if (!isPassive && !IsMaster(mouse)) if (!(autoGrab & ImplicitGrabMask) && !IsMaster(mouse))
DetachFromMaster(mouse); DetachFromMaster(mouse);
if (grab->confineTo) if (grab->confineTo)
@ -1543,7 +1543,8 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
{ {
GrabPtr grab = mouse->deviceGrab.grab; GrabPtr grab = mouse->deviceGrab.grab;
DeviceIntPtr dev; DeviceIntPtr dev;
Bool wasPassive= mouse->deviceGrab.fromPassiveGrab; Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab &&
mouse->deviceGrab.implicitGrab);
mouse->valuator->motionHintWindow = NullWindow; mouse->valuator->motionHintWindow = NullWindow;
mouse->deviceGrab.grab = NullGrab; mouse->deviceGrab.grab = NullGrab;
@ -1563,7 +1564,7 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
if (grab->cursor) if (grab->cursor)
FreeCursor(grab->cursor, (Cursor)0); FreeCursor(grab->cursor, (Cursor)0);
if (!wasPassive) if (!wasImplicit)
ReattachToOldMaster(mouse); ReattachToOldMaster(mouse);
ComputeFreezes(); ComputeFreezes();
@ -1581,7 +1582,7 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool pass
WindowPtr oldWin; WindowPtr oldWin;
/* slave devices need to float for the duration of the grab. */ /* slave devices need to float for the duration of the grab. */
if (!passive && !IsMaster(keybd)) if (!(passive & ImplicitGrabMask) && !IsMaster(keybd))
DetachFromMaster(keybd); DetachFromMaster(keybd);
if (grabinfo->grab) if (grabinfo->grab)
@ -1616,7 +1617,8 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
DeviceIntPtr dev; DeviceIntPtr dev;
WindowPtr focusWin = keybd->focus ? keybd->focus->win WindowPtr focusWin = keybd->focus ? keybd->focus->win
: keybd->spriteInfo->sprite->win; : keybd->spriteInfo->sprite->win;
Bool wasPassive = keybd->deviceGrab.fromPassiveGrab; Bool wasImplicit = (keybd->deviceGrab.fromPassiveGrab &&
keybd->deviceGrab.implicitGrab);
if (focusWin == FollowKeyboardWin) if (focusWin == FollowKeyboardWin)
focusWin = inputInfo.keyboard->focus->win; focusWin = inputInfo.keyboard->focus->win;
@ -1633,7 +1635,7 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
} }
DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab); DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab);
if (!wasPassive) if (!wasImplicit)
ReattachToOldMaster(keybd); ReattachToOldMaster(keybd);
ComputeFreezes(); ComputeFreezes();