Exemplo n.º 1
0
static void handle_finish(struct sway_seat *seat) {
	struct seatop_down_event *e = seat->seatop_data;
	struct sway_cursor *cursor = seat->cursor;
	// Set the cursor's previous coords to the x/y at the start of the
	// operation, so the container change will be detected if using
	// focus_follows_mouse and the cursor moved off the original container
	// during the operation.
	cursor->previous.x = e->ref_lx;
	cursor->previous.y = e->ref_ly;
	if (e->moved) {
		struct wlr_surface *surface = NULL;
		double sx, sy;
		struct sway_node *node = node_at_coords(seat,
				cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
		cursor_send_pointer_motion(cursor, 0, node, surface, sx, sy);
	}
}
Exemplo n.º 2
0
mapnode_t *
node_at_coords(int parmx, int parmy)
{
	int x, y, ndx, ndy, i;
	int sz = rect_len+1;// len = vector_len(nodelist);
	mapnode_t *nd;

	/* handle multiple nodes at the same position (return next in list) */
	i = vector_find((vector_t *)nodelist, selected_node) + 1;

	for (; i < vector_len((vector_t *)nodelist); i++)
	{
		nd = vector_aref((vector_t *)nodelist, i);
		if (!nd)
			continue;

		ndx = nd->x;
		ndy = nd->y;

		for (x = -sz; x <= sz; x++)
		{
			for (y = -sz; y <= sz; y++)
			{
				if ((ndx + x + xoffset == parmx) &&
				    (ndy + y + yoffset == parmy))
				{
					if ((selected_node != NULL) && (selected_node == nd))
						goto skip;
					else
						return nd;
				}
			}
		}
		skip:
			continue;
	}

	if ((selected_node != NULL))
	{
		selected_node = NULL;
		return node_at_coords(parmx, parmy);
	}

	return NULL;
}