diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-03-30 08:30:02 +0200 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-03-30 08:30:02 +0200 |
commit | 898e4a2717a7c160b46b4665b4d192a024859213 (patch) | |
tree | b246a098263f2ae778b140943cfca5de557546c3 /source/x11-helper.c | |
parent | eeee200d8f5778cd65cd1f7cef985df3526772c4 (diff) |
Remove old color structure and name based parsing
Diffstat (limited to 'source/x11-helper.c')
-rw-r--r-- | source/x11-helper.c | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/source/x11-helper.c b/source/x11-helper.c index 9388ca3e..d6f3aff4 100644 --- a/source/x11-helper.c +++ b/source/x11-helper.c @@ -807,72 +807,6 @@ void x11_create_visual_and_colormap ( void ) } } -Color color_get ( const char *const name ) -{ - char *copy = g_strdup ( name ); - char *cname = g_strstrip ( copy ); - - union - { - struct - { - uint8_t b; - uint8_t g; - uint8_t r; - uint8_t a; - } sep; - uint32_t pixel; - } color = { - .pixel = 0xffffffff, - }; - // Special format. - if ( strncmp ( cname, "argb:", 5 ) == 0 ) { - color.pixel = strtoul ( &cname[5], NULL, 16 ); - } - else if ( strncmp ( cname, "#", 1 ) == 0 ) { - unsigned long val = strtoul ( &cname[1], NULL, 16 ); - ssize_t length = strlen ( &cname[1] ); - switch ( length ) - { - case 3: - color.sep.a = 0xff; - color.sep.r = 16 * ( ( val & 0xF00 ) >> 8 ); - color.sep.g = 16 * ( ( val & 0x0F0 ) >> 4 ); - color.sep.b = 16 * ( val & 0x00F ); - break; - case 6: - color.pixel = val; - color.sep.a = 0xff; - break; - case 8: - color.pixel = val; - break; - default: - break; - } - } - else { - xcb_alloc_named_color_cookie_t cc = xcb_alloc_named_color ( xcb->connection, - map, strlen ( cname ), cname ); - xcb_alloc_named_color_reply_t *r = xcb_alloc_named_color_reply ( xcb->connection, cc, NULL ); - if ( r ) { - color.sep.a = 0xFF; - color.sep.r = r->visual_red; - color.sep.g = r->visual_green; - color.sep.b = r->visual_blue; - free ( r ); - } - } - g_free ( copy ); - - Color ret = { - .red = color.sep.r / 255.0, - .green = color.sep.g / 255.0, - .blue = color.sep.b / 255.0, - .alpha = color.sep.a / 255.0, - }; - return ret; -} xcb_window_t xcb_stuff_get_root_window ( xcb_stuff *xcb ) { |