Ejemplo n.º 1
0
/**
 * Set the cursor size and bitmaps.
 *
 * @param pcursor New mouse cursor.
 */
void
GdSetCursor(PMWCURSOR pcursor)
{
	int	bytes;

	GdHideCursor(&scrdev);
	curmaxx = curminx + pcursor->width - 1;
	curmaxy = curminy + pcursor->height - 1;

	curfg = GdFindColor(&scrdev, pcursor->fgcolor);
	curbg = GdFindColor(&scrdev, pcursor->bgcolor);

	bytes = MWIMAGE_SIZE(pcursor->width, pcursor->height) * sizeof(MWIMAGEBITS);

	memcpy(cursorcolor, pcursor->image, bytes);
	memcpy(cursormask, pcursor->mask, bytes);

	GdShowCursor(&scrdev);
}
Ejemplo n.º 2
0
/*
 * Specify a cursor for a window.
 * This cursor will only be used within that window, and by default
 * for its new children.  If the cursor is currently within this
 * window, it will be changed to the new one immediately.
 */
void
MwSetCursor(HWND wp, PMWCURSOR pcursor)
{
	HCURSOR	cp;
	int	bytes;

	if(!wp || !pcursor)
		return;

	bytes = MWIMAGE_SIZE(pcursor->width,pcursor->height)
		* sizeof(MWIMAGEBITS);

	/*
	 * See if the window is using a shared cursor definition.
	 * If so, then allocate a new private one, otherwise reuse it.
	 */
	cp = wp->cursor;
	if (!cp || cp->usecount-- > 1) {
		cp = GdItemNew(struct hcursor);
		if(!cp)
			return;
	}