fix the select() call to work after it has timed out, and always flush at the end...
[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     GHashTable       *plugin_data;
30
31     void (*screen_paint)(struct d_screen *sc);
32     void (*window_show)(struct d_window *w);
33     void (*window_hide)(struct d_window *w);
34     void (*window_become_zombie)(struct d_window *w);
35 } d_screen_t;
36
37 d_screen_t* screen_new(struct d_display *dpy, int num, xcb_screen_t *xcb);
38
39 void screen_ref(d_screen_t *sc);
40 void screen_unref(d_screen_t *sc);
41
42 /*! Tries to register on the screen given by @sc.  If it succeeds, it fills
43     in @sc and returns TRUE, otherwise it returns FALSE.
44 */
45 gboolean screen_register(d_screen_t *sc);
46
47 void screen_add_window(d_screen_t *sc, xcb_window_t wid);
48 void screen_remove_window(d_screen_t *sc, struct d_window *w);
49
50 struct d_window* screen_find_window(d_screen_t *sc, xcb_window_t id);
51
52 void screen_stacking_add(d_screen_t *sc, struct d_window *w);
53 void screen_stacking_remove(d_screen_t *sc, struct d_window *w);
54
55 void screen_setup_default_functions(d_screen_t *sc);
56
57 void  screen_add_plugin_data(d_screen_t *sc, const char *key, void *data);
58 void* screen_find_plugin_data(d_screen_t *sc, const char *key);
59 void  screen_remove_plugin_data(d_screen_t *sc, const char *key);
60
61 void screen_refresh(d_screen_t *sc);
62
63 #endif