Пример #1
0
static void
desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
			  int32_t sx, int32_t sy, void *shell)
{
	struct desktest_shell *dts = shell;
	struct weston_surface *surface =
		weston_desktop_surface_get_surface(desktop_surface);
	struct weston_geometry geometry =
		weston_desktop_surface_get_geometry(desktop_surface);

	assert(dts->view);

	if (weston_surface_is_mapped(surface))
		return;

	surface->is_mapped = true;
	weston_layer_entry_insert(&dts->layer.view_list, &dts->view->layer_link);
	weston_view_set_position(dts->view, 0 - geometry.x, 0 - geometry.y);
	weston_view_update_transform(dts->view);
	dts->view->is_mapped = true;
}
Пример #2
0
static void
drag_surface_configure(struct weston_drag *drag,
		       struct weston_pointer *pointer,
		       struct weston_touch *touch,
		       struct weston_surface *es,
		       int32_t sx, int32_t sy)
{
	struct wl_list *list;
	float fx, fy;

	assert((pointer != NULL && touch == NULL) ||
			(pointer == NULL && touch != NULL));

	if (!weston_surface_is_mapped(es) && es->buffer_ref.buffer) {
		if (pointer && pointer->sprite &&
			weston_view_is_mapped(pointer->sprite))
			list = &pointer->sprite->layer_link;
		else
			list = &es->compositor->cursor_layer.view_list;

		wl_list_remove(&drag->icon->layer_link);
		wl_list_insert(list, &drag->icon->layer_link);
		weston_view_update_transform(drag->icon);
		empty_region(&es->pending.input);
	}

	drag->dx += sx;
	drag->dy += sy;

	/* init to 0 for avoiding a compile warning */
	fx = fy = 0;
	if (pointer) {
		fx = wl_fixed_to_double(pointer->x) + drag->dx;
		fy = wl_fixed_to_double(pointer->y) + drag->dy;
	} else if (touch) {
		fx = wl_fixed_to_double(touch->grab_x) + drag->dx;
		fy = wl_fixed_to_double(touch->grab_y) + drag->dy;
	}
	weston_view_set_position(drag->icon, fx, fy);
}