get attributes/geometry/pixmap for windows
[dana/dcompmgr.git] / render.c
1 #include "render.h"
2 #include "screen.h"
3 #include "window.h"
4 #include "list.h"
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <xcb/render.h>
8
9 #define PLUGIN_NAME "render"
10
11 typedef struct {
12     void (*screen_paint)(d_screen_t *sc);
13 } data_t;
14
15 static void render_paint_screen(d_screen_t *sc);
16 static void paint_root(d_screen_t *sc);
17 static void paint_window(d_window_t *window);
18
19 void
20 render_init(d_screen_t *sc)
21 {
22     data_t *d = malloc(sizeof(data_t));
23     d->screen_paint = sc->screen_paint;
24     screen_add_plugin_data(sc, PLUGIN_NAME, d);
25
26     sc->screen_paint = render_paint_screen;
27 }
28
29 void
30 render_free(d_screen_t *sc)
31 {
32     data_t *d = screen_find_plugin_data(sc, PLUGIN_NAME);
33     free(d);
34 }
35
36 static void
37 render_paint_screen(d_screen_t *sc)
38 {
39     data_t *d = screen_find_plugin_data(sc, PLUGIN_NAME);
40     d_list_it_t *it;
41
42     printf("-- painting --\n");
43     paint_root(sc);
44     for (it = list_bottom(sc->stacking); it; it = it->prev)
45         paint_window(it->data);
46
47     /* call the function we replaced in the chain */
48     d->screen_paint(sc);
49 }
50
51 static void
52 paint_root(d_screen_t *sc)
53 {
54     int w, h;
55
56     w = sc->super.width_in_pixels;
57     h = sc->super.height_in_pixels;
58
59     //printf("-- paint root 0x%x --\n", sc->super.root);
60 }
61
62 static void
63 paint_window(d_window_t *w)
64 {
65     //printf("-- paint window 0x%x --\n", w->id);
66 }