Plan 9 from Bell Labs’s /usr/web/sources/contrib/anothy/src/cmd/writecursor.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#include <u.h>
#include <libc.h>
#include <draw.h>
#include <cursor.h>
#include <mouse.h>

Cursor cross = {
	{-7, -7},
	{
		0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0,
		0x03, 0xC0, 0x03, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF,
		0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0xC0, 0x03, 0xC0,
		0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0,
	},
	{
		0x00, 0x00, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80,
		0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x7F, 0xFE,
		0x7F, 0xFE, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80,
		0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x00, 0x00,
	}
};

Cursor thinarrow = {
	{-1, -1},
	{
		0xFF, 0xE0, 0xFF, 0xE0, 0xFF, 0xC0, 0xFF, 0x00,
		 0xFF, 0x00, 0xFF, 0x80, 0xFF, 0xC0, 0xFF, 0xE0,
		 0xE7, 0xF0, 0xE3, 0xF8, 0xC1, 0xFC, 0x00, 0xFE,
		 0x00, 0x7F, 0x00, 0x3E, 0x00, 0x1C, 0x00, 0x08,
	},
	{
		0x00, 0x00, 0x7F, 0xC0, 0x7F, 0x00, 0x7C, 0x00,
		0x7E, 0x00, 0x7F, 0x00, 0x6F, 0x80, 0x67, 0xC0,
		0x43, 0xE0, 0x41, 0xF0, 0x00, 0xF8, 0x00, 0x7C,
		0x00, 0x3E, 0x00, 0x1C, 0x00, 0x08, 0x00, 0x00,
	}
};

Cursor glenda = {
	{-1, -1},
	{
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	},
	{
		0x04, 0x00, 0x0a, 0x00, 0x25, 0xe0, 0x56, 0x10,
		0x28, 0x08, 0x10, 0x04, 0x10, 0x54, 0x08, 0x04,
		0x08, 0x34, 0x04, 0x04, 0x08, 0x08, 0x08, 0x04,
		0x08, 0x04, 0x14, 0x04, 0x0b, 0x28, 0x00, 0xd0,
	}
};

void
main(){
	int fd;
	fd = open("#m/cursor", ORDWR);

	char curs[2*4+2*2*16];

	Cursor c = glenda;

	BPLONG(curs+0*4, c.offset.x);
	BPLONG(curs+1*4, c.offset.y);
	memmove(curs+2*4, c.clr, 2*2*16);
	write(fd, curs, 2*4+2*2*16);
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].