read all the available events at once
[dana/dcompmgr.git] / display.h
1 #ifndef dc__display_h
2 #define dc__display_h
3
4 #include <xcb/xcb.h>
5
6 #include <glib.h>
7
8 typedef struct d_display_ext {
9     gboolean          present;
10     int               error;
11     int               event;
12     int               opcode;
13     int               major_version;
14     int               minor_version;
15 } d_display_ext_t;
16
17 typedef struct d_display {
18     xcb_connection_t *conn;
19     int               ref;
20     int               fd;
21     struct d_screen  *screens;
22     int               nscreens;
23
24     d_display_ext_t xfixes;
25     d_display_ext_t render;
26     d_display_ext_t composite;
27     d_display_ext_t damage;
28
29     struct {
30         /* types */
31         xcb_atom_t atom;
32         xcb_atom_t cardinal;
33         xcb_atom_t utf8_string;
34         xcb_atom_t string;
35         xcb_atom_t pixmap;
36         /* properties */
37         xcb_atom_t net_wm_window_type;
38         xcb_atom_t net_wm_window_type_desktop;
39         xcb_atom_t net_wm_window_type_dock;
40         xcb_atom_t net_wm_window_type_normal;
41         xcb_atom_t net_wm_window_type_dialog;
42         xcb_atom_t net_wm_window_type_toolbar;
43         xcb_atom_t net_wm_window_type_menu;
44         xcb_atom_t net_wm_window_type_utility;
45         xcb_atom_t net_wm_window_type_splash;
46         xcb_atom_t net_wm_window_type_dropdown_menu;
47         xcb_atom_t net_wm_window_type_popup_menu;
48         xcb_atom_t net_wm_window_type_tooltip;
49         xcb_atom_t net_wm_window_type_notification;
50         xcb_atom_t net_wm_window_type_combo;
51         xcb_atom_t net_wm_window_type_dnd;
52     } a;
53 } d_display_t;
54
55 d_display_t* display_open(const char *name);
56
57 void display_ref(d_display_t *dpy);
58 void display_unref(d_display_t *dpy);
59
60 int display_claim_screens(d_display_t *dpy);
61
62 struct d_screen* display_screen_from_root(d_display_t *dpy, xcb_window_t root);
63 struct d_screen* display_screen_n(d_display_t *dpy, int n);
64
65 void display_error(d_display_t *dpy, xcb_generic_error_t *ev);
66
67 #endif