/*
* vim:ts=4:sw=4:expandtab
*
- * © 2010-2011 Michael Stapelberg
+ * © 2010-2012 Michael Stapelberg
*
* xcb.c: contains all functions which use XCB to talk to X11. Mostly wrappers
* around the rather complicated/ugly parts of the XCB API.
#include "cursors.h"
+xcb_connection_t *conn;
+xcb_screen_t *screen;
+
#define curs_invisible_width 8
#define curs_invisible_height 8
(strtol(strgroups[2], NULL, 16))};
return (rgb16[0] << 16) + (rgb16[1] << 8) + rgb16[2];
-}
+}
xcb_visualtype_t *get_root_visual_type(xcb_screen_t *screen) {
xcb_visualtype_t *visual_type = NULL;
return NULL;
}
-xcb_pixmap_t create_bg_pixmap(xcb_connection_t *conn, xcb_screen_t *scr, char *color) {
+xcb_pixmap_t create_bg_pixmap(xcb_connection_t *conn, xcb_screen_t *scr, u_int32_t* resolution, char *color) {
xcb_pixmap_t bg_pixmap = xcb_generate_id(conn);
xcb_create_pixmap(conn, scr->root_depth, bg_pixmap, scr->root,
- scr->width_in_pixels, scr->height_in_pixels);
+ resolution[0], resolution[1]);
/* Generate a Graphics Context and fill the pixmap with background color
* (for images that are smaller than your screen) */
xcb_gcontext_t gc = xcb_generate_id(conn);
uint32_t values[] = { get_colorpixel(color) };
xcb_create_gc(conn, gc, bg_pixmap, XCB_GC_FOREGROUND, values);
- xcb_rectangle_t rect = { 0, 0, scr->width_in_pixels, scr->height_in_pixels };
+ xcb_rectangle_t rect = { 0, 0, resolution[0], resolution[1] };
xcb_poly_fill_rectangle(conn, bg_pixmap, gc, 1, &rect);
+ xcb_free_gc(conn, gc);
return bg_pixmap;
}
values[2] = XCB_EVENT_MASK_EXPOSURE |
XCB_EVENT_MASK_KEY_PRESS |
XCB_EVENT_MASK_KEY_RELEASE |
- XCB_EVENT_MASK_VISIBILITY_CHANGE;
+ XCB_EVENT_MASK_VISIBILITY_CHANGE |
+ XCB_EVENT_MASK_STRUCTURE_NOTIFY;
xcb_create_window(conn,
- 24,
+ XCB_COPY_FROM_PARENT,
win, /* the window id */
scr->root, /* parent == root */
0, 0,
}
}
+ free(modeswitchcodes);
+ free(modmap_r);
return 0;
}