When using XI2, handle focus change events via XI2.

SVN revision: 81757
This commit is contained in:
Kim Woelders 2012-12-27 18:22:01 +00:00
parent 3d6195ba33
commit 5d5e0dcacc
2 changed files with 24 additions and 1 deletions

View File

@ -873,6 +873,21 @@ EventFetchXI2(XEvent * ev)
ev->xcrossing.focus = xie->elf.focus;
ev->xcrossing.state = xie->elf.mods.effective;
break;
case XI_FocusIn:
case XI_FocusOut:
ev->type = xie->gen.evtype; /* Same as core */
#if 0
/* Keep those. At least serial seems to be bad in xie. */
ev->xany.serial = xie->gen.serial;
ev->xany.send_event = xie->gen.send_event;
ev->xany.display = xie->gen.display;
#endif
ev->xfocus.window = xie->elf.event;
/* mode and detail values are the same in core/XI2.
* XI2 has a few extra modes. */
ev->xfocus.mode = xie->elf.mode;
ev->xfocus.detail = xie->elf.detail;
break;
}
XFreeEventData(disp, &gec);

10
src/x.c
View File

@ -1047,6 +1047,12 @@ EXIMaskSetup(EXIEventMask * em, int dev, unsigned int event_mask)
XISetMask(em->mb, XI_Enter);
if (event_mask & LeaveWindowMask)
XISetMask(em->mb, XI_Leave);
if (event_mask & FocusChangeMask)
{
XISetMask(em->mb, XI_FocusIn);
XISetMask(em->mb, XI_FocusOut);
}
}
#endif
@ -1059,7 +1065,9 @@ ESelectInput(Win win, unsigned int event_mask)
#define EVENTS_TO_XI_KBD (KeyPressMask | KeyReleaseMask)
#define EVENTS_TO_XI_PTR (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
#define EVENTS_TO_XI_WEL (EnterWindowMask | LeaveWindowMask)
#define EVENTS_TO_XI (EVENTS_TO_XI_KBD | EVENTS_TO_XI_PTR | EVENTS_TO_XI_WEL)
#define EVENTS_TO_XI_WFO (FocusChangeMask)
#define EVENTS_TO_XI \
(EVENTS_TO_XI_KBD | EVENTS_TO_XI_PTR | EVENTS_TO_XI_WEL | EVENTS_TO_XI_WFO)
evold_mask = win->event_mask;
win->event_mask = event_mask;