void enter_notify(xcb_generic_event_t *evt) { xcb_enter_notify_event_t *e = (xcb_enter_notify_event_t *) evt; xcb_window_t win = e->event; PRINTF("enter notify %X %d %d\n", win, e->mode, e->detail); if (e->mode != XCB_NOTIFY_MODE_NORMAL || (mon->desk->focus != NULL && mon->desk->focus->client->window == win)) { return; } xcb_get_window_attributes_reply_t *wa = xcb_get_window_attributes_reply(dpy, xcb_get_window_attributes(dpy, motion_recorder), NULL); if (wa == NULL) { return; } if (wa->map_state == XCB_MAP_STATE_UNMAPPED) { enable_motion_recorder(); } else { disable_motion_recorder(); } }
void focus_node(monitor_t *m, desktop_t *d, node_t *n, bool is_mapped) { if (n == NULL) return; PRINTF("focus node %X\n", n->client->window); split_mode = MODE_AUTOMATIC; n->client->urgent = false; if (is_mapped) { if (mon != m) { for (desktop_t *cd = mon->desk_head; cd != NULL; cd = cd->next) window_draw_border(cd->focus, true, false); for (desktop_t *cd = m->desk_head; cd != NULL; cd = cd->next) if (cd != d) window_draw_border(cd->focus, true, true); if (d->focus == n) window_draw_border(n, true, true); } if (d->focus != n) { window_draw_border(d->focus, false, true); window_draw_border(n, true, true); } xcb_set_input_focus(dpy, XCB_INPUT_FOCUS_POINTER_ROOT, n->client->window, XCB_CURRENT_TIME); } if (focus_follows_pointer) { xcb_window_t win = XCB_NONE; get_pointed_window(&win); if (win != n->client->window) enable_motion_recorder(); else disable_motion_recorder(); } if (!is_tiled(n->client)) { if (!adaptative_raise || !might_cover(d, n)) window_raise(n->client->window); } else { window_pseudo_raise(d, n->client->window); } if (d->focus != n) { d->last_focus = d->focus; d->focus = n; } ewmh_update_active_window(); put_status(); }
void enter_notify(xcb_generic_event_t *evt) { xcb_enter_notify_event_t *e = (xcb_enter_notify_event_t *) evt; xcb_window_t win = e->event; PRINTF("enter notify %X %d %d\n", win, e->mode, e->detail); if (e->mode != XCB_NOTIFY_MODE_NORMAL || (mon->desk->focus != NULL && mon->desk->focus->client->window == win)) return; enable_motion_recorder(); }