static void default_grab_focus(struct weston_pointer_grab *grab) { struct weston_pointer *pointer = grab->pointer; struct weston_surface *surface; wl_fixed_t sx, sy; if (pointer->button_count > 0) return; surface = weston_compositor_pick_surface(pointer->seat->compositor, pointer->x, pointer->y, &sx, &sy); if (pointer->focus != surface) weston_pointer_set_focus(pointer, surface, sx, sy); }
void ShellSeat::popup_grab_focus(struct weston_pointer_grab *grab) { struct weston_pointer *pointer = grab->pointer; ShellSeat *shseat = static_cast<PopupGrab *>(container_of(grab, PopupGrab, grab))->seat; wl_fixed_t sx, sy; struct weston_surface *surface = weston_compositor_pick_surface(pointer->seat->compositor, pointer->x, pointer->y, &sx, &sy); if (surface && surface->resource->client == shseat->m_popupGrab.client) { weston_pointer_set_focus(pointer, surface, sx, sy); grab->pointer->focus = surface; } else { weston_pointer_set_focus(pointer, NULL, wl_fixed_from_int(0), wl_fixed_from_int(0)); grab->pointer->focus = NULL; } }