From 9b219afc5b029a9bcd246b01a0c9030823722901 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Tue, 30 Nov 2021 18:52:37 +0100 Subject: [Config] Allow configuration block again in theme. Avoid confusion/breakage. --- Changelog | 1 + lexer/theme-parser.y | 29 +++++++++++++---------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Changelog b/Changelog index 187a94b3..6d966f15 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,7 @@ v1.7.2: - [Build] Fix building without window mode enabled. - [Config] Do not print out the 'theme' field in configuration on dump. - [CI] test window mode less build. + - Allow configuration block in theme again. v1.7.1: Turtley amazing! - [Theme] Fix highlight with only theme. diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y index 3a2db9e8..d149f05b 100644 --- a/lexer/theme-parser.y +++ b/lexer/theme-parser.y @@ -313,31 +313,21 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b ) * First have the configuration blocks, then the theme. */ t_main -: t_configuration_list t_entry_list_included { +: t_entry_list_included { // Dummy at this point. if ( rofi_theme == NULL ) { rofi_theme_reset(); } - rofi_theme_widget_add_properties ( rofi_theme, $2->properties ); - for ( unsigned int i = 0; i < $2->num_widgets; i++ ) { - ThemeWidget *d = $2->widgets[i]; + rofi_theme_widget_add_properties ( rofi_theme, $1->properties ); + for ( unsigned int i = 0; i < $1->num_widgets; i++ ) { + ThemeWidget *d = $1->widgets[i]; rofi_theme_parse_merge_widgets(rofi_theme, d); } - rofi_theme_free ( $2 ); + rofi_theme_free ( $1 ); } ; -t_configuration_list: - %empty { - if ( rofi_configuration == NULL ) { - rofi_configuration = g_slice_new0 ( ThemeWidget ); - rofi_configuration->name = g_strdup ( "Root" ); - } -} -| t_configuration_list T_CONFIGURATION T_BOPEN t_config_property_list_optional T_BCLOSE {}; - - /** * Small dummy object to make the prefix optional. */ @@ -359,8 +349,15 @@ t_entry_list { t_entry_list: - %empty { +t_entry_list T_CONFIGURATION T_BOPEN t_config_property_list_optional T_BCLOSE { + $$ = $1; +} +|%empty { $$ = g_slice_new0 ( ThemeWidget ); + if ( rofi_configuration == NULL ) { + rofi_configuration = g_slice_new0 ( ThemeWidget ); + rofi_configuration->name = g_strdup ( "Root" ); + } } | t_entry_list t_name_prefix_optional t_entry_name_path_selectors T_BOPEN t_property_list_optional T_BCLOSE { -- cgit v1.2.3