#include #include #include #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) #define container_of(ptr, type, member) ({ \ const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) #define STUB() do { fprintf(stderr, "*** STUB: %s\n", __func__); } while (0) struct csx_event { XEvent xevent; struct wl_list link; }; struct csx_atom { uint32_t hash; char *name; Atom value; }; struct csx_extension { const char *name; int major; int first_event; int first_error; struct wl_list link; }; struct csx_display { struct wl_display *display; struct wl_registry *registry; struct wl_compositor *compositor; struct wl_shm *shm; struct wl_shell *shell; uint32_t shm_formats; union entry *resource_map; uint32_t resource_size; uint32_t resource_count, free_resource; struct wl_list event_list; struct csx_window *root; Display *xdisplay; Screen screens[1]; Depth depths[2]; Visual depth24_visuals[1]; Visual depth32_visuals[1]; unsigned long serial; struct csx_atom *atom_table[256]; struct csx_atom *atom_map[256]; Atom next_atom; int major; int minor; int next_major; int next_event; int next_error; struct wl_list extension_list; struct csx_xfixes *xfixes; struct csx_randr *randr; }; static inline struct csx_display * csx_display(Display *display) { return (struct csx_display *) ((_XPrivDisplay) display + 1); } void csx_display_enter(struct csx_display *display, int major, int minor); XID csx_display_add_resource(struct csx_display *display, void *p); void csx_display_remove_resource(struct csx_display *display, XID id); void *csx_display_lookup_resource(struct csx_display *display, XID id); void csx_display_error(struct csx_display *display, XID resourceid, int error); void csx_display_add_seat(struct csx_display *display, uint32_t name, uint32_t version); void csx_display_add_extension(struct csx_display *display, struct csx_extension *extension, const char *name, int nevents, int nerrors); struct csx_extension *csx_display_get_extension(struct csx_display *display, const char *name); int csx_display_add_xfixes(struct csx_display *display); int csx_display_add_randr(struct csx_display *display); struct csx_property { Atom name; Atom type; int format; int nelements; struct wl_list link; }; struct csx_window { XID id; struct csx_window *parent; int x; int y; int width; int height; unsigned int border_width; int depth; unsigned int class; Visual *visual; unsigned long event_mask; struct csx_display *display; int mapped; struct wl_list link; struct wl_list child_list; pixman_region32_t output_clip; pixman_region32_t border_clip; struct csx_pixmap *pixmap; /* viewable iff has pixmap */ struct wl_surface *surface; struct wl_shell_surface *shell_surface; struct wl_list property_list; }; struct csx_window * csx_window_create(struct csx_display *display, struct csx_window *parent); void csx_window_destroy(struct csx_window *window); struct csx_window *csx_window_pick(struct csx_window *window, int x, int y, int *local_x, int *local_y); struct csx_pixmap { unsigned int width; unsigned int height; unsigned int depth; pixman_image_t *image; void *data; struct wl_buffer *buffer; int refcount; }; struct csx_pixmap * csx_pixmap_create(struct csx_display *display, unsigned int width, unsigned int height, unsigned int depth); void csx_pixmap_unref(struct csx_pixmap *pixmap);