4 #include <X11/extensions/shape.h>
10 static int x_error_handler(Display * disp, XErrorEvent * error)
13 XGetErrorText(disp, error->error_code, buf, 1024);
24 Atom delete_win, protocols;
27 struct RrInstance *inst;
28 struct RrSurface *sur;
29 struct RrColor pri, sec;
31 if (!(display = XOpenDisplay(NULL))) {
32 fprintf(stderr, "couldn't connect to X server in DISPLAY\n");
35 XSetErrorHandler(x_error_handler);
36 win = XCreateWindow(display, RootWindow(display, DefaultScreen(display)),
38 CopyFromParent, /* depth */
39 CopyFromParent, /* class */
40 CopyFromParent, /* visual */
43 XMapWindow(display, win);
44 XSelectInput(display, win, ExposureMask | StructureNotifyMask);
46 chint.res_name = "rendertest";
47 chint.res_class = "Rendertest";
48 XSetClassHint(display, win, &chint);
50 delete_win = XInternAtom(display, "WM_DELETE_WINDOW", False);
51 protocols = XInternAtom(display, "WM_PROTOCOLS", False);
52 XSetWMProtocols(display, win, &delete_win, 1);
55 if (!(inst = RrInit(display, DefaultScreen(display)))) {
56 fprintf(stderr, "couldn't initialize the Render library "
57 "(no suitable GL support found)\n");
61 sur = RrSurfaceNew(inst, RR_SURFACE_PLANAR, win, 0);
62 RrSurfaceSetArea(sur, 10, 10, 100, 100);
63 RrColorSet(&pri, 0, 0, 0, 0);
64 RrColorSet(&pri, 1, 1, 1, 0);
65 RrPlanarSet(sur, RR_PLANAR_VERTICAL, &pri, &sec);
69 XNextEvent(display, &report);
70 switch (report.type) {
72 if ((Atom)report.xclient.message_type == protocols)
73 if ((Atom)report.xclient.data.l[0] == delete_win)
82 report.xconfigure.width,
83 report.xconfigure.height);