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; } }
void ShellGrab::unsetCursor() { wl_fixed_t sx, sy; weston_view *view = weston_compositor_pick_view(pointer()->seat->compositor, pointer()->x, pointer()->y, &sx, &sy); if (pointer()->focus != view) { weston_pointer_set_focus(pointer(), view, sx, sy); } }
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); }
WL_EXPORT int weston_pointer_start_drag(struct weston_pointer *pointer, struct weston_data_source *source, struct weston_surface *icon, struct wl_client *client) { struct weston_pointer_drag *drag; drag = zalloc(sizeof *drag); if (drag == NULL) return -1; drag->grab.interface = &pointer_drag_grab_interface; drag->base.client = client; drag->base.data_source = source; if (icon) { drag->base.icon = weston_view_create(icon); if (drag->base.icon == NULL) { free(drag); return -1; } drag->base.icon_destroy_listener.notify = handle_drag_icon_destroy; wl_signal_add(&icon->destroy_signal, &drag->base.icon_destroy_listener); icon->configure = pointer_drag_surface_configure; icon->configure_private = drag; } else { drag->base.icon = NULL; } if (source) { drag->base.data_source_listener.notify = destroy_pointer_data_device_source; wl_signal_add(&source->destroy_signal, &drag->base.data_source_listener); } weston_pointer_set_focus(pointer, NULL, wl_fixed_from_int(0), wl_fixed_from_int(0)); weston_pointer_start_grab(pointer, &drag->grab); return 0; }
void Shell::defaultPointerGrabFocus(weston_pointer_grab *grab) { weston_pointer *pointer = grab->pointer; if (pointer->button_count > 0) { return; } wl_fixed_t sx, sy; weston_view *view = weston_compositor_pick_view(pointer->seat->compositor, pointer->x, pointer->y, &sx, &sy); if (view && view->surface->configure == &black_surface_configure) { view = static_cast<ShellSurface *>(view->surface->configure_private)->view(); } if (pointer->focus != view) { weston_pointer_set_focus(pointer, view, sx, sy); } }
static void weston_desktop_seat_popup_grab_pointer_focus(struct weston_pointer_grab *grab) { struct weston_desktop_seat *seat = wl_container_of(grab, seat, popup_grab.pointer); struct weston_pointer *pointer = grab->pointer; struct weston_view *view; wl_fixed_t sx, sy; view = weston_compositor_pick_view(pointer->seat->compositor, pointer->x, pointer->y, &sx, &sy); if (view != NULL && view->surface->resource != NULL && wl_resource_get_client(view->surface->resource) == seat->popup_grab.client) weston_pointer_set_focus(pointer, view, sx, sy); else weston_pointer_clear_focus(pointer); }
void ShellGrab::setCursor(Cursor cursor) { Shell::instance()->setGrabCursor(cursor); weston_pointer_set_focus(pointer(), Shell::instance()->m_grabView, wl_fixed_from_int(0), wl_fixed_from_int(0)); }