]> Dogcows Code - chaz/openbox/blob - render/test.c
made all the gradients work with integer math. removed the pipecross and rectangle...
[chaz/openbox] / render / 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 Display *ob_display;
18 int ob_screen;
19 Window ob_root;
20
21 int main()
22 {
23 Window win;
24 RrInstance *inst;
25 RrAppearance *look;
26
27 Window root;
28 XEvent report;
29 int h = 500, w = 500;
30
31 ob_display = XOpenDisplay(NULL);
32 XSetErrorHandler(x_error_handler);
33 ob_screen = DefaultScreen(ob_display);
34 ob_root = RootWindow(ob_display, ob_screen);
35 win =
36 XCreateWindow(ob_display, RootWindow(ob_display, 0),
37 10, 10, w, h, 10,
38 CopyFromParent, /* depth */
39 CopyFromParent, /* class */
40 CopyFromParent, /* visual */
41 0, /* valuemask */
42 0); /* attributes */
43 XMapWindow(ob_display, win);
44 XSelectInput(ob_display, win, ExposureMask | StructureNotifyMask);
45 root = RootWindow (ob_display, DefaultScreen (ob_display));
46 inst = RrInstanceNew(ob_display, ob_screen);
47
48 look = RrAppearanceNew(inst, 0);
49 look->surface.grad = RR_SURFACE_PYRAMID;
50 look->surface.secondary = RrColorParse(inst, "Yellow");
51 look->surface.primary = RrColorParse(inst, "Blue");
52 look->surface.interlaced = FALSE;
53 if (ob_display == NULL) {
54 fprintf(stderr, "couldn't connect to X server :0\n");
55 return 0;
56 }
57
58 RrPaint(look, win, w, h);
59 while (1) {
60 XNextEvent(ob_display, &report);
61 switch (report.type) {
62 case Expose:
63 break;
64 case ConfigureNotify:
65 RrPaint(look, win,
66 report.xconfigure.width,
67 report.xconfigure.height);
68 break;
69 }
70
71 }
72
73 RrAppearanceFree (look);
74 RrInstanceFree (inst);
75
76 return 1;
77 }
This page took 0.038858 seconds and 5 git commands to generate.