From 804b114e5547b6a054bdc5ee860911d1107f9104 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Mon, 30 Mar 2015 18:04:47 +0200 Subject: Moved simplx to its own project. --- simple_x.c | 83 -------------------------------------------------------------- 1 file changed, 83 deletions(-) delete mode 100644 simple_x.c diff --git a/simple_x.c b/simple_x.c deleted file mode 100644 index 98ddbbe..0000000 --- a/simple_x.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * SimplX - Proposed name if not taken already. - * - * Copyright (C) 2014 Tomasz Kramkowski - * - * This program is free software. It is licensed under version 3 of the - * GNU General Public License. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/]. - */ -#include -#include -#include - -/* - * TODO: Figure out the alignment of these things fix the arrangement. - * Find a good name for this. - */ -typedef struct sx_gc { - /*struct {*/ - xcb_connection_t *connection; - xcb_screen_t *screen; - xcb_drawable_t window; - xcb_pixmap_t pixmap; - xcb_image_t *image; - xcb_gcontext_t gc; - /*} xcb;*/ -} SX; - -SX *sx_new_gc(uint16_t width, uint16_t height) -{ - SX *sx = malloc(sizeof(SX)); - - sx->connection = xcb_connect(NULL, NULL); - - sx->screen = xcb_setup_roots_iterator(xcb_get_setup(sx->connection)).data; - - uint32_t mask = XCB_CW_BACK_PIXEL; /* Needs events */ - uint32_t values[] = {sx->screen->black_pixel}; - - sx->window = xcb_generate_id(sx->connection); - xcb_create_window(sx->connection, - 24, - sx->window, - sx->screen->root, - 0, 0, - width, height, - 1, - XCB_WINDOW_CLASS_INPUT_OUTPUT, - sx->screen->root_visual, - mask, values); - - sx->pixmap = xcb_generate_id(sx->connection); - xcb_create_pixmap(sx->connection, - 24, - sx->pixmap, - sx->window, - width, height); - - uint8_t *img = malloc(width * height * 4); - xcb_image_t *image = xcb_image_create(width, height, - XCB_IMAGE_FORMAT_Z_PIXMAP, - 8, 24, 32, - 0, - XCB_IMAGE_ORDER_MSB_FIRST, - XCB_IMAGE_ORDER_LSB_FIRST, - img, - width * height * 4, - img); - - mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND; - values[0] = sx->screen->black_pixel; - values[1] = 0xFFFFFF; - - sx->gc = xcb_generate_id(sx->connection); - xcb_create_gc(sx->connection, - sx->gc, - sx->pixmap, - mask, values); - - return sx; -} -- cgit v1.2.3-54-g00ecf