void ShellSurfaceMoveGrabber::button(wl_pointer_grab *grab, uint32_t time, uint32_t button, uint32_t state)
{
    Q_UNUSED(time)
    ShellSurfaceResizeGrabber *self = reinterpret_cast<ShellSurfaceResizeGrabber *>(grab);
    ShellSurface *shell_surface = self->shell_surface;
    if (toQtButton(button) == Qt::LeftButton && !state) {
        wl_pointer_set_focus(grab->pointer, 0, 0, 0);
        wl_pointer_end_grab(grab->pointer);
        shell_surface->resetMoveGrabber();
        delete self;
    }
}
Exemple #2
0
static void
data_device_start_drag(struct wl_client *client, struct wl_resource *resource,
		       struct wl_resource *source_resource,
		       struct wl_resource *origin_resource,
		       struct wl_resource *icon_resource, uint32_t serial)
{
	struct wl_seat *seat = resource->data;

	/* FIXME: Check that client has implicit grab on the origin
	 * surface that matches the given time. */

	/* FIXME: Check that the data source type array isn't empty. */

	seat->drag_grab.interface = &drag_grab_interface;

	seat->drag_client = client;
	seat->drag_data_source = NULL;

	if (source_resource) {
		seat->drag_data_source = source_resource->data;
		seat->drag_data_source_listener.notify =
			destroy_data_device_source;
		wl_signal_add(&source_resource->destroy_signal,
			      &seat->drag_data_source_listener);
	}

	if (icon_resource) {
		seat->drag_surface = icon_resource->data;
		seat->drag_icon_listener.notify = destroy_data_device_icon;
		wl_signal_add(&icon_resource->destroy_signal,
			      &seat->drag_icon_listener);
		wl_signal_emit(&seat->drag_icon_signal, icon_resource);
	}

	wl_pointer_set_focus(seat->pointer, NULL,
			     wl_fixed_from_int(0), wl_fixed_from_int(0));
	wl_pointer_start_grab(seat->pointer, &seat->drag_grab);
}