case XCB_MOTION_NOTIFY:
motion_notify(evt);
break;
+ case XCB_FOCUS_IN:
+ focus_in(evt);
+ break;
default:
if (randr && resp_type == randr_base + XCB_RANDR_SCREEN_CHANGE_NOTIFY)
import_monitors();
}
}
+void focus_in(xcb_generic_event_t *evt)
+{
+ xcb_focus_in_event_t *e = (xcb_focus_in_event_t *) evt;
+
+ /* PRINTF("focus in %X %d %d\n", e->event, e->mode, e->detail); */
+
+ if (e->mode == XCB_NOTIFY_MODE_GRAB
+ || e->mode == XCB_NOTIFY_MODE_UNGRAB)
+ return;
+ if ((e->detail == XCB_NOTIFY_DETAIL_ANCESTOR ||
+ e->detail == XCB_NOTIFY_DETAIL_INFERIOR ||
+ e->detail == XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL ||
+ e->detail == XCB_NOTIFY_DETAIL_NONLINEAR) &&
+ (mon->desk->focus == NULL
+ || mon->desk->focus->client->window != e->event))
+ update_input_focus();
+}
+
void enter_notify(xcb_generic_event_t *evt)
{
xcb_enter_notify_event_t *e = (xcb_enter_notify_event_t *) evt;
query_pointer(&win, &pos);
- if (win == XCB_NONE)
- return;
-
coordinates_t loc;
if (locate_window(win, &loc)) {
client_t *c = NULL;
break;
}
} else {
+ if (pac == ACTION_FOCUS) {
+ monitor_t *m = monitor_from_point(pos);
+ if (m != NULL)
+ focus_node(m, m->desk, m->desk->focus);
+ }
frozen_pointer->action = ACTION_NONE;
}
}
if (frozen_pointer->action == ACTION_NONE)
return;
- int16_t delta_x, delta_y, x, y, w, h;
+ int16_t delta_x, delta_y, x = 0, y = 0, w = 1, h = 1;
uint16_t width, height;
pointer_action_t pac = frozen_pointer->action;
node_t *vertical_fence = frozen_pointer->vertical_fence;
node_t *horizontal_fence = frozen_pointer->horizontal_fence;
- x = y = 0;
- w = h = 1;
-
delta_x = root_x - frozen_pointer->position.x;
delta_y = root_y - frozen_pointer->position.y;