From 6b43fed3aa4a11ffd29afafc03ea5d6300b41953 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Wed, 6 Sep 2017 19:02:09 +0200 Subject: [PATCH] use color, background-color and border-color --- include/theme.h | 20 -------------------- source/rofi-types.c | 2 ++ source/theme.c | 32 +++----------------------------- source/widgets/textbox.c | 4 +--- source/widgets/widget.c | 4 ++-- 5 files changed, 8 insertions(+), 54 deletions(-) diff --git a/include/theme.h b/include/theme.h index f01a325c..810391f3 100644 --- a/include/theme.h +++ b/include/theme.h @@ -133,16 +133,6 @@ void rofi_theme_widget_add_properties ( ThemeWidget *widget, GHashTable *table ) * @returns The distance value of this property for this widget. */ RofiDistance rofi_theme_get_distance ( const widget *widget, const char *property, int def ); -/** - * @param widget The widget to query - * @param property The property to query. - * @param def The default value. - * - * Obtain the distance of the widget. - * - * @returns The distance value of this property for this widget. - */ -RofiDistance rofi_theme_get_distance_exact ( const widget *widget, const char *property, int def ); /** * @param widget The widget to query @@ -166,16 +156,6 @@ int rofi_theme_get_integer ( const widget *widget, const char *property, int */ int rofi_theme_get_position ( const widget *widget, const char *property, int def ); -/** - * @param widget The widget to query - * @param property The property to query. - * @param def The default value. - * - * Obtain the integer of the widget. - * - * @returns The integer value of this property for this widget. - */ -int rofi_theme_get_integer_exact ( const widget *widget, const char *property, int def ); /** * @param widget The widget to query diff --git a/source/rofi-types.c b/source/rofi-types.c index ae42e97d..507c659a 100644 --- a/source/rofi-types.c +++ b/source/rofi-types.c @@ -26,4 +26,6 @@ const char * const PropertyTypeName[P_NUM_TYPES] = { "List", /** Orientation */ "Orientation", + /** Inherit */ + "Inherit", }; diff --git a/source/theme.c b/source/theme.c index 4e810e00..8c35dee4 100644 --- a/source/theme.c +++ b/source/theme.c @@ -504,27 +504,10 @@ int rofi_theme_get_integer ( const widget *widget, const char *property, int def g_debug ( "Theme entry: #%s %s property %s unset.", widget->name, widget->state ? widget->state : "", property ); return def; } -int rofi_theme_get_integer_exact ( const widget *widget, const char *property, int def ) +RofiDistance rofi_theme_get_distance ( const widget *widget, const char *property, int def ) { - // State is note considered when doing exact match, only base name. - ThemeWidget *wid = rofi_theme_find_widget ( widget->name, NULL, TRUE ); - Property *p = rofi_theme_find_property ( wid, P_INTEGER, property, TRUE ); - if ( p ) { - if ( p->type == P_INHERIT ) { - if ( widget->parent ) { - return rofi_theme_get_integer_exact( widget->parent, property, def ); - } - return def; - } - return p->value.i; - } - g_debug ( "Theme entry: #%s %s property %s unset.", widget->name, widget->state ? widget->state : "", property ); - return def; -} -static RofiDistance _rofi_theme_get_distance ( const widget *widget, const char *property, int def, gboolean exact ) -{ - ThemeWidget *wid = rofi_theme_find_widget ( widget->name, widget->state, exact ); - Property *p = rofi_theme_find_property ( wid, P_PADDING, property, exact ); + ThemeWidget *wid = rofi_theme_find_widget ( widget->name, widget->state, FALSE ); + Property *p = rofi_theme_find_property ( wid, P_PADDING, property, FALSE ); if ( p ) { if ( p->type == P_INHERIT ) { if ( widget->parent ) { @@ -543,15 +526,6 @@ static RofiDistance _rofi_theme_get_distance ( const widget *widget, const char return (RofiDistance){ def, ROFI_PU_PX, ROFI_HL_SOLID }; } -RofiDistance rofi_theme_get_distance_exact ( const widget *widget, const char *property, int def ) -{ - return _rofi_theme_get_distance ( widget, property, def, TRUE ); -} -RofiDistance rofi_theme_get_distance ( const widget *widget, const char *property, int def ) -{ - return _rofi_theme_get_distance ( widget, property, def, FALSE ); -} - int rofi_theme_get_boolean ( const widget *widget, const char *property, int def ) { ThemeWidget *wid = rofi_theme_find_widget ( widget->name, widget->state, FALSE ); diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index aeca0722..26883fda 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -442,9 +442,7 @@ static void textbox_draw ( widget *wid, cairo_t *draw ) // TODO check if this is still needed after flatning. cairo_set_operator ( draw, CAIRO_OPERATOR_OVER ); cairo_set_source_rgb ( draw, 0.0, 0.0, 0.0 ); - rofi_theme_get_color ( WIDGET ( tb ), "foreground", draw ); - // Text - rofi_theme_get_color ( WIDGET ( tb ), "text", draw ); + rofi_theme_get_color ( WIDGET ( tb ), "color", draw ); // draw the cursor if ( tb->flags & TB_EDITABLE && tb->blink ) { // We want to place the cursor based on the text shown. diff --git a/source/widgets/widget.c b/source/widgets/widget.c index 5325762b..50c143e6 100644 --- a/source/widgets/widget.c +++ b/source/widgets/widget.c @@ -205,7 +205,7 @@ void widget_draw ( widget *widget, cairo_t *d ) cairo_close_path ( d ); cairo_set_source_rgba ( d, 1.0, 1.0, 1.0, 1.0 ); - rofi_theme_get_color ( widget, "background", d ); + rofi_theme_get_color ( widget, "background-color", d ); cairo_fill_preserve ( d ); cairo_clip ( d ); @@ -218,7 +218,7 @@ void widget_draw ( widget *widget, cairo_t *d ) cairo_save ( d ); cairo_translate ( d, widget->x, widget->y ); cairo_new_path ( d ); - rofi_theme_get_color ( widget, "foreground", d ); + rofi_theme_get_color ( widget, "border-color", d ); if ( left > 0 ) { double offset = ( radius_tl > 0 ) ? floor ( top / 2.0 ) : 0; cairo_set_line_width ( d, left );