[client] x11: fix failure to unfocus when performing meta resize/move

This commit is contained in:
Geoffrey McRae 2022-01-26 14:43:11 +11:00
parent 22f3cf5ba6
commit 79e986cc60

View File

@ -532,11 +532,8 @@ static bool x11Init(const LG_DSInitParams params)
eventmask.mask_len = sizeof(mask); eventmask.mask_len = sizeof(mask);
eventmask.mask = mask; eventmask.mask = mask;
if (!x11.ewmhHasFocusEvent)
{
XISetMask(mask, XI_FocusIn ); XISetMask(mask, XI_FocusIn );
XISetMask(mask, XI_FocusOut); XISetMask(mask, XI_FocusOut);
}
XISetMask(mask, XI_Enter ); XISetMask(mask, XI_Enter );
XISetMask(mask, XI_Leave ); XISetMask(mask, XI_Leave );
@ -1030,14 +1027,19 @@ static void x11XInputEvent(XGenericEventCookie *cookie)
{ {
case XI_FocusIn: case XI_FocusIn:
{ {
XIFocusOutEvent *xie = cookie->data;
if (x11.ewmhHasFocusEvent) if (x11.ewmhHasFocusEvent)
{
// if meta ungrab for move/resize
if (xie->mode == XINotifyUngrab)
app_handleFocusEvent(true);
return; return;
}
atomic_store(&x11.lastWMEvent, microtime()); atomic_store(&x11.lastWMEvent, microtime());
if (x11.focused) if (x11.focused)
return; return;
XIFocusOutEvent *xie = cookie->data;
if (xie->mode != XINotifyNormal && if (xie->mode != XINotifyNormal &&
xie->mode != XINotifyWhileGrabbed && xie->mode != XINotifyWhileGrabbed &&
xie->mode != XINotifyUngrab) xie->mode != XINotifyUngrab)
@ -1051,14 +1053,19 @@ static void x11XInputEvent(XGenericEventCookie *cookie)
case XI_FocusOut: case XI_FocusOut:
{ {
XIFocusOutEvent *xie = cookie->data;
if (x11.ewmhHasFocusEvent) if (x11.ewmhHasFocusEvent)
{
// if meta grab for move/resize
if (xie->mode == XINotifyGrab)
app_handleFocusEvent(false);
return; return;
}
atomic_store(&x11.lastWMEvent, microtime()); atomic_store(&x11.lastWMEvent, microtime());
if (!x11.focused) if (!x11.focused)
return; return;
XIFocusOutEvent *xie = cookie->data;
if (xie->mode != XINotifyNormal && if (xie->mode != XINotifyNormal &&
xie->mode != XINotifyWhileGrabbed && xie->mode != XINotifyWhileGrabbed &&
xie->mode != XINotifyGrab) xie->mode != XINotifyGrab)