This commit is contained in:
Leon Henrik Plickat 2023-08-13 01:37:13 +02:00
commit 0f70a57703
5 changed files with 2835 additions and 0 deletions

35
Makefile Normal file
View file

@ -0,0 +1,35 @@
SCANNER := wayland-scanner
PREFIX=/usr/local
BINDIR=$(PREFIX)/bin
MANDIR=$(PREFIX)/share/man
CFLAGS=-Wall -Werror -Wextra -Wpedantic -Wno-unused-parameter -Wconversion -Wformat-security -Wformat -Wsign-conversion -Wfloat-conversion -Wunused-result $(shell pkg-config --cflags pixman-1)
LIBS=-lwayland-client $(shell pkg-config --libs pixman-1) -lrt
OBJ=wayneko.o wlr-layer-shell-unstable-v1.o xdg-shell.o
GEN=wlr-layer-shell-unstable-v1.c wlr-layer-shell-unstable-v1.h xdg-shell.c xdg-shell.h
wayneko: $(OBJ)
$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
$(OBJ): $(GEN)
%.c: %.xml
$(SCANNER) private-code < $< > $@
%.h: %.xml
$(SCANNER) client-header < $< > $@
install: wayneko
install -D wayneko $(DESTDIR)$(BINDIR)/wayneko
install -m 644 -D wayneko.1 $(DESTDIR)$(MANDIR)/man1/wayneko.1
uninstall:
$(RM) $(DESTDIR)$(BINDIR)/wayneko
$(RM) $(DESTDIR)$(MANDIR)/man1/wayneko.1
clean:
$(RM) wayneko $(GEN) $(OBJ)
.PHONY: clean install

345
neko-bitmap.xbm Normal file
View file

@ -0,0 +1,345 @@
#define neko_bitmap_width 512
#define neko_bitmap_height 64
static unsigned char neko_bitmap_bits[] = {
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, 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, 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,
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, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x04,
0x00, 0x30, 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, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,
0x40, 0x10, 0x10, 0x02, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x04,
0x00, 0x70, 0x00, 0x00, 0x20, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x0e, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
0x00, 0x28, 0x28, 0x00, 0x80, 0x28, 0x28, 0x01, 0x00, 0x10, 0x01, 0x00,
0x00, 0x28, 0x28, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00,
0x09, 0x00, 0x00, 0x06, 0x00, 0x8c, 0x01, 0x00, 0x60, 0x00, 0x00, 0x90,
0x00, 0x80, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x05, 0x00, 0x00, 0x00, 0x48, 0x24, 0x00, 0x00, 0x49, 0x24, 0x00,
0x00, 0x10, 0x02, 0x00, 0x00, 0x48, 0x24, 0x00, 0x00, 0x50, 0x00, 0x00,
0x00, 0x1a, 0x00, 0x00, 0x19, 0x00, 0x00, 0x05, 0x00, 0x03, 0x06, 0x00,
0xa0, 0x00, 0x00, 0x88, 0x00, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x44, 0x44, 0x00,
0x06, 0x44, 0x44, 0x60, 0xe0, 0x10, 0x0c, 0x00, 0x00, 0x44, 0x44, 0x00,
0x20, 0x90, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x22, 0x00, 0x80, 0x04,
0x80, 0x00, 0x08, 0x00, 0x20, 0x01, 0x00, 0x44, 0x00, 0x10, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x1f, 0x00,
0x00, 0x84, 0x42, 0x00, 0x18, 0x84, 0x42, 0x18, 0x20, 0x37, 0x10, 0x00,
0x00, 0x84, 0x42, 0x00, 0x50, 0x10, 0x01, 0x00, 0x00, 0x82, 0x00, 0x00,
0x44, 0x00, 0x40, 0x04, 0x80, 0x00, 0x10, 0x00, 0x20, 0x02, 0x00, 0x22,
0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0x00, 0x08, 0x00, 0x00, 0x82, 0x83, 0x00, 0x60, 0x82, 0x83, 0x06,
0x20, 0x18, 0x20, 0x00, 0x00, 0x82, 0x83, 0x00, 0x90, 0x08, 0x02, 0x00,
0x00, 0x02, 0x03, 0x00, 0x88, 0x00, 0x30, 0x0c, 0x40, 0x00, 0x20, 0x30,
0x30, 0x0c, 0x00, 0x11, 0x0c, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x3f, 0x00, 0x00, 0xc0, 0x1f, 0x04, 0x00, 0x00, 0x3a, 0xb8, 0x00,
0x00, 0x02, 0x80, 0x00, 0x40, 0x00, 0x41, 0x00, 0x00, 0x02, 0x80, 0x00,
0x10, 0x09, 0x04, 0x00, 0x3c, 0x02, 0x34, 0x00, 0x10, 0x03, 0x08, 0x10,
0x20, 0x00, 0x20, 0x28, 0x08, 0x10, 0xc0, 0x08, 0x14, 0x04, 0x00, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x3c, 0x00, 0x00, 0x00, 0x1f, 0x00,
0x00, 0x42, 0x85, 0x00, 0x00, 0x22, 0x88, 0x00, 0x40, 0x00, 0x42, 0x00,
0x00, 0x22, 0x88, 0x00, 0x10, 0x06, 0x08, 0x00, 0xc4, 0x03, 0x58, 0x00,
0x10, 0x1c, 0x0c, 0x24, 0x10, 0x00, 0x40, 0x26, 0x24, 0x30, 0x38, 0x08,
0x64, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x91, 0x00, 0x0f, 0x22, 0x88, 0x78,
0x40, 0x00, 0x50, 0x00, 0x00, 0x22, 0x88, 0x00, 0x10, 0x00, 0x08, 0x00,
0x08, 0x00, 0x58, 0x00, 0x10, 0x60, 0x04, 0x24, 0x48, 0x80, 0xc0, 0x11,
0x24, 0x20, 0x06, 0x08, 0x88, 0x03, 0x01, 0x12, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x04, 0x88, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x4e, 0xe2, 0x00,
0x00, 0x22, 0x88, 0x00, 0x40, 0x08, 0x48, 0x00, 0x00, 0x22, 0x88, 0x00,
0x20, 0x00, 0x10, 0x00, 0x08, 0x20, 0x58, 0x00, 0x08, 0x80, 0x02, 0x24,
0xc4, 0x00, 0x21, 0x10, 0x24, 0x40, 0x01, 0x10, 0x08, 0x84, 0x00, 0x23,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x7c, 0x01, 0x00, 0x00, 0x80, 0x02,
0x00, 0x42, 0x82, 0x00, 0x00, 0x02, 0x80, 0x00, 0x80, 0x10, 0x41, 0x00,
0x00, 0x02, 0x80, 0x00, 0x20, 0x80, 0x10, 0x00, 0x10, 0x10, 0xd8, 0x00,
0x08, 0x00, 0x03, 0x40, 0xa2, 0x00, 0x01, 0x10, 0x02, 0xc0, 0x00, 0x10,
0x08, 0x80, 0x00, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x60, 0x01,
0x00, 0x00, 0x41, 0x02, 0x00, 0x42, 0x82, 0x00, 0x00, 0x3a, 0xb9, 0x00,
0x80, 0x00, 0x3c, 0x00, 0x00, 0x3a, 0xb9, 0x00, 0x20, 0x60, 0x10, 0x00,
0x20, 0x08, 0x18, 0x01, 0x08, 0x00, 0xc0, 0x43, 0x92, 0x00, 0x02, 0x20,
0xc2, 0x03, 0x00, 0x10, 0x04, 0x40, 0x00, 0x49, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xc0, 0x21, 0x02, 0x00, 0x80, 0x22, 0x02, 0x00, 0x44, 0x42, 0x00,
0x00, 0x04, 0x40, 0x00, 0x00, 0x39, 0x22, 0x00, 0x00, 0x04, 0x40, 0x00,
0x20, 0x10, 0x08, 0x00, 0x20, 0xc8, 0x18, 0x02, 0x08, 0x00, 0x00, 0x40,
0x49, 0x00, 0x02, 0x48, 0x02, 0x00, 0x00, 0x10, 0x12, 0x40, 0x00, 0x92,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x3f, 0x06, 0x00, 0x40, 0x3e, 0x06,
0x00, 0x88, 0x21, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x02, 0x44, 0x00,
0x00, 0x08, 0x20, 0x00, 0xe0, 0x81, 0xf9, 0x03, 0xe0, 0x21, 0x18, 0x04,
0x08, 0x00, 0x00, 0x20, 0x25, 0x00, 0x02, 0x48, 0x04, 0x00, 0x00, 0x10,
0x12, 0x40, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x12, 0x0a,
0x00, 0x38, 0x14, 0x0a, 0x00, 0x70, 0x1c, 0x00, 0x00, 0x70, 0x1c, 0x02,
0x00, 0x7c, 0x7c, 0x00, 0x00, 0x70, 0x1c, 0x00, 0x20, 0x60, 0x18, 0x04,
0x20, 0x00, 0x34, 0x08, 0x04, 0x00, 0x00, 0x1e, 0x43, 0x00, 0xe1, 0x48,
0x78, 0x00, 0x00, 0x20, 0x12, 0x87, 0x00, 0xc2, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x21, 0x0c, 0x14, 0x00, 0x26, 0x18, 0x14, 0x00, 0x40, 0x04, 0x00,
0x00, 0x40, 0x04, 0x05, 0x00, 0x40, 0x44, 0x00, 0x00, 0x40, 0x04, 0x00,
0xe0, 0xc5, 0x0f, 0x08, 0xe0, 0x05, 0x24, 0x08, 0x04, 0x10, 0x80, 0x01,
0x80, 0x00, 0x91, 0xc3, 0x80, 0x07, 0x08, 0x20, 0xc3, 0x81, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0x10, 0x00, 0x18, 0x00, 0x11, 0x00, 0x18,
0x00, 0x20, 0x08, 0x00, 0x00, 0x20, 0x88, 0x04, 0x00, 0x20, 0x46, 0x00,
0x00, 0x20, 0x08, 0x00, 0xc0, 0xe0, 0x00, 0x08, 0xc0, 0x60, 0x38, 0x08,
0x03, 0x0c, 0x80, 0x01, 0x80, 0xc0, 0x02, 0x80, 0x80, 0x00, 0x30, 0xc0,
0x01, 0x40, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x10, 0x00, 0x18,
0x00, 0x11, 0x00, 0x18, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x50, 0x02,
0x00, 0x10, 0x40, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x9f, 0x11, 0x08,
0x00, 0x1f, 0x10, 0x08, 0x81, 0x03, 0x00, 0x03, 0x80, 0x79, 0x01, 0x40,
0xc0, 0x00, 0xc0, 0x81, 0x02, 0x80, 0x9e, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0x10, 0x00, 0x38, 0x80, 0x10, 0x00, 0x38, 0x00, 0x08, 0x20, 0x00,
0x00, 0x08, 0x20, 0x01, 0x00, 0x08, 0x30, 0x00, 0x00, 0x08, 0x20, 0x00,
0x00, 0x08, 0x2e, 0x08, 0x00, 0x08, 0x20, 0x08, 0x79, 0x0e, 0x18, 0x06,
0x80, 0x89, 0xc0, 0x20, 0x60, 0x18, 0x78, 0x9e, 0x04, 0x03, 0x91, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x10, 0x00, 0x2a, 0x40, 0x10, 0x00, 0x2c,
0x00, 0x0b, 0xa0, 0x01, 0x00, 0x0b, 0xa0, 0x01, 0x00, 0x0b, 0xa4, 0x01,
0x00, 0x0b, 0xa0, 0x01, 0x00, 0x0b, 0x20, 0x08, 0x00, 0x0b, 0x20, 0x08,
0xed, 0xf9, 0x2f, 0x08, 0x40, 0x72, 0x70, 0x1f, 0x10, 0xf4, 0x87, 0xa7,
0xf8, 0x0e, 0x4e, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xa0, 0x03, 0x29,
0x40, 0xa0, 0x01, 0x2b, 0x80, 0x0c, 0x61, 0x02, 0x80, 0x0c, 0x61, 0x02,
0x80, 0x0c, 0x63, 0x02, 0x80, 0x0c, 0x61, 0x02, 0x80, 0x0c, 0x21, 0x08,
0x80, 0x0c, 0x21, 0x0c, 0x17, 0x00, 0xdc, 0x10, 0x40, 0x13, 0x2c, 0x00,
0x08, 0x3b, 0x00, 0xc8, 0x00, 0x34, 0xc8, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x40, 0x20, 0x8c, 0x68, 0x40, 0x20, 0x8e, 0x68, 0x40, 0x18, 0x31, 0x04,
0x40, 0x18, 0x31, 0x04, 0x40, 0x18, 0x01, 0x04, 0x40, 0x18, 0x31, 0x04,
0x40, 0x18, 0x31, 0x04, 0x40, 0x18, 0x31, 0x04, 0x0c, 0x00, 0x20, 0x23,
0xc0, 0xf4, 0x13, 0x00, 0xc4, 0x04, 0x00, 0x30, 0x00, 0xc8, 0x2f, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x10, 0x54, 0x40, 0x40, 0x10, 0x54,
0x40, 0x10, 0x11, 0x04, 0x40, 0x10, 0x11, 0x04, 0x40, 0x10, 0x01, 0x3c,
0x40, 0x10, 0x11, 0x04, 0x40, 0x10, 0x11, 0x04, 0x40, 0x10, 0x11, 0x02,
0x00, 0x00, 0xc0, 0x1c, 0x00, 0x1c, 0x09, 0x00, 0x38, 0x03, 0x00, 0x00,
0x00, 0x90, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x40, 0x5b,
0x40, 0x80, 0x40, 0x5b, 0xc0, 0x11, 0x11, 0x7f, 0xc0, 0x11, 0x11, 0x07,
0xc0, 0x11, 0x05, 0x47, 0xc0, 0x11, 0x11, 0x7f, 0xc0, 0x11, 0x91, 0x7f,
0xc0, 0x11, 0x91, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x07, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0x00, 0xff, 0x4c, 0x80, 0x00, 0xff, 0x4c, 0x60, 0x90, 0x13, 0x84,
0x60, 0x90, 0x13, 0x0c, 0x60, 0x90, 0x03, 0x3c, 0x60, 0x90, 0x13, 0x84,
0x60, 0x90, 0xf3, 0x80, 0x60, 0x90, 0xf3, 0x80, 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, 0x00, 0x3f, 0xf0, 0x64, 0x00, 0x3f, 0xf0, 0x64,
0xe0, 0xff, 0xfe, 0x7f, 0xe0, 0xff, 0xfe, 0x0f, 0xe0, 0xff, 0xfe, 0x0f,
0xe0, 0xff, 0xfe, 0x7f, 0xe0, 0xff, 0xfe, 0x7f, 0xe0, 0xff, 0xfe, 0x7f,
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, 0x00, 0xe0, 0x9f, 0x3f,
0x00, 0xe0, 0x9f, 0x3f, 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,
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, 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, 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,
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, 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, 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,
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, 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, 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,
0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x04, 0x00, 0x30, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xc0, 0x1f, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x40, 0x10, 0x10, 0x02,
0x00, 0xf0, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x04, 0x00, 0x70, 0x00, 0x00,
0x20, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x38, 0x38, 0x00,
0x80, 0x38, 0x38, 0x01, 0x00, 0xf0, 0x01, 0x00, 0x00, 0x38, 0x38, 0x00,
0x00, 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x06,
0x00, 0xfc, 0x01, 0x00, 0x60, 0x00, 0x00, 0xf0, 0x00, 0x80, 0x3f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00,
0x00, 0x78, 0x3c, 0x00, 0x00, 0x79, 0x3c, 0x00, 0x00, 0xf0, 0x03, 0x00,
0x00, 0x78, 0x3c, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00,
0x1f, 0x00, 0x00, 0x07, 0x00, 0xff, 0x07, 0x00, 0xe0, 0x00, 0x00, 0xf8,
0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x07, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x00, 0x06, 0x7c, 0x7c, 0x60,
0xe0, 0xf0, 0x0f, 0x00, 0x00, 0x7c, 0x7c, 0x00, 0x20, 0xf0, 0x00, 0x00,
0x00, 0x7e, 0x00, 0x00, 0x3e, 0x00, 0x80, 0x07, 0x80, 0xff, 0x0f, 0x00,
0xe0, 0x01, 0x00, 0x7c, 0x00, 0xf0, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x1f, 0x00, 0x00, 0xfc, 0x7e, 0x00,
0x18, 0xfc, 0x7e, 0x18, 0xe0, 0xf7, 0x1f, 0x00, 0x00, 0xfc, 0x7e, 0x00,
0x70, 0xf0, 0x01, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x7c, 0x00, 0xc0, 0x07,
0x80, 0xff, 0x1f, 0x00, 0xe0, 0x03, 0x00, 0x3e, 0x00, 0xf8, 0xff, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x05, 0x1f, 0x00,
0x00, 0xfe, 0xff, 0x00, 0x60, 0xfe, 0xff, 0x06, 0xe0, 0xff, 0x3f, 0x00,
0x00, 0xfe, 0xff, 0x00, 0xf0, 0xf8, 0x03, 0x00, 0x00, 0xfe, 0x03, 0x00,
0xf8, 0x00, 0xf0, 0x0f, 0xc0, 0xff, 0x3f, 0x30, 0xf0, 0x0f, 0x00, 0x1f,
0x0c, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00,
0xc0, 0x1f, 0x0c, 0x00, 0x00, 0xfe, 0xff, 0x00, 0x00, 0xfe, 0xff, 0x00,
0xc0, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0xff, 0x00, 0xf0, 0xf9, 0x07, 0x00,
0x3c, 0xfe, 0x37, 0x00, 0xf0, 0x03, 0xf8, 0x1f, 0xe0, 0xff, 0x3f, 0x38,
0xf8, 0x1f, 0xc0, 0x0f, 0x1c, 0xfc, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x3f, 0x3c, 0x00, 0xc0, 0x1f, 0x1f, 0x00, 0x00, 0xfe, 0xff, 0x00,
0x00, 0xfe, 0xff, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0xff, 0x00,
0xf0, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x7f, 0x00, 0xf0, 0x1f, 0xfc, 0x3f,
0xf0, 0xff, 0x7f, 0x3e, 0xfc, 0x3f, 0xf8, 0x0f, 0x7c, 0xfe, 0xff, 0x0f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x3c, 0x00, 0x00, 0x00, 0x1f, 0x00,
0x00, 0xfe, 0xff, 0x00, 0x0f, 0xfe, 0xff, 0x78, 0xc0, 0xff, 0x7f, 0x00,
0x00, 0xfe, 0xff, 0x00, 0xf0, 0xff, 0x0f, 0x00, 0xf8, 0xff, 0x7f, 0x00,
0xf0, 0x7f, 0xfc, 0x3f, 0xf8, 0xff, 0xff, 0x1f, 0xfc, 0x3f, 0xfe, 0x0f,
0xf8, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x98, 0x01,
0x00, 0x00, 0x00, 0x01, 0x00, 0xfe, 0xff, 0x00, 0x00, 0xfe, 0xff, 0x00,
0xc0, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0xff, 0x00, 0xe0, 0xff, 0x1f, 0x00,
0xf8, 0xff, 0x7f, 0x00, 0xf8, 0xff, 0xfe, 0x3f, 0xfc, 0xff, 0xff, 0x1f,
0xfc, 0x7f, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x3f, 0xfc, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0xfe, 0xff, 0x00,
0x00, 0xfe, 0xff, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0xff, 0x00,
0xe0, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0x7f,
0xbe, 0xff, 0xff, 0x1f, 0xfe, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x7d,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0xfc, 0x01, 0x00, 0x00, 0xc1, 0x03,
0x00, 0xfe, 0xff, 0x00, 0x00, 0xfe, 0xff, 0x00, 0x80, 0xff, 0x3f, 0x00,
0x00, 0xfe, 0xff, 0x00, 0xe0, 0xff, 0x1f, 0x00, 0xe0, 0xff, 0xff, 0x01,
0xf8, 0xff, 0xff, 0x7f, 0x9e, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0x1f,
0xfc, 0xff, 0xff, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe1, 0x03,
0x00, 0x80, 0xe3, 0x03, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00,
0x00, 0xff, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0xe0, 0xff, 0x0f, 0x00,
0xe0, 0xff, 0xff, 0x03, 0xf8, 0xff, 0xff, 0x7f, 0xcf, 0xff, 0xff, 0x7f,
0xfe, 0xff, 0xff, 0x1f, 0xfe, 0xff, 0xff, 0xf3, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xf8, 0xff, 0x07, 0x00, 0xc0, 0xff, 0x07, 0x00, 0xf8, 0x3f, 0x00,
0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0xf8, 0x3f, 0x00,
0xe0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07, 0xf8, 0xff, 0xff, 0x3f,
0xe7, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0x1f, 0xfe, 0xff, 0xff, 0xe7,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x0f, 0x00, 0xf8, 0xff, 0x0f,
0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x02, 0x00, 0xfc, 0x7f, 0x00,
0x00, 0xf0, 0x1f, 0x00, 0xe0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xf7, 0x0f,
0xfc, 0xff, 0xff, 0x1f, 0xc3, 0xff, 0xff, 0x7f, 0xf8, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1f,
0x00, 0xfe, 0xff, 0x1f, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xc0, 0x07, 0x07,
0x00, 0xc0, 0x7f, 0x00, 0x00, 0xc0, 0x07, 0x00, 0xe0, 0xff, 0xff, 0x0f,
0xe0, 0xff, 0xe7, 0x0f, 0xfc, 0xff, 0xff, 0x01, 0x80, 0xff, 0xff, 0xff,
0x80, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0xff, 0xff, 0x1f, 0x00, 0xff, 0xff, 0x1f, 0x00, 0xe0, 0x0f, 0x00,
0x00, 0xe0, 0x8f, 0x07, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0xe0, 0x0f, 0x00,
0xc0, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x01,
0x80, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x1f, 0x00, 0xff, 0xff, 0x1f,
0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf0, 0xdf, 0x03, 0x00, 0xf0, 0x7f, 0x00,
0x00, 0xf0, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x00, 0xff, 0xff, 0x0f,
0xff, 0xff, 0xff, 0x03, 0x80, 0xff, 0xff, 0x7f, 0xc0, 0xff, 0xff, 0xff,
0xfe, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x3f,
0x80, 0xff, 0xff, 0x3f, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0xff, 0x01,
0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0xff, 0x0f,
0x00, 0xf8, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x07, 0x80, 0xff, 0xff, 0x3f,
0xe0, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xc0, 0xff, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0x3f, 0x00, 0xfb, 0xbf, 0x01,
0x00, 0xfb, 0xff, 0x01, 0x00, 0xfb, 0xbf, 0x01, 0x00, 0xfb, 0xbf, 0x01,
0x00, 0xfb, 0xff, 0x0f, 0x00, 0xfb, 0xff, 0x0f, 0xff, 0xf9, 0xff, 0x0f,
0xc0, 0xff, 0x7f, 0x1f, 0xf0, 0xff, 0x87, 0xff, 0xf8, 0xfe, 0xff, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0x3f,
0x80, 0xff, 0xff, 0x03, 0x80, 0xff, 0xff, 0x03, 0x80, 0xff, 0xff, 0x03,
0x80, 0xff, 0xff, 0x03, 0x80, 0xff, 0xff, 0x0f, 0x80, 0xff, 0xff, 0x0f,
0x1f, 0x00, 0xfc, 0x1f, 0xc0, 0xff, 0x3f, 0x00, 0xf8, 0x3f, 0x00, 0xf8,
0x00, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x7f,
0xc0, 0xff, 0xff, 0x7f, 0xc0, 0xff, 0xff, 0x07, 0xc0, 0xff, 0xff, 0x07,
0xc0, 0xff, 0xff, 0x07, 0xc0, 0xff, 0xff, 0x07, 0xc0, 0xff, 0xff, 0x07,
0xc0, 0xff, 0xff, 0x07, 0x0c, 0x00, 0xe0, 0x3f, 0xc0, 0xfc, 0x1f, 0x00,
0xfc, 0x07, 0x00, 0x30, 0x00, 0xf8, 0x3f, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xc0, 0xff, 0xff, 0x7f, 0xc0, 0xff, 0xff, 0x7f, 0xc0, 0xff, 0xff, 0x07,
0xc0, 0xff, 0xff, 0x07, 0xc0, 0xff, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0x07,
0xc0, 0xff, 0xff, 0x07, 0xc0, 0xff, 0xff, 0x03, 0x00, 0x00, 0xc0, 0x1c,
0x00, 0x1c, 0x0f, 0x00, 0x38, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x38, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x7f, 0xc0, 0xff, 0xff, 0x7f,
0xc0, 0xff, 0xff, 0x7f, 0xc0, 0xff, 0xff, 0x07, 0xc0, 0xff, 0xff, 0x7f,
0xc0, 0xff, 0xff, 0x7f, 0xc0, 0xff, 0xff, 0x7f, 0xc0, 0xff, 0xff, 0x7f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xe0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x7f,
0x80, 0xff, 0xff, 0x7f, 0xe0, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0x0f,
0xe0, 0xff, 0xff, 0x3f, 0xe0, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff,
0xe0, 0xff, 0xff, 0xff, 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,
0x00, 0xff, 0xff, 0x7f, 0x00, 0xff, 0xff, 0x7f, 0xe0, 0xff, 0xfe, 0x7f,
0xe0, 0xff, 0xfe, 0x0f, 0xe0, 0xff, 0xfe, 0x0f, 0xe0, 0xff, 0xfe, 0x7f,
0xe0, 0xff, 0xfe, 0x7f, 0xe0, 0xff, 0xfe, 0x7f, 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, 0x00, 0xe0, 0x9f, 0x3f, 0x00, 0xe0, 0x9f, 0x3f,
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, 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, 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,
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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };

921
wayneko.c Normal file
View file

@ -0,0 +1,921 @@
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <pixman.h>
#include <poll.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include <wayland-client.h>
#ifdef __linux__
#include <features.h>
#ifdef __GLIBC__
#include <execinfo.h>
#endif
#endif
#include "wlr-layer-shell-unstable-v1.h"
/* Note: Atlas width must be divisable by 4. */
#include "neko-bitmap.xbm"
const int neko_bitmap_stride = neko_bitmap_width / 8;
const int neko_size = 32;
pixman_image_t *neko_atlas = NULL;
pixman_image_t *neko_atlas_bg_fill = NULL;
pixman_image_t *neko_atlas_border_fill = NULL;
enum Neko
{
NEKO_SLEEP_1 = 0,
NEKO_SLEEP_2,
NEKO_YAWN,
NEKO_SHOCK,
NEKO_THINK,
NEKO_STARE,
NEKO_SCRATCH_1,
NEKO_SCRATCH_2,
NEKO_RUN_RIGHT_1,
NEKO_RUN_RIGHT_2,
NEKO_RUN_LEFT_1,
NEKO_RUN_LEFT_2,
};
const uint16_t animation_timeout = 200;
size_t animation_ticks_until_next_frame = 10;
enum Neko current_neko = NEKO_STARE;
struct Buffer
{
struct wl_list link;
uint32_t width;
uint32_t height;
uint32_t stride;
size_t size;
void *mmap;
struct wl_buffer *wl_buffer;
pixman_image_t *pixman_image;
bool busy;
};
struct Surface
{
struct wl_surface *wl_surface;
struct zwlr_layer_surface_v1 *layer_surface;
bool configured;
};
struct Surface surface = { 0 };
const uint32_t surface_width = 100;
const uint32_t surface_height = neko_size;
int ret = EXIT_SUCCESS;
bool loop = true;
struct wl_display *wl_display = NULL;
struct wl_registry *wl_registry = NULL;
struct wl_callback *sync_callback = NULL;
struct wl_compositor *wl_compositor = NULL;
struct wl_shm *wl_shm = NULL;
struct zwlr_layer_shell_v1 *layer_shell = NULL;
struct timespec last_tick;
/* The amount of buffers per surface we consider the reasonable upper limit.
* Some compositors sometimes tripple-buffer, so three seems to be ok.
* Note that we can absolutely work with higher buffer numbers if needed,
* however we consider that to be an anomaly and therefore do not want to
* keep all those extra buffers around if we can avoid it, as to not have
* unecessary memory overhead.
*/
int max_buffer_multiplicity = 3;
struct wl_list buffer_pool;
/* No-Op function plugged into Wayland listeners we don't care about. */
static void noop () {}
/*************
* *
* Signals *
* *
*************/
/**
* Intercept error signals (like SIGSEGV and SIGFPE) so that we can try to
* print a fancy error message and a backtracke before letting the system kill us.
*/
static void handle_error (int signum)
{
const char *msg =
"\n"
"🐈 🐈 🐈\n"
"┌──────────────────────────────────────────┐\n"
"│ │\n"
"│ wayneko has crashed. │\n"
"│ │\n"
"│ This is likely a bug, so please │\n"
"│ report this to the mailing list. │\n"
"│ │\n"
"│ ~leon_plickat/public-inbox@lists.sr.ht │\n"
"│ │\n"
"└──────────────────────────────────────────┘\n"
"\n";
fputs(msg, stderr);
/* Set up the default handlers to deal with the rest. We do this before
* attempting to get a backtrace, because sometimes that could also
* cause a SEGFAULT and we don't want a funny signal loop to happen.
*/
signal(signum, SIG_DFL);
#ifdef __linux__
#ifdef __GLIBC__
fputs("Attempting to get backtrace:\n", stderr);
void *buffer[255];
const int calls = backtrace(buffer, sizeof(buffer) / sizeof(void *));
backtrace_symbols_fd(buffer, calls, fileno(stderr));
fputs("\n", stderr);
#endif
#endif
/* Easiest way of calling the default signal handler. */
kill(getpid(), signum);
}
/**
* Intercept soft kills (like SIGINT and SIGTERM) so we can attempt to clean up
* and exit gracefully.
*/
static void handle_term (int signum)
{
fputs("[wayneko] Terminated by signal.\n", stderr);
/* If cleanup fails or hangs and causes this signal to be recieved again,
* let the default signal handler kill us.
*/
signal(signum, SIG_DFL);
loop = false;
}
/**
* Set up signal handlers.
*/
static void init_signals (void)
{
signal(SIGSEGV, handle_error);
signal(SIGFPE, handle_error);
signal(SIGINT, handle_term);
signal(SIGTERM, handle_term);
}
/************
* *
* Buffer *
* *
************/
static void buffer_randomize_string (char *str, size_t len)
{
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
long r = ts.tv_nsec;
for (size_t i = 0; i < len; i++, str++)
{
/* Use two byte from the current nano-second to pseudo-randomly
* increase the ASCII character 'A' into another character,
* which will then subsitute the character at *str.
*/
*str = (char)('A' + (r&15) + (r&16));
r >>= 5;
}
}
/* Tries to create a shared memory object and returns its file descriptor if
* successful.
*/
static bool buffer_get_shm_fd (int *fd, size_t size)
{
char name[] = "/wayneko-RANDOM";
char *rp = name + strlen("/wayneko-"); /* Pointer to random part. */
size_t rl = strlen("RANDOM"); /* Length of random part. */
/* Try a few times to get a unique name. */
for (int tries = 100; tries > 0; tries--)
{
/* Make the name pseudo-random to not conflict with other
* running instances.
*/
buffer_randomize_string(rp, rl);
/* Try to create a shared memory object. Returns -1 if the
* memory object already exists.
*/
*fd = shm_open(name, O_RDWR | O_CREAT | O_EXCL, 0600);
/* If a shared memory object was created, set its size and
* return its file descriptor.
*/
if ( *fd >= 0 )
{
shm_unlink(name);
if ( ftruncate(*fd, (off_t)size) < 0 )
{
fprintf(stderr, "ERROR: ftruncate: %s.\n", strerror(errno));
close(*fd);
return false;
}
return true;
}
/* The EEXIST error means that the name is not unique and we
* must try again.
*/
if ( errno != EEXIST )
{
fprintf(stderr, "ERROR: shm_open: %s.\n", strerror(errno));
return false;
}
}
return false;
}
static void buffer_handle_release (void *data, struct wl_buffer *wl_buffer)
{
struct Buffer *buffer = (struct Buffer *)data;
buffer->busy = false;
}
static const struct wl_buffer_listener buffer_listener = {
.release = buffer_handle_release,
};
static void buffer_finish (struct Buffer *buffer)
{
if ( buffer->wl_buffer != NULL )
wl_buffer_destroy(buffer->wl_buffer);
if ( buffer->pixman_image != NULL )
pixman_image_unref(buffer->pixman_image);
if ( buffer->mmap != NULL )
munmap(buffer->mmap, buffer->size);
}
static void buffer_destroy (struct Buffer *buffer)
{
wl_list_remove(&buffer->link);
free(buffer);
}
#define PIXMAN_STRIDE(A, B) (((PIXMAN_FORMAT_BPP(A) * B + 7) / 8 + 4 - 1) & -4)
static bool buffer_init (struct Buffer *buffer, uint32_t width, uint32_t height)
{
assert(!buffer->busy);
bool ret = true;
int fd = -1;
struct wl_shm_pool *shm_pool = NULL;
buffer->width = width;
buffer->height = height;
buffer->stride = (uint32_t)PIXMAN_STRIDE(PIXMAN_a8r8g8b8, (int32_t)width);
buffer->size = (size_t)(buffer->stride * height);
if ( buffer->size == 0 )
{
ret = false;
goto cleanup;
}
if (! buffer_get_shm_fd(&fd, buffer->size))
{
ret = false;
goto cleanup;
}
buffer->mmap = mmap(NULL, buffer->size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if ( buffer->mmap == MAP_FAILED )
{
fprintf(stderr, "ERROR: mmap: %s.\n", strerror(errno));
ret = false;
goto cleanup;
}
shm_pool = wl_shm_create_pool(wl_shm, fd, (int32_t)buffer->size);
if ( shm_pool == NULL )
{
ret = false;
goto cleanup;
}
buffer->wl_buffer = wl_shm_pool_create_buffer(shm_pool, 0, (int32_t)width,
(int32_t)height, (int32_t)buffer->stride, WL_SHM_FORMAT_ARGB8888);
if ( buffer->wl_buffer == NULL )
{
ret = false;
goto cleanup;
}
wl_buffer_add_listener(buffer->wl_buffer, &buffer_listener, buffer);
buffer->pixman_image = pixman_image_create_bits_no_clear(PIXMAN_a8r8g8b8,
(int32_t)width, (int32_t)height, buffer->mmap, (int32_t)buffer->stride);
if ( buffer->pixman_image == NULL )
{
ret = false;
goto cleanup;
}
cleanup:
if ( shm_pool != NULL )
wl_shm_pool_destroy(shm_pool);
if ( fd != -1 )
close(fd);
if (! ret)
buffer_finish(buffer);
return ret;
}
#undef PIXMAN_STRIDE
static struct Buffer *buffer_pool_find_suitable_buffer (uint32_t width, uint32_t height)
{
struct Buffer *first_unbusy_buffer = NULL;
struct Buffer *current = NULL;
wl_list_for_each(current, &buffer_pool, link)
{
if (current->busy)
continue;
first_unbusy_buffer = current;
if ( current->width != width )
continue;
if ( current->height != height )
continue;
return current;
}
/* No buffer has matching dimensions, however we do have an unbusy
* buffer which we can just re-init.
*/
if ( first_unbusy_buffer != NULL )
{
buffer_finish(first_unbusy_buffer);
if (!buffer_init(first_unbusy_buffer, width, height))
{
buffer_destroy(first_unbusy_buffer);
return NULL;
}
return first_unbusy_buffer;
}
return NULL;
}
static struct Buffer *buffer_pool_new_buffer (uint32_t width, uint32_t height)
{
struct Buffer *buffer = calloc(1, sizeof(struct Buffer));
if ( buffer == NULL )
{
fprintf(stderr, "ERROR: calloc(): %s\n", strerror(errno));
return NULL;
}
memset(buffer, 0, sizeof(struct Buffer));
wl_list_insert(&buffer_pool, &buffer->link);
if (!buffer_init(buffer, width, height))
{
buffer_destroy(buffer);
return NULL;
}
return buffer;
}
/**
* Get a buffer of the specified dimenisons. If possible an idle buffer is
* reused, otherweise a new one is created.
*/
static struct Buffer *buffer_pool_next_buffer (uint32_t width, uint32_t height)
{
struct Buffer *ret = buffer_pool_find_suitable_buffer(width, height);
if ( ret == NULL )
ret = buffer_pool_new_buffer(width, height);
// XXX cull buffers
return ret;
}
static void buffer_pool_destroy_all_buffers (void)
{
struct Buffer *buffer, *tmp;
wl_list_for_each_safe(buffer, tmp, &buffer_pool, link)
{
buffer_finish(buffer);
buffer_destroy(buffer);
}
}
/***********
* *
* Atlas *
* *
***********/
static bool colour_from_hex (pixman_color_t *colour, const char *hex)
{
uint16_t r = 0, g = 0, b = 0, a = 255;
if ( 4 != sscanf(hex, "0x%02hx%02hx%02hx%02hx", &r, &g, &b, &a)
&& 3 != sscanf(hex, "0x%02hx%02hx%02hx", &r, &g, &b) )
{
fprintf(stderr, "ERROR: Invalid colour: %s\n", hex);
return false;
}
colour->alpha = (uint16_t)(((double)a / 255.0) * 65535.0);
colour->red = (uint16_t)((((double)r / 255.0) * 65535.0) * colour->alpha / 0xffff);
colour->green = (uint16_t)((((double)g / 255.0) * 65535.0) * colour->alpha / 0xffff);
colour->blue = (uint16_t)((((double)b / 255.0) * 65535.0) * colour->alpha / 0xffff);
return true;
}
static void atlas_deinit (void)
{
if ( neko_atlas != NULL )
{
pixman_image_unref(neko_atlas);
neko_atlas = NULL;
}
if ( neko_atlas_bg_fill != NULL )
{
pixman_image_unref(neko_atlas_bg_fill);
neko_atlas_bg_fill = NULL;
}
if ( neko_atlas_border_fill != NULL )
{
pixman_image_unref(neko_atlas_border_fill);
neko_atlas_border_fill = NULL;
}
}
static bool atlas_init (void)
{
assert(neko_atlas == NULL);
neko_atlas = pixman_image_create_bits_no_clear(
PIXMAN_a1, neko_bitmap_width, neko_bitmap_height,
(uint32_t *)(&neko_bitmap_bits), neko_bitmap_stride
);
if ( neko_atlas == NULL )
{
fprintf(stderr, "ERROR: Failed to create texture atlas.\n");
atlas_deinit();
return false;
}
pixman_color_t bg_colour;
colour_from_hex(&bg_colour, "0xFFFFFF");
neko_atlas_bg_fill = pixman_image_create_solid_fill(&bg_colour);
if ( neko_atlas_bg_fill == NULL )
{
fprintf(stderr, "ERROR: Failed to create solid fill.\n");
atlas_deinit();
return false;
}
pixman_color_t border_colour;
colour_from_hex(&border_colour, "0x000000");
neko_atlas_border_fill = pixman_image_create_solid_fill(&border_colour);
if ( neko_atlas_border_fill == NULL )
{
fprintf(stderr, "ERROR: Failed to create solid fill.\n");
atlas_deinit();
return false;
}
return true;
}
static void atlas_composite_neko (struct Buffer *buffer, enum Neko neko_type, uint16_t x, uint16_t y)
{
pixman_image_composite32(
PIXMAN_OP_SRC,
neko_atlas_bg_fill, /* Source. */
neko_atlas, /* Mask. */
buffer->pixman_image, /* Destination. */
0, /* Source x. */
0, /* Source y. */
(uint16_t)neko_type * neko_size, /* Mask x. */
neko_size, /* Mask y. */
x, /* Destination x. */
y, /* Destination y. */
neko_size, /* Source width. */
neko_size /* Source height. */
);
pixman_image_composite32(
PIXMAN_OP_OVER,
neko_atlas_border_fill,
neko_atlas,
buffer->pixman_image,
0,
0,
(uint16_t)neko_type * neko_size,
0,
x,
y,
neko_size,
neko_size
);
}
/** Returns true if new frame is needed. */
static bool animation_next_state (void)
{
if ( animation_ticks_until_next_frame > 0 )
{
animation_ticks_until_next_frame--;
return false;
}
switch (current_neko)
{
case NEKO_STARE:
switch (rand() % 20)
{
case 0:
current_neko = NEKO_SCRATCH_1;
return true;
case 1:
current_neko = NEKO_SLEEP_1;
animation_ticks_until_next_frame = 10;
return true;
case 2:
current_neko = NEKO_SHOCK;
animation_ticks_until_next_frame = 5;
return true;
case 3:
current_neko = NEKO_YAWN;
animation_ticks_until_next_frame = 5;
return true;
case 4:
current_neko = NEKO_THINK;
animation_ticks_until_next_frame = 10;
return true;
default:
return false;
}
break;
case NEKO_SLEEP_1:
case NEKO_SLEEP_2:
case NEKO_SCRATCH_1:
case NEKO_SCRATCH_2:
switch (rand() % 4)
{
case 0:
current_neko = NEKO_STARE;
animation_ticks_until_next_frame = 5;
return true;
default:
switch (current_neko)
{
case NEKO_SLEEP_1: current_neko = NEKO_SLEEP_2; break;
case NEKO_SLEEP_2: current_neko = NEKO_SLEEP_1; break;
case NEKO_SCRATCH_1: current_neko = NEKO_SCRATCH_2; break;
case NEKO_SCRATCH_2: current_neko = NEKO_SCRATCH_1; break;
default: /* unreachable. */ break;
}
if ( current_neko == NEKO_SLEEP_1 || current_neko == NEKO_SLEEP_2 )
animation_ticks_until_next_frame = 10;
return true;
}
break;
case NEKO_SHOCK:
case NEKO_YAWN:
case NEKO_THINK:
default:
current_neko = NEKO_STARE;
animation_ticks_until_next_frame = 5;
return true;
}
return false;
}
/*************
* *
* Surface *
* *
*************/
static void surface_next_frame (void)
{
if (!surface.configured)
return;
struct Buffer *buffer = buffer_pool_next_buffer(surface_width, surface_height);
if ( buffer == NULL )
return;
atlas_composite_neko(buffer, current_neko, 0, 0);
wl_surface_set_buffer_scale(surface.wl_surface, 1);
wl_surface_attach(surface.wl_surface, buffer->wl_buffer, 0, 0);
wl_surface_damage_buffer(surface.wl_surface, 0, 0, INT32_MAX, INT32_MAX);
buffer->busy = true;
wl_surface_commit(surface.wl_surface);
}
static void surface_destroy (void)
{
if ( surface.layer_surface != NULL )
zwlr_layer_surface_v1_destroy(surface.layer_surface);
if ( surface.wl_surface != NULL )
wl_surface_destroy(surface.wl_surface );
}
static void layer_surface_handle_configure (void *data, struct zwlr_layer_surface_v1 *layer_surface,
uint32_t serial, uint32_t width, uint32_t height)
{
(void)data;
(void)layer_surface;
zwlr_layer_surface_v1_ack_configure(surface.layer_surface, serial);
surface.configured = true;
if ( width != surface_width || height != surface_height )
fprintf(stderr, "ERROR: Bad dimensions in configure: %d %d\n", width, height);
surface_next_frame();
}
static void layer_surface_handle_closed (void *data, struct zwlr_layer_surface_v1 *layer_surface)
{
(void)data;
(void)layer_surface;
surface_destroy();
}
const struct zwlr_layer_surface_v1_listener layer_surface_listener = {
.configure = layer_surface_handle_configure,
.closed = layer_surface_handle_closed
};
static void surface_create (void)
{
assert(!surface.configured);
surface.wl_surface = wl_compositor_create_surface(wl_compositor);
surface.layer_surface = zwlr_layer_shell_v1_get_layer_surface(
layer_shell,
surface.wl_surface,
NULL,
ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM,
"wayneko"
);
zwlr_layer_surface_v1_add_listener(
surface.layer_surface,
&layer_surface_listener,
NULL
);
zwlr_layer_surface_v1_set_size(
surface.layer_surface,
surface_width,
surface_height
);
zwlr_layer_surface_v1_set_anchor(
surface.layer_surface,
ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM
);
/* Empty input region. */
struct wl_region *region = wl_compositor_create_region(wl_compositor);
wl_surface_set_input_region(surface.wl_surface, region);
wl_region_destroy(region);
wl_surface_commit(surface.wl_surface);
}
/**********
* *
* Main *
* *
**********/
static void registry_handle_global (void *data, struct wl_registry *registry,
uint32_t name, const char *interface, uint32_t version)
{
if ( strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0 )
layer_shell = wl_registry_bind(registry, name, &zwlr_layer_shell_v1_interface, 1);
else if ( strcmp(interface, wl_compositor_interface.name) == 0 )
wl_compositor = wl_registry_bind(registry, name, &wl_compositor_interface, 4);
else if ( strcmp(interface, wl_shm_interface.name) == 0 )
wl_shm = wl_registry_bind(registry, name, &wl_shm_interface, 1);
}
static const struct wl_registry_listener registry_listener = {
.global = registry_handle_global,
/* We do not bind interfaces that - realistically - will ever disappear. */
.global_remove = noop,
};
static char *check_for_interfaces (void)
{
if ( wl_compositor == NULL )
return "wl_compositor";
if ( wl_shm == NULL )
return "wl_shm";
if ( layer_shell == NULL )
return "wlr_layershell_v1";
return NULL;
}
static void sync_handle_done (void *data, struct wl_callback *wl_callback, uint32_t other)
{
wl_callback_destroy(wl_callback);
sync_callback = NULL;
const char *missing = check_for_interfaces();
if ( missing != NULL )
{
fprintf(stderr, "ERROR, Wayland compositor does not support %s.\n", missing);
loop = false;
ret = EXIT_FAILURE;
return;
}
surface_create();
}
static const struct wl_callback_listener sync_callback_listener = {
.done = sync_handle_done,
};
static void timespec_diff (struct timespec *a, struct timespec *b, struct timespec *result)
{
result->tv_sec = a->tv_sec - b->tv_sec;
result->tv_nsec = a->tv_nsec - b->tv_nsec;
if ( result->tv_nsec < 0 )
{
result->tv_sec--;
result->tv_nsec += 1000000000L;
}
}
int main (void)
{
init_signals();
wl_list_init(&buffer_pool);
srand((unsigned int)time(0));
// TODO command line args
if (!atlas_init())
return EXIT_FAILURE;
/* We query the display name here instead of letting wl_display_connect()
* figure it out itself, because libwayland (for legacy reasons) falls
* back to using "wayland-0" when $WAYLAND_DISPLAY is not set, which is
* generally not desirable.
*/
const char *display_name = getenv("WAYLAND_DISPLAY");
if ( display_name == NULL )
{
fputs("ERROR: WAYLAND_DISPLAY is not set.\n", stderr);
return EXIT_FAILURE;
}
wl_display = wl_display_connect(display_name);
if ( wl_display == NULL )
{
fputs("ERROR: Can not connect to wayland display.\n", stderr);
return EXIT_FAILURE;
}
wl_registry = wl_display_get_registry(wl_display);
wl_registry_add_listener(wl_registry, &registry_listener, NULL);
sync_callback = wl_display_sync(wl_display);
wl_callback_add_listener(sync_callback, &sync_callback_listener, NULL);
struct pollfd pollfds[] = {
{
.fd = wl_display_get_fd(wl_display),
.events = POLLIN,
},
};
while (loop)
{
int current_timeout = animation_timeout;
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
if (surface.configured)
{
const uint32_t nsec_delay = animation_timeout * 1000000;
const uint32_t epsilon = 1000000;
struct timespec time_since_last_tick;
timespec_diff(&now, &last_tick, &time_since_last_tick);
if ( time_since_last_tick.tv_sec > 0 || time_since_last_tick.tv_nsec >= nsec_delay - epsilon )
{
if (animation_next_state())
surface_next_frame();
fprintf(stderr, "tick!\n");
clock_gettime(CLOCK_MONOTONIC, &last_tick);
}
else
{
const int _current_timeout = (int)(nsec_delay - time_since_last_tick.tv_nsec) / 1000000;
if ( current_timeout == -1 || current_timeout > _current_timeout )
current_timeout = _current_timeout;
}
}
/* Flush pending Wayland events/requests. */
while ( wl_display_prepare_read(wl_display) != 0 )
{
if ( wl_display_dispatch_pending(wl_display) != 0 )
{
fprintf(stderr, "ERROR: wl_display_dispatch_pending(): %s\n", strerror(errno));
ret = EXIT_FAILURE;
goto exit_main_loop;
}
}
while (true)
{
/* Returns the amount of bytes flushed. */
const int flush_ret = wl_display_flush(wl_display);
if (flush_ret == -1) /* Error. */
{
if ( errno == EAGAIN )
continue;
fprintf(stderr, "ERROR: wl_display_flush(): %s\n", strerror(errno));
ret = EXIT_FAILURE;
goto exit_main_loop;
}
else if (flush_ret == 0) /* Done flushing. */
break;
}
if ( poll(pollfds, 1, current_timeout) < 0 )
{
if ( errno == EINTR ) /* Interrupt: Signal received. */
continue;
fprintf(stderr, "ERROR: poll(): %s.\n", strerror(errno));
ret = EXIT_FAILURE;
break;
}
if ( wl_display_read_events(wl_display) == -1 )
{
fprintf(stderr, "ERROR: wl_display_read_events(): %s.\n", strerror(errno));
break;
}
if ( wl_display_dispatch_pending(wl_display) == -1 )
{
fprintf(stderr, "ERROR: wl_display_dispatch_pending(): %s.\n", strerror(errno));
break;
}
}
/* Since C doesn't have first-class support for exiting the outer-loop
* from inside a nested loop, we unfortunately need to use a jump label.
*/
exit_main_loop:
close(pollfds[0].fd);
surface_destroy();
buffer_pool_destroy_all_buffers();
if ( wl_compositor != NULL )
wl_compositor_destroy(wl_compositor);
if ( wl_shm != NULL )
wl_shm_destroy(wl_shm);
if ( layer_shell != NULL )
zwlr_layer_shell_v1_destroy(layer_shell);
if ( sync_callback != NULL )
wl_callback_destroy(sync_callback);
if ( wl_registry != NULL )
wl_registry_destroy(wl_registry);
wl_display_disconnect(wl_display);
atlas_deinit();
return ret;
}

View file

@ -0,0 +1,285 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="wlr_layer_shell_unstable_v1">
<copyright>
Copyright © 2017 Drew DeVault
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that copyright notice and this permission
notice appear in supporting documentation, and that the name of
the copyright holders not be used in advertising or publicity
pertaining to distribution of the software without specific,
written prior permission. The copyright holders make no
representations about the suitability of this software for any
purpose. It is provided "as is" without express or implied
warranty.
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
</copyright>
<interface name="zwlr_layer_shell_v1" version="1">
<description summary="create surfaces that are layers of the desktop">
Clients can use this interface to assign the surface_layer role to
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
rendered with a defined z-depth respective to each other. They may also be
anchored to the edges and corners of a screen and specify input handling
semantics. This interface should be suitable for the implementation of
many desktop shell components, and a broad number of other applications
that interact with the desktop.
</description>
<request name="get_layer_surface">
<description summary="create a layer_surface from a surface">
Create a layer surface for an existing surface. This assigns the role of
layer_surface, or raises a protocol error if another role is already
assigned.
Creating a layer surface from a wl_surface which has a buffer attached
or committed is a client error, and any attempts by a client to attach
or manipulate a buffer prior to the first layer_surface.configure call
must also be treated as errors.
You may pass NULL for output to allow the compositor to decide which
output to use. Generally this will be the one that the user most
recently interacted with.
Clients can specify a namespace that defines the purpose of the layer
surface.
</description>
<arg name="id" type="new_id" interface="zwlr_layer_surface_v1"/>
<arg name="surface" type="object" interface="wl_surface"/>
<arg name="output" type="object" interface="wl_output" allow-null="true"/>
<arg name="layer" type="uint" enum="layer" summary="layer to add this surface to"/>
<arg name="namespace" type="string" summary="namespace for the layer surface"/>
</request>
<enum name="error">
<entry name="role" value="0" summary="wl_surface has another role"/>
<entry name="invalid_layer" value="1" summary="layer value is invalid"/>
<entry name="already_constructed" value="2" summary="wl_surface has a buffer attached or committed"/>
</enum>
<enum name="layer">
<description summary="available layers for surfaces">
These values indicate which layers a surface can be rendered in. They
are ordered by z depth, bottom-most first. Traditional shell surfaces
will typically be rendered between the bottom and top layers.
Fullscreen shell surfaces are typically rendered at the top layer.
Multiple surfaces can share a single layer, and ordering within a
single layer is undefined.
</description>
<entry name="background" value="0"/>
<entry name="bottom" value="1"/>
<entry name="top" value="2"/>
<entry name="overlay" value="3"/>
</enum>
</interface>
<interface name="zwlr_layer_surface_v1" version="1">
<description summary="layer metadata interface">
An interface that may be implemented by a wl_surface, for surfaces that
are designed to be rendered as a layer of a stacked desktop-like
environment.
Layer surface state (size, anchor, exclusive zone, margin, interactivity)
is double-buffered, and will be applied at the time wl_surface.commit of
the corresponding wl_surface is called.
</description>
<request name="set_size">
<description summary="sets the size of the surface">
Sets the size of the surface in surface-local coordinates. The
compositor will display the surface centered with respect to its
anchors.
If you pass 0 for either value, the compositor will assign it and
inform you of the assignment in the configure event. You must set your
anchor to opposite edges in the dimensions you omit; not doing so is a
protocol error. Both values are 0 by default.
Size is double-buffered, see wl_surface.commit.
</description>
<arg name="width" type="uint"/>
<arg name="height" type="uint"/>
</request>
<request name="set_anchor">
<description summary="configures the anchor point of the surface">
Requests that the compositor anchor the surface to the specified edges
and corners. If two orthoginal edges are specified (e.g. 'top' and
'left'), then the anchor point will be the intersection of the edges
(e.g. the top left corner of the output); otherwise the anchor point
will be centered on that edge, or in the center if none is specified.
Anchor is double-buffered, see wl_surface.commit.
</description>
<arg name="anchor" type="uint" enum="anchor"/>
</request>
<request name="set_exclusive_zone">
<description summary="configures the exclusive geometry of this surface">
Requests that the compositor avoids occluding an area of the surface
with other surfaces. The compositor's use of this information is
implementation-dependent - do not assume that this region will not
actually be occluded.
A positive value is only meaningful if the surface is anchored to an
edge, rather than a corner. The zone is the number of surface-local
coordinates from the edge that are considered exclusive.
Surfaces that do not wish to have an exclusive zone may instead specify
how they should interact with surfaces that do. If set to zero, the
surface indicates that it would like to be moved to avoid occluding
surfaces with a positive excluzive zone. If set to -1, the surface
indicates that it would not like to be moved to accomodate for other
surfaces, and the compositor should extend it all the way to the edges
it is anchored to.
For example, a panel might set its exclusive zone to 10, so that
maximized shell surfaces are not shown on top of it. A notification
might set its exclusive zone to 0, so that it is moved to avoid
occluding the panel, but shell surfaces are shown underneath it. A
wallpaper or lock screen might set their exclusive zone to -1, so that
they stretch below or over the panel.
The default value is 0.
Exclusive zone is double-buffered, see wl_surface.commit.
</description>
<arg name="zone" type="int"/>
</request>
<request name="set_margin">
<description summary="sets a margin from the anchor point">
Requests that the surface be placed some distance away from the anchor
point on the output, in surface-local coordinates. Setting this value
for edges you are not anchored to has no effect.
The exclusive zone includes the margin.
Margin is double-buffered, see wl_surface.commit.
</description>
<arg name="top" type="int"/>
<arg name="right" type="int"/>
<arg name="bottom" type="int"/>
<arg name="left" type="int"/>
</request>
<request name="set_keyboard_interactivity">
<description summary="requests keyboard events">
Set to 1 to request that the seat send keyboard events to this layer
surface. For layers below the shell surface layer, the seat will use
normal focus semantics. For layers above the shell surface layers, the
seat will always give exclusive keyboard focus to the top-most layer
which has keyboard interactivity set to true.
Layer surfaces receive pointer, touch, and tablet events normally. If
you do not want to receive them, set the input region on your surface
to an empty region.
Events is double-buffered, see wl_surface.commit.
</description>
<arg name="keyboard_interactivity" type="uint"/>
</request>
<request name="get_popup">
<description summary="assign this layer_surface as an xdg_popup parent">
This assigns an xdg_popup's parent to this layer_surface. This popup
should have been created via xdg_surface::get_popup with the parent set
to NULL, and this request must be invoked before committing the popup's
initial state.
See the documentation of xdg_popup for more details about what an
xdg_popup is and how it is used.
</description>
<arg name="popup" type="object" interface="xdg_popup"/>
</request>
<request name="ack_configure">
<description summary="ack a configure event">
When a configure event is received, if a client commits the
surface in response to the configure event, then the client
must make an ack_configure request sometime before the commit
request, passing along the serial of the configure event.
If the client receives multiple configure events before it
can respond to one, it only has to ack the last configure event.
A client is not required to commit immediately after sending
an ack_configure request - it may even ack_configure several times
before its next surface commit.
A client may send multiple ack_configure requests before committing, but
only the last request sent before a commit indicates which configure
event the client really is responding to.
</description>
<arg name="serial" type="uint" summary="the serial from the configure event"/>
</request>
<request name="destroy" type="destructor">
<description summary="destroy the layer_surface">
This request destroys the layer surface.
</description>
</request>
<event name="configure">
<description summary="suggest a surface change">
The configure event asks the client to resize its surface.
Clients should arrange their surface for the new states, and then send
an ack_configure request with the serial sent in this configure event at
some point before committing the new surface.
The client is free to dismiss all but the last configure event it
received.
The width and height arguments specify the size of the window in
surface-local coordinates.
The size is a hint, in the sense that the client is free to ignore it if
it doesn't resize, pick a smaller size (to satisfy aspect ratio or
resize in steps of NxM pixels). If the client picks a smaller size and
is anchored to two opposite anchors (e.g. 'top' and 'bottom'), the
surface will be centered on this axis.
If the width or height arguments are zero, it means the client should
decide its own window dimension.
</description>
<arg name="serial" type="uint"/>
<arg name="width" type="uint"/>
<arg name="height" type="uint"/>
</event>
<event name="closed">
<description summary="surface should be closed">
The closed event is sent by the compositor when the surface will no
longer be shown. The output may have been destroyed or the user may
have asked for it to be removed. Further changes to the surface will be
ignored. The client should destroy the resource after receiving this
event, and create a new surface if they so choose.
</description>
</event>
<enum name="error">
<entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/>
<entry name="invalid_size" value="1" summary="size is invalid"/>
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
</enum>
<enum name="anchor" bitfield="true">
<entry name="top" value="1" summary="the top edge of the anchor rectangle"/>
<entry name="bottom" value="2" summary="the bottom edge of the anchor rectangle"/>
<entry name="left" value="4" summary="the left edge of the anchor rectangle"/>
<entry name="right" value="8" summary="the right edge of the anchor rectangle"/>
</enum>
</interface>
</protocol>

1249
xdg-shell.xml Normal file

File diff suppressed because it is too large Load diff