]> Dogcows Code - chaz/openbox/blob - render/test.c
make NLIMC the default titlebar layout
[chaz/openbox] / render / test.c
1 #include <stdio.h>
2 #include <X11/Xlib.h>
3 #include <X11/extensions/shape.h>
4 /*#include <GL/glx.h>*/
5 #include <string.h>
6 #include <stdlib.h>
7 #include "render.h"
8 #include <glib.h>
9
10 static int x_error_handler(Display * disp, XErrorEvent * error)
11 {
12 char buf[1024];
13 XGetErrorText(disp, error->error_code, buf, 1024);
14 printf("%s\n", buf);
15 return 0;
16 }
17
18 Display *ob_display;
19 int ob_screen;
20 Window ob_root;
21
22 int main()
23 {
24 Window win;
25 GC gc;
26 Pixmap pm;
27 Appearance *look;
28
29 int grabbed = 0;
30 Window root;
31 XGCValues values;
32 XEvent report;
33 int h = 500, w = 500, tmp;
34 XVisualInfo *vi;
35 int i;
36
37 ob_display = XOpenDisplay(NULL);
38 XSetErrorHandler(x_error_handler);
39 ob_screen = DefaultScreen(ob_display);
40 ob_root = RootWindow(ob_display, ob_screen);
41 win =
42 XCreateWindow(ob_display, RootWindow(ob_display, 0)
43 , 10, 10, w, h, 10,
44 CopyFromParent, /* depth */
45 CopyFromParent, /* class */
46 CopyFromParent, /* visual */
47 0, /* valuemask */
48 0); /* attributes */
49 XMapWindow(ob_display, win);
50 XSelectInput(ob_display, win, ExposureMask | StructureNotifyMask);
51 root = RootWindow (ob_display, DefaultScreen (ob_display));
52 render_startup();
53
54 look = appearance_new(Surface_Planar, 0);
55 look->surface.data.planar.grad = Background_Solid;
56 look->surface.data.planar.secondary = color_new(0xFF, 0xFF, 0xFF);
57 look->surface.data.planar.primary = color_parse("Red");
58 look->surface.data.planar.interlaced = FALSE;
59 look->area.x = 0;
60 look->area.x = 0;
61 look->area.width = 500;
62 look->area.height = 500;
63 if (ob_display == NULL) {
64 fprintf(stderr, "couldn't connect to X server :0\n");
65 return 0;
66 }
67
68 paint(win, look);
69 while (1) {
70 XNextEvent(ob_display, &report);
71 switch (report.type) {
72 case Expose:
73 break;
74 case ConfigureNotify:
75 look->area.width = report.xconfigure.width;
76 look->area.height = report.xconfigure.height;
77 paint(win, look);
78 printf("confignotify %i:%i\n", w, h);
79 break;
80 }
81
82 }
83
84 return 1;
85 }
This page took 0.035337 seconds and 4 git commands to generate.