When using XI2, handle enter/leave events via XI2.

SVN revision: 81756
This commit is contained in:
Kim Woelders 2012-12-27 18:21:58 +00:00
parent 82f3f3a359
commit 3d6195ba33
3 changed files with 38 additions and 2 deletions

View File

@ -848,6 +848,31 @@ EventFetchXI2(XEvent * ev)
#endif
ev->xkey.same_screen = xie->dev.deviceid; /* FIXME */
break;
case XI_Enter:
case XI_Leave:
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->xcrossing.window = xie->elf.event;
ev->xcrossing.root = xie->elf.root;
ev->xcrossing.subwindow = xie->elf.child;
ev->xcrossing.time = xie->gen.time;
ev->xcrossing.x = (int)xie->elf.event_x;
ev->xcrossing.y = (int)xie->elf.event_y;
ev->xcrossing.x_root = (int)xie->elf.root_x;
ev->xcrossing.y_root = (int)xie->elf.root_y;
/* mode and detail values are the same in core/XI2.
* XI2 has a few extra modes. */
ev->xcrossing.mode = xie->elf.mode;
ev->xcrossing.detail = xie->elf.detail;
ev->xcrossing.same_screen = xie->elf.deviceid; /* FIXME */
ev->xcrossing.focus = xie->elf.focus;
ev->xcrossing.state = xie->elf.mods.effective;
break;
}
XFreeEventData(disp, &gec);

View File

@ -253,11 +253,16 @@ EwinManage(EWin * ewin)
CWEventMask | CWDontPropagate, &att);
EMapWindow(ewin->win_container);
att.event_mask = EWIN_TOP_EVENT_MASK;
att.do_not_propagate_mask =
KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
PointerMotionMask;
#if USE_XI2
EChangeWindowAttributes(EoGetWin(ewin), CWDontPropagate, &att);
ESelectInput(EoGetWin(ewin), EWIN_TOP_EVENT_MASK);
#else
att.event_mask = EWIN_TOP_EVENT_MASK;
EChangeWindowAttributes(EoGetWin(ewin), CWEventMask | CWDontPropagate, &att);
#endif
ewin->client.event_mask = EWIN_CLIENT_EVENT_MASK;
ESelectInput(EwinGetClientWin(ewin), ewin->client.event_mask);

View File

@ -1042,6 +1042,11 @@ EXIMaskSetup(EXIEventMask * em, int dev, unsigned int event_mask)
XISetMask(em->mb, XI_ButtonRelease);
if (event_mask & PointerMotionMask)
XISetMask(em->mb, XI_Motion);
if (event_mask & EnterWindowMask)
XISetMask(em->mb, XI_Enter);
if (event_mask & LeaveWindowMask)
XISetMask(em->mb, XI_Leave);
}
#endif
@ -1053,7 +1058,8 @@ 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 (EVENTS_TO_XI_KBD | EVENTS_TO_XI_PTR)
#define EVENTS_TO_XI_WEL (EnterWindowMask | LeaveWindowMask)
#define EVENTS_TO_XI (EVENTS_TO_XI_KBD | EVENTS_TO_XI_PTR | EVENTS_TO_XI_WEL)
evold_mask = win->event_mask;
win->event_mask = event_mask;