- b = g_hash_table_lookup(h->bindings[e->xany.type], &e->xany.window);
- if (b) b->func(e, b->data);
+
+ if (e->type < h->num_event_types) {
+ const gint all = OBT_XEVENT_ALL_WINDOWS;
+ /* run the all_windows handler first */
+ b = g_hash_table_lookup(h->bindings[e->xany.type], &all);
+ if (b) b->func(e, b->data);
+ /* then run the per-window handler */
+ b = g_hash_table_lookup(h->bindings[e->xany.type], &e->xany.window);
+ if (b) b->func(e, b->data);
+ }
+ else
+ g_message("Unhandled X Event type %d", e->xany.type);