#include #include #include #include #include int main(int argc, char *argv[]) { Display *display; Window win, root; XEvent event; Pixmap pixmap, shape; Atom a; XTextProperty t; int screen, depth, white, black; int w, h, hw, hh; int quit = 0; unsigned char *data; if (!(display = XOpenDisplay(getenv("DISPLAY"))) || argc < 2) return 1; screen = DefaultScreen(display); root = RootWindow(display, screen); depth = DefaultDepth(display, screen); white = WhitePixel(display, screen); black = BlackPixel(display, screen); XReadBitmapFileData(argv[1], &w, &h, &data, &hw, &hh); pixmap = XCreatePixmapFromBitmapData(display, root, data, w, h, black, white, depth); // XReadBitmapFile(display, root, argv[1], &w, &h, &pixmap, &hw, &hh); // XReadBitmapFile(display, root, argv[2], &w, &h, &shape, &hw, &hh); win = XCreateSimpleWindow(display, root, 100, 100, w, h, 0, black, black); XSetWindowBackgroundPixmap(display, win, pixmap); // XShapeCombineMask(display, win, ShapeBounding, 0, 0, shape, ShapeSet); a = XInternAtom(display, "WM_DELETE_WINDOW", False); XSetWMProtocols(display, win, &a, 1); XStringListToTextProperty(&argv[1], 1, &t); XSetWMName(display, win, &t); XSelectInput(display, win, StructureNotifyMask); XMapWindow(display, win); while (!quit) { XNextEvent(display, &event); if (event.type == ClientMessage) quit = 1; } XCloseDisplay(display); return 0; }