some better timing for fading maybe. and reset the opacity when a window is finished...
[dana/dcompmgr.git] / screen.h
1 #ifndef dc__screen_h
2 #define dc__screen_h
3
4 #include <xcb/xcb.h>
5 #include <glib.h>
6 #include <sys/time.h>
7
8 struct d_window;
9 struct d_display;
10 struct d_list;
11
12 /* inherits from xcb_screen_t */
13 typedef struct d_screen {
14     xcb_screen_t      super;
15     int               ref;
16     struct d_display *dpy;
17     int               num;
18
19     xcb_window_t      selwin;  /* for the selection */
20     xcb_atom_t        selatom; /* ditto.. */
21
22     xcb_window_t      overlay;
23
24     struct timeval    next_repaint;
25     gboolean          need_repaint;
26
27     GHashTable       *winhash;
28     struct d_list    *stacking;
29     struct d_list    *plugin_data;
30
31     /* don't read this directly, use screen_get_root_pixmap() */
32     xcb_pixmap_t              root_pixmap;
33     gboolean                  root_pixmap_waiting;
34     xcb_get_property_cookie_t root_pixmap_ck[3];
35
36     void (*screen_paint)(struct d_screen *sc);
37     void (*window_show)(struct d_window *w);
38     void (*window_hide)(struct d_window *w);
39     void (*window_become_zombie)(struct d_window *w);
40     void (*window_zombie_dead)(struct d_window *w);
41     void (*window_move)(struct d_window *w);
42     void (*window_resize)(struct d_window *w);
43     void (*window_reshape)(struct d_window *w);
44     void (*window_opacity_change)(struct d_window *w);
45     void (*screen_root_pixmap_change)(struct d_screen *sc);
46 } d_screen_t;
47
48 d_screen_t* screen_new(struct d_display *dpy, int num, xcb_screen_t *xcb);
49
50 void screen_ref(d_screen_t *sc);
51 void screen_unref(d_screen_t *sc);
52
53 /*! Tries to register on the screen given by @sc.  If it succeeds, it fills
54     in @sc and returns TRUE, otherwise it returns FALSE.
55 */
56 gboolean screen_register(d_screen_t *sc);
57
58 struct d_window* screen_add_window(d_screen_t *sc, xcb_window_t wid);
59 void screen_remove_window(d_screen_t *sc, struct d_window *w);
60
61 struct d_window* screen_find_window(d_screen_t *sc, xcb_window_t id);
62
63 void screen_stacking_add(d_screen_t *sc, struct d_window *w);
64 void screen_stacking_remove(d_screen_t *sc, struct d_window *w);
65 void screen_stacking_move_above(d_screen_t *sc, struct d_window *w,
66                                 struct d_window *above);
67 void screen_stacking_move_to_top(d_screen_t *sc, struct d_window *w);
68 void screen_stacking_move_to_bottom(d_screen_t *sc, struct d_window *w);
69
70 void screen_setup_default_functions(d_screen_t *sc);
71
72 void  screen_add_plugin_data(d_screen_t *sc, int id, void *data);
73 void* screen_find_plugin_data(d_screen_t *sc, int id);
74 void  screen_remove_plugin_data(d_screen_t *sc, int id);
75
76 void screen_refresh(d_screen_t *sc);
77
78 void screen_update_root_pixmap(d_screen_t *sc);
79 xcb_pixmap_t screen_get_root_pixmap(d_screen_t *sc);
80
81 #endif