From 38035568f375c701d49658adbe9c7d632d584b31 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Tue, 13 Dec 2016 00:09:51 +0100 Subject: Fix separator class and tweak parser inheritance. --- lexer/theme-parser.y | 2 ++ source/theme.c | 15 +++++++++++++++ source/widgets/separator.c | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y index 468691ac..94a3691c 100644 --- a/lexer/theme-parser.y +++ b/lexer/theme-parser.y @@ -89,6 +89,7 @@ CLASS_PREFIX class_name state_path BOPEN optional_properties BCLOSE gchar *classn = g_strconcat ( "@", $2, NULL); Widget *widget = rofi_theme_find_or_create_class ( rofi_theme , classn ); g_free(classn); + widget->set = TRUE; for ( GList *iter = g_list_first ( $3 ); iter ; iter = g_list_next ( iter ) ) { widget = rofi_theme_find_or_create_class ( widget, iter->data ); } @@ -109,6 +110,7 @@ CLASS_PREFIX class_name state_path BOPEN optional_properties BCLOSE } g_list_foreach ( $2, (GFunc)g_free , NULL ); g_list_free ( $2 ); + widget->set = TRUE; for ( GList *iter = g_list_first ( $3 ); iter ; iter = g_list_next ( iter ) ) { widget = rofi_theme_find_or_create_class ( widget, iter->data ); } diff --git a/source/theme.c b/source/theme.c index e15016a8..3f11edf8 100644 --- a/source/theme.c +++ b/source/theme.c @@ -177,6 +177,9 @@ int rofi_theme_get_integer ( const char *wclass, const char *name, const char * return def; } Widget *widget = rofi_theme_find ( rofi_theme, name ); + if ( widget != rofi_theme ){ + widget = rofi_theme_find ( widget, state ); + } if ( widget == rofi_theme || widget->set == FALSE ){ // Fall back to class widget = rofi_theme_find ( rofi_theme, wclass); @@ -195,6 +198,9 @@ int rofi_theme_get_boolean ( const char *wclass, const char *name, const char * return def; } Widget *widget = rofi_theme_find ( rofi_theme, name ); + if ( widget != rofi_theme ){ + widget = rofi_theme_find ( widget, state ); + } if ( widget == rofi_theme || widget->set == FALSE ){ // Fall back to class widget = rofi_theme_find ( rofi_theme, wclass); @@ -213,6 +219,9 @@ char *rofi_theme_get_string ( const char *wclass, const char *name, const char return def; } Widget *widget = rofi_theme_find ( rofi_theme, name ); + if ( widget != rofi_theme ){ + widget = rofi_theme_find ( widget, state ); + } if ( widget == rofi_theme || widget->set == FALSE ){ // Fall back to class widget = rofi_theme_find ( rofi_theme, wclass); @@ -230,6 +239,9 @@ double rofi_theme_get_double ( const char *wclass, const char *name, const char return def; } Widget *widget = rofi_theme_find ( rofi_theme, name ); + if ( widget != rofi_theme ){ + widget = rofi_theme_find ( widget, state ); + } if ( widget == rofi_theme || widget->set == FALSE ){ // Fall back to class widget = rofi_theme_find ( rofi_theme, wclass); @@ -247,6 +259,9 @@ void rofi_theme_get_color ( const char *wclass, const char *name, const char *s return ; } Widget *widget = rofi_theme_find ( rofi_theme, name ); + if ( widget != rofi_theme ){ + widget = rofi_theme_find ( widget, state ); + } if ( widget == rofi_theme || widget->set == FALSE ){ // Fall back to class widget = rofi_theme_find ( rofi_theme, wclass); diff --git a/source/widgets/separator.c b/source/widgets/separator.c index 295ba95f..c04cecec 100644 --- a/source/widgets/separator.c +++ b/source/widgets/separator.c @@ -88,7 +88,7 @@ separator *separator_create ( const char *name, separator_type type, short sw ) // Enabled by default sb->widget.enabled = TRUE; - const char *line_style = rofi_theme_get_string ( "@scrollbar", sb->widget.name, NULL, "line-style", "solid"); + const char *line_style = rofi_theme_get_string ( "@separator", sb->widget.name, NULL, "line-style", "solid"); separator_set_line_style_from_string ( sb, line_style ); return sb; } -- cgit v1.2.3