Example #1
0
static void
set_pointer_image(struct input *input, uint32_t time, int pointer)
{
	struct display *display = input->display;
	struct wl_buffer *buffer;
	cairo_surface_t *surface;
	int location;

	location = get_pointer_location(input->pointer_focus,
					input->sx, input->sy);
	switch (location) {
	case WINDOW_RESIZING_TOP:
		pointer = POINTER_TOP;
		break;
	case WINDOW_RESIZING_BOTTOM:
		pointer = POINTER_BOTTOM;
		break;
	case WINDOW_RESIZING_LEFT:
		pointer = POINTER_LEFT;
		break;
	case WINDOW_RESIZING_RIGHT:
		pointer = POINTER_RIGHT;
		break;
	case WINDOW_RESIZING_TOP_LEFT:
		pointer = POINTER_TOP_LEFT;
		break;
	case WINDOW_RESIZING_TOP_RIGHT:
		pointer = POINTER_TOP_RIGHT;
		break;
	case WINDOW_RESIZING_BOTTOM_LEFT:
		pointer = POINTER_BOTTOM_LEFT;
		break;
	case WINDOW_RESIZING_BOTTOM_RIGHT:
		pointer = POINTER_BOTTOM_RIGHT;
		break;
	case WINDOW_EXTERIOR:
	case WINDOW_TITLEBAR:
		if (input->current_pointer_image == POINTER_DEFAULT)
			return;

		wl_input_device_attach(input->input_device, time, NULL, 0, 0);
		input->current_pointer_image = POINTER_DEFAULT;
		return;
	default:
		break;
	}

	if (pointer == input->current_pointer_image)
		return;

	input->current_pointer_image = pointer;
	surface = display->pointer_surfaces[pointer];
	buffer = display_get_buffer_for_surface(display, surface);
	wl_input_device_attach(input->input_device, time, buffer,
			       pointer_images[pointer].hotspot_x,
			       pointer_images[pointer].hotspot_y);
}
Example #2
0
void QWaylandInputDevice::attach(QWaylandBuffer *buffer, int x, int y)
{
    wl_input_device_attach(mInputDevice, mTime, buffer->buffer(), x, y);
}