/* pick a window */
switch (e->type) {
case SelectionClear:
- window = RootWindow(obt_display, ob_screen);
+ window = obt_root(ob_screen);
break;
case MapRequest:
window = e->xmap.window;
magic. Our X core protocol stuff won't work, so we use this to
find what the modifier state is instead. */
if (XkbGetState(obt_display, XkbUseCoreKbd, &xkb_state) == Success)
- e->xkey.state = xkb_state.compat_state;
+ e->xkey.state =
+ obt_keyboard_only_modmasks(xkb_state.compat_state);
else
#endif
{
/* These are the ones we want.. */
- if (win == RootWindow(obt_display, ob_screen)) {
+ if (win == obt_root(ob_screen)) {
/* If looking for a focus in on a client, then always return
FALSE for focus in's to the root window */
if (in_client_only)
return FALSE;
/* Focus left the root window revertedto state */
- if (win == RootWindow(obt_display, ob_screen))
+ if (win == obt_root(ob_screen))
return FALSE;
/* These are the ones we want.. */
e = ⅇ
window = event_get_window(e);
- if ((obwin = window_find(window))) {
+ if (window == obt_root(ob_screen))
+ /* don't do any lookups, waste of cpu */;
+ else if ((obwin = window_find(window))) {
switch (obwin->type) {
case OB_WINDOW_CLASS_DOCK:
dock = WINDOW_AS_DOCK(obwin);
case OB_WINDOW_CLASS_MENUFRAME:
menu = WINDOW_AS_MENUFRAME(obwin);
break;
- case OB_WINDOW_CLASS_INTERNALWINDOW:
+ case OB_WINDOW_CLASS_INTERNAL:
/* we don't do anything with events directly on these windows */
break;
}
obt_display_ignore_errors(TRUE);
if (XGetInputFocus(obt_display, &win, &i) &&
XGetGeometry(obt_display, win, &root, &i,&i,&u,&u,&u,&u) &&
- root != RootWindow(obt_display, ob_screen))
+ root != obt_root(ob_screen))
{
ob_debug_type(OB_DEBUG_FOCUS,
"Focus went to another screen !\n");
event_handle_dock(dock, e);
else if (menu)
event_handle_menu(menu, e);
- else if (window == RootWindow(obt_display, ob_screen))
+ else if (window == obt_root(ob_screen))
event_handle_root(e);
else if (e->type == MapRequest)
client_manage(window);
if (e->type == ButtonPress || e->type == ButtonRelease) {
/* If the button press was on some non-root window, or was physically
on the root window, the process it */
- if (window != RootWindow(obt_display, ob_screen) ||
+ if (window != obt_root(ob_screen) ||
e->xbutton.subwindow == None)
{
event_handle_user_input(client, e);
ObWindow *w;
if ((w = window_find(e->xbutton.subwindow)) &&
- WINDOW_IS_INTERNALWINDOW(w))
+ WINDOW_IS_INTERNAL(w))
{
event_handle_user_input(client, e);
}
break;
}
case UnmapNotify:
- if (client->ignore_unmaps) {
- client->ignore_unmaps--;
- break;
- }
ob_debug("UnmapNotify for window 0x%x eventwin 0x%x sendevent %d "
"ignores left %d\n",
client->window, e->xunmap.event, e->xunmap.from_configure,
client->ignore_unmaps);
+ if (client->ignore_unmaps) {
+ client->ignore_unmaps--;
+ break;
+ }
client_unmanage(client);
break;
case DestroyNotify:
gulong event_start_ignore_all_enters(void)
{
- XSync(obt_display, FALSE);
- return LastKnownRequestProcessed(obt_display);
+ return NextRequest(obt_display);
}
static void event_ignore_enter_range(gulong start, gulong end)
r->start, r->end);
/* increment the serial so we don't ignore events we weren't meant to */
- XSync(obt_display, FALSE);
+ OBT_PROP_ERASE(screen_support_win, MOTIF_WM_HINTS);
}
void event_end_ignore_all_enters(gulong start)
{
- XSync(obt_display, FALSE);
- event_ignore_enter_range(start, LastKnownRequestProcessed(obt_display));
+ /* Use (NextRequest-1) so that we ignore up to the current serial only.
+ Inside event_ignore_enter_range, we increment the serial by one, but if
+ we ignore that serial too, then any enter events generated by mouse
+ movement will be ignored until we create some further network traffic.
+ Instead ignore up to NextRequest-1, then when we increment the serial,
+ we will be *past* the range of ignored serials */
+ event_ignore_enter_range(start, NextRequest(obt_display)-1);
}
static gboolean is_enter_focus_event_ignored(XEvent *e)