From 898e4a2717a7c160b46b4665b4d192a024859213 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Thu, 30 Mar 2017 08:30:02 +0200 Subject: [PATCH] Remove old color structure and name based parsing --- doc/theme3/convert.md | 2 ++ include/widgets/textbox.h | 1 - include/x11-helper.h | 21 ------------- source/x11-helper.c | 66 --------------------------------------- 4 files changed, 2 insertions(+), 88 deletions(-) diff --git a/doc/theme3/convert.md b/doc/theme3/convert.md index 7689057f..a7de67ac 100644 --- a/doc/theme3/convert.md +++ b/doc/theme3/convert.md @@ -1,5 +1,7 @@ # Convert old themes to the new format +> This is now invalid, old theme support has been removed and will be part of a separate tool. + **Rofi** 1.4 can still read in and convert the old theme format. To read the old format, convert it, and dump it into a new file run: diff --git a/include/widgets/textbox.h b/include/widgets/textbox.h index 20ed7e0a..0944f709 100644 --- a/include/widgets/textbox.h +++ b/include/widgets/textbox.h @@ -26,7 +26,6 @@ typedef struct widget widget; unsigned long flags; short cursor; - Color color_fg, color_bg; char *text; PangoLayout *layout; int tbft; diff --git a/include/x11-helper.h b/include/x11-helper.h index 98cd8ccd..dec570d4 100644 --- a/include/x11-helper.h +++ b/include/x11-helper.h @@ -196,27 +196,6 @@ extern xcb_colormap_t map; */ void x11_create_visual_and_colormap ( void ); -/** - * Structure describing a cairo color. - */ -typedef struct -{ - /** red channel */ - double red; - /** green channel */ - double green; - /** blue channel */ - double blue; - /** alpha channel */ - double alpha; -} Color; - -/** - * @param name String representing the color. - * - * Allocate a pixel value for an X named color - */ -Color color_get ( const char *const name ); /** * Gets a surface containing the background image of the desktop. 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 ) {