]> icculus.org git repositories - dana/openbox.git/blob - render2/test.c
add textures
[dana/openbox.git] / render2 / test.c
1 #include <stdio.h>
2 #include <X11/Xlib.h>
3 #include <X11/extensions/shape.h>
4 #include <string.h>
5 #include <stdlib.h>
6 #include "render.h"
7 #include <glib.h>
8
9 static int x_error_handler(Display * disp, XErrorEvent * error)
10 {
11     char buf[1024];
12     XGetErrorText(disp, error->error_code, buf, 1024);
13     printf("%s\n", buf);
14     return 0;
15 }
16
17 int main()
18 {
19     Display *display;
20     Window win;
21     struct RrInstance *inst;
22     XEvent report;
23     XClassHint chint;
24
25     if (!(display = XOpenDisplay(NULL))) {
26         fprintf(stderr, "couldn't connect to X server in DISPLAY\n");
27         return EXIT_FAILURE;
28     }
29     XSetErrorHandler(x_error_handler);
30     win = XCreateWindow(display, RootWindow(display, DefaultScreen(display)),
31                         10, 10, 100, 100, 0, 
32                         CopyFromParent,   /* depth */
33                         CopyFromParent,   /* class */
34                         CopyFromParent,   /* visual */
35                         0,                /* valuemask */
36                         0);               /* attributes */
37     XMapWindow(display, win);
38     XSelectInput(display, win, ExposureMask | StructureNotifyMask);
39
40     chint.res_name = "rendertest";
41     chint.res_class = "Rendertest";
42     XSetClassHint(display, win, &chint);
43
44     /* init Render */
45     if (!(inst = RrInit(display, DefaultScreen(display)))) {
46         fprintf(stderr, "couldn't initialize the Render library "
47                 "(no suitable GL support found)\n");
48         return EXIT_FAILURE;
49     }
50
51     /*paint(win, look);*/
52     while (1) {
53         XNextEvent(display, &report);
54         switch (report.type) {
55         case Expose:
56             break;
57         case ConfigureNotify:
58             /*look->area.width = report.xconfigure.width;
59             look->area.height = report.xconfigure.height;
60             paint(win, look);*/
61             break;
62         }
63
64     }
65
66     return 1;
67 }