From cdeeec39b8d36190855071d6c5e28991d9685ce9 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Fri, 26 Nov 2021 21:46:38 +0100 Subject: [PATCH 1/8] Bump to 1.7.1-dev --- configure.ac | 2 +- meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index a027909db..2ea1b73bb 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([rofi], [1.7.1], [https://github.com/davatorium/rofi/],[],[https://reddit.com/r/qtools/]) +AC_INIT([rofi], [1.7.1-dev], [https://github.com/davatorium/rofi/],[],[https://reddit.com/r/qtools/]) AC_CONFIG_SRCDIR([source/rofi.c]) AC_CONFIG_HEADER([config.h]) diff --git a/meson.build b/meson.build index 5f24f45b6..153fc51d3 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('rofi', 'c', - version: '1.7.1', + version: '1.7.1-dev', meson_version: '>=0.47.0', license: [ 'MIT' ], default_options: [ From 91f3200d8c38ff7edcd1133bec16da2a388c2b19 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Sun, 28 Nov 2021 16:21:36 +0100 Subject: [PATCH 2/8] [Dist] Fix missing README.md --- Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 2578d9b27..90447dca1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -184,7 +184,8 @@ EXTRA_DIST += \ doc/rofi-script.5.markdown \ doc/rofi-theme-selector.1.markdown \ doc/rofi-sensible-terminal.1.markdown \ - doc/rofi.1.markdown + doc/rofi.1.markdown\ + README.md ### # Themes From dee9c526d33ec078e0d915cd223531e0e786da19 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Sun, 28 Nov 2021 17:08:09 +0100 Subject: [PATCH 3/8] [Rofi] Don't try to parse commandline options using theme engine if theme parsing failed. Issues: #1531 --- lexer/theme-lexer.l | 1 - source/rofi.c | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l index c36df48be..e9b8e99f6 100644 --- a/lexer/theme-lexer.l +++ b/lexer/theme-lexer.l @@ -808,7 +808,6 @@ if ( queue == NULL ) { } . { yytext[yyleng-1] = '\0'; - fprintf(stderr,"initial found: |%s|\n", yytext); return T_ERROR; }
. { diff --git a/source/rofi.c b/source/rofi.c index d1addf4a0..bf320057e 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -954,7 +954,11 @@ int main(int argc, char *argv[]) { TICK_N("Parsed theme"); } // Parse command line for settings, independent of other -no-config. - config_parse_cmd_options(); + if (list_of_error_msgs == NULL) { + // Only call this when there are no errors. + // This might clear existing errors. + config_parse_cmd_options(); + } TICK_N("Load cmd config "); parse_keys_abe(bindings); From b03c072aaaf5de4557c7c9e7e8997d5c639dc818 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Mon, 29 Nov 2021 19:15:19 +0100 Subject: [PATCH 4/8] [Build] Allow rofi to build without window mode fixes: #1533 --- source/xcb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/xcb.c b/source/xcb.c index c2bf52b85..89d049a03 100644 --- a/source/xcb.c +++ b/source/xcb.c @@ -1089,7 +1089,9 @@ static void main_loop_x11_event_handler_view(xcb_generic_event_t *event) { case XCB_DESTROY_NOTIFY: { xcb_window_t win = ((xcb_destroy_notify_event_t *)event)->window; if (win != rofi_view_get_window()) { +#ifdef WINDOW_MODE window_client_handle_signal(win, FALSE); +#endif } else { g_main_loop_quit(xcb->main_loop); } @@ -1098,7 +1100,9 @@ static void main_loop_x11_event_handler_view(xcb_generic_event_t *event) { case XCB_CREATE_NOTIFY: { xcb_window_t win = ((xcb_create_notify_event_t *)event)->window; if (win != rofi_view_get_window()) { +#ifdef WINDOW_MODE window_client_handle_signal(win, TRUE); +#endif } break; } From f72d6135bd8c4903adb233457b2ca1b0ca4b2705 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Mon, 29 Nov 2021 19:31:31 +0100 Subject: [PATCH 5/8] [Config] on -dump-config do not include -theme option. But print the right line at the bottom. fixes: #1534 --- Changelog | 4 +++ source/xrmoptions.c | 78 +++++++++++++++++++++++++-------------------- 2 files changed, 48 insertions(+), 34 deletions(-) diff --git a/Changelog b/Changelog index 4f31be6fe..d27a3b09a 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,7 @@ +v1.7.2: + - Fix building without window mode enabled. + - Do not print out the 'theme' field in confgiration on dump. + v1.7.1: Turtley amazing! - [Theme] Fix highlight with only theme. - Updated documentation and landing page (Thanks to RaZ0rr-Two) diff --git a/source/xrmoptions.c b/source/xrmoptions.c index 77d5a541a..c77ca3146 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -46,18 +46,15 @@ ThemeWidget *rofi_configuration = NULL; /** Different sources of configuration. */ -const char *const ConfigSourceStr[] = { - "Default", - "File", - "Rasi File", - "Commandline", -}; +const char *const ConfigSourceStr[] = {"Default", "File", "Rasi File", + "Commandline", "Don't Display"}; /** Enumerator of different sources of configuration. */ enum ConfigSource { CONFIG_DEFAULT = 0, CONFIG_FILE = 1, CONFIG_FILE_THEME = 2, - CONFIG_CMDLINE = 3 + CONFIG_CMDLINE = 3, + CONFIG_NO_DISPLAY = 4 }; typedef struct { @@ -346,7 +343,7 @@ static XrmOption xrmOptions[] = { {.str = &config.theme}, NULL, "New style theme file", - CONFIG_DEFAULT}, + CONFIG_DEFAULT | CONFIG_NO_DISPLAY}, {xrm_Number, "max-history-size", {.num = &config.max_history_size}, @@ -466,12 +463,12 @@ static void config_parse_cmd_option(XrmOption *option) { switch (option->type) { case xrm_Number: if (find_arg_uint(key, option->value.num) == TRUE) { - option->source = CONFIG_CMDLINE; + option->source = (option->source & ~3) | CONFIG_CMDLINE; } break; case xrm_SNumber: if (find_arg_int(key, option->value.snum) == TRUE) { - option->source = CONFIG_CMDLINE; + option->source = (option->source & ~3) | CONFIG_CMDLINE; } break; case xrm_String: @@ -480,25 +477,25 @@ static void config_parse_cmd_option(XrmOption *option) { g_free(option->mem); option->mem = NULL; } - option->source = CONFIG_CMDLINE; + option->source = (option->source & ~3) | CONFIG_CMDLINE; } break; case xrm_Boolean: if (find_arg(key) >= 0) { *(option->value.num) = TRUE; - option->source = CONFIG_CMDLINE; + option->source = (option->source & ~3) | CONFIG_CMDLINE; } else { g_free(key); key = g_strdup_printf("-no-%s", option->name); if (find_arg(key) >= 0) { *(option->value.num) = FALSE; - option->source = CONFIG_CMDLINE; + option->source = (option->source & ~3) | CONFIG_CMDLINE; } } break; case xrm_Char: if (find_arg_char(key, option->value.charc) == TRUE) { - option->source = CONFIG_CMDLINE; + option->source = (option->source & ~3) | CONFIG_CMDLINE; } break; default: @@ -597,7 +594,7 @@ static gboolean __config_parser_set_property(XrmOption *option, // Memory (option)->mem = *(option->value.str); - option->source = CONFIG_FILE_THEME; + option->source = (option->source & ~3) | CONFIG_FILE_THEME; } else if (option->type == xrm_Number) { if (p->type != P_INTEGER) { *error = @@ -606,7 +603,7 @@ static gboolean __config_parser_set_property(XrmOption *option, return TRUE; } *(option->value.snum) = p->value.i; - option->source = CONFIG_FILE_THEME; + option->source = (option->source & ~3) | CONFIG_FILE_THEME; } else if (option->type == xrm_SNumber) { if (p->type != P_INTEGER) { *error = @@ -615,7 +612,7 @@ static gboolean __config_parser_set_property(XrmOption *option, return TRUE; } *(option->value.num) = (unsigned int)(p->value.i); - option->source = CONFIG_FILE_THEME; + option->source = (option->source & ~3) | CONFIG_FILE_THEME; } else if (option->type == xrm_Boolean) { if (p->type != P_BOOLEAN) { *error = @@ -624,7 +621,7 @@ static gboolean __config_parser_set_property(XrmOption *option, return TRUE; } *(option->value.num) = (p->value.b); - option->source = CONFIG_FILE_THEME; + option->source = (option->source & ~3) | CONFIG_FILE_THEME; } else if (option->type == xrm_Char) { if (p->type != P_CHAR) { *error = g_strdup_printf( @@ -633,7 +630,7 @@ static gboolean __config_parser_set_property(XrmOption *option, return TRUE; } *(option->value.charc) = (p->value.c); - option->source = CONFIG_FILE_THEME; + option->source = (option->source & ~3) | CONFIG_FILE_THEME; } else { // TODO add type *error = g_strdup_printf("Option: %s is not of a supported type: %s.", @@ -675,7 +672,6 @@ gboolean config_parse_set_property(const Property *p, char **error) { //*error = g_strdup_printf("Option: %s is not found.", p->name); g_warning("Option: %s is not found.", p->name); - for (GList *iter = g_list_first(extra_parsed_options); iter != NULL; iter = g_list_next(iter)) { if (g_strcmp0(((Property *)(iter->data))->name, p->name) == 0) { @@ -713,7 +709,7 @@ void config_xresource_free(void) { } static void config_parse_dump_config_option(FILE *out, XrmOption *option) { - if (option->type == xrm_Char || option->source == CONFIG_DEFAULT) { + if (option->type == xrm_Char || (option->source & 3) == CONFIG_DEFAULT) { fprintf(out, "/*"); } fprintf(out, "\t%s: ", option->name); @@ -747,7 +743,7 @@ static void config_parse_dump_config_option(FILE *out, XrmOption *option) { } fprintf(out, ";"); - if (option->type == xrm_Char || option->source == CONFIG_DEFAULT) { + if (option->type == xrm_Char || (option->source & 3) == CONFIG_DEFAULT) { fprintf(out, "*/"); } fprintf(out, "\n"); @@ -764,12 +760,19 @@ void config_parse_dump_config_rasi_format(FILE *out, gboolean changes) { continue; } } - if (!changes || xrmOptions[i].source != CONFIG_DEFAULT) { + if ((xrmOptions[i].source & CONFIG_NO_DISPLAY) == CONFIG_NO_DISPLAY) { + continue; + } + if (!changes || (xrmOptions[i].source & 3) != CONFIG_DEFAULT) { config_parse_dump_config_option(out, &(xrmOptions[i])); } } for (unsigned int i = 0; i < num_extra_options; i++) { - if (!changes || extra_options[i].source != CONFIG_DEFAULT) { + if ((extra_options[i].source & CONFIG_NO_DISPLAY) == CONFIG_NO_DISPLAY) { + continue; + } + if (!changes || (extra_options[i].source & 3) != CONFIG_DEFAULT) { + config_parse_dump_config_option(out, &(extra_options[i])); } } @@ -780,6 +783,10 @@ void config_parse_dump_config_rasi_format(FILE *out, gboolean changes) { } fprintf(out, "}\n"); + + if (config.theme != NULL) { + fprintf(out, "@theme \"%s\"\r\n", config.theme); + } } static void print_option_string(XrmOption *xo, int is_term) { @@ -790,12 +797,12 @@ static void print_option_string(XrmOption *xo, int is_term) { printf("\t" color_italic "%s" color_reset, (*(xo->value.str) == NULL) ? "(unset)" : (*(xo->value.str))); printf(" " color_green "(%s)" color_reset "\n", - ConfigSourceStr[xo->source]); + ConfigSourceStr[xo->source & 3]); } else { printf("\t-%s [string]%-*c%s\n", xo->name, 30 - l, ' ', xo->comment); printf("\t\t%s", (*(xo->value.str) == NULL) ? "(unset)" : (*(xo->value.str))); - printf(" (%s)\n", ConfigSourceStr[xo->source]); + printf(" (%s)\n", ConfigSourceStr[xo->source & 3]); } } static void print_option_number(XrmOption *xo, int is_term) { @@ -805,11 +812,11 @@ static void print_option_number(XrmOption *xo, int is_term) { 30 - l, ' ', xo->comment); printf("\t" color_italic "%u" color_reset, *(xo->value.num)); printf(" " color_green "(%s)" color_reset "\n", - ConfigSourceStr[xo->source]); + ConfigSourceStr[xo->source & 3]); } else { printf("\t-%s [number]%-*c%s\n", xo->name, 30 - l, ' ', xo->comment); printf("\t\t%u", *(xo->value.num)); - printf(" (%s)\n", ConfigSourceStr[xo->source]); + printf(" (%s)\n", ConfigSourceStr[xo->source & 3]); } } static void print_option_snumber(XrmOption *xo, int is_term) { @@ -819,11 +826,11 @@ static void print_option_snumber(XrmOption *xo, int is_term) { 30 - l, ' ', xo->comment); printf("\t" color_italic "%d" color_reset, *(xo->value.snum)); printf(" " color_green "(%s)" color_reset "\n", - ConfigSourceStr[xo->source]); + ConfigSourceStr[xo->source & 3]); } else { printf("\t-%s [number]%-*c%s\n", xo->name, 30 - l, ' ', xo->comment); printf("\t\t%d", *(xo->value.snum)); - printf(" (%s)\n", ConfigSourceStr[xo->source]); + printf(" (%s)\n", ConfigSourceStr[xo->source & 3]); } } static void print_option_char(XrmOption *xo, int is_term) { @@ -833,11 +840,11 @@ static void print_option_char(XrmOption *xo, int is_term) { 30 - l, ' ', xo->comment); printf("\t" color_italic "%c" color_reset, *(xo->value.charc)); printf(" " color_green "(%s)" color_reset "\n", - ConfigSourceStr[xo->source]); + ConfigSourceStr[xo->source & 3]); } else { printf("\t-%s [character]%-*c%s\n", xo->name, 30 - l, ' ', xo->comment); printf("\t\t%c", *(xo->value.charc)); - printf(" (%s)\n", ConfigSourceStr[xo->source]); + printf(" (%s)\n", ConfigSourceStr[xo->source & 3]); } } static void print_option_boolean(XrmOption *xo, int is_term) { @@ -848,15 +855,18 @@ static void print_option_boolean(XrmOption *xo, int is_term) { printf("\t" color_italic "%s" color_reset, (*(xo->value.snum)) ? "True" : "False"); printf(" " color_green "(%s)" color_reset "\n", - ConfigSourceStr[xo->source]); + ConfigSourceStr[xo->source & 3]); } else { printf("\t-[no-]%s %-*c%s\n", xo->name, 33 - l, ' ', xo->comment); printf("\t\t%s", (*(xo->value.snum)) ? "True" : "False"); - printf(" (%s)\n", ConfigSourceStr[xo->source]); + printf(" (%s)\n", ConfigSourceStr[xo->source & 3]); } } static void print_option(XrmOption *xo, int is_term) { + if ((xo->source & CONFIG_NO_DISPLAY) == CONFIG_NO_DISPLAY) { + return; + } switch (xo->type) { case xrm_String: print_option_string(xo, is_term); From 92dae73bc11b2538b874ffb820c159ab97f42599 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Mon, 29 Nov 2021 21:03:14 +0100 Subject: [PATCH 6/8] Enable/Disable windowmode test (#1536) * Enable/Disable windowmode test * [CI] Fix typo in name. * Update Changelog --- .github/actions/autotools/action.yml | 5 ++++- .github/workflows/build.yml | 13 +++++++++++++ Changelog | 5 +++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/actions/autotools/action.yml b/.github/actions/autotools/action.yml index db95fd3c5..572f47f08 100644 --- a/.github/actions/autotools/action.yml +++ b/.github/actions/autotools/action.yml @@ -5,6 +5,9 @@ inputs: cc: description: Compiler to use required: true + windowmode: + description: Enable window mode + required: true runs: using: composite @@ -18,7 +21,7 @@ runs: mkdir builddir && cd builddir - ../configure CC=${{ inputs.cc }} + ../configure CC=${{ inputs.cc }} --${{ inputs.windowmode }}-windowmode shell: bash - id: build run: cd builddir && make diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1dcf06479..aed5e72b8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,6 +45,18 @@ jobs: - uses: ./.github/actions/autotools with: cc: gcc + windowmode: enable + build-autotools-gcc-no-window: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - uses: ./.github/actions/setup + - uses: ./.github/actions/autotools + with: + cc: gcc + windowmode: disable build-autotools-clang: runs-on: ubuntu-latest steps: @@ -55,3 +67,4 @@ jobs: - uses: ./.github/actions/autotools with: cc: clang + windowmode: enable diff --git a/Changelog b/Changelog index d27a3b09a..187a94b3b 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,7 @@ v1.7.2: - - Fix building without window mode enabled. - - Do not print out the 'theme' field in confgiration on dump. + - [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. v1.7.1: Turtley amazing! - [Theme] Fix highlight with only theme. From 9b219afc5b029a9bcd246b01a0c9030823722901 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Tue, 30 Nov 2021 18:52:37 +0100 Subject: [PATCH 7/8] [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 187a94b3b..6d966f159 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 3a2db9e8d..d149f05b1 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 { From 9bbfa7c51b6f51df048d99458dc4e25d3e07afc6 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Tue, 30 Nov 2021 18:59:13 +0100 Subject: [PATCH 8/8] Version 1.7.2 --- Changelog | 2 +- configure.ac | 2 +- meson.build | 2 +- releasenotes/1.7.2/release-1.7.2.markdown | 23 +++++++++++++++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 releasenotes/1.7.2/release-1.7.2.markdown diff --git a/Changelog b/Changelog index 6d966f159..554394a25 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,4 @@ -v1.7.2: +v1.7.2: Shellebrations! - [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. diff --git a/configure.ac b/configure.ac index 2ea1b73bb..590b28747 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([rofi], [1.7.1-dev], [https://github.com/davatorium/rofi/],[],[https://reddit.com/r/qtools/]) +AC_INIT([rofi], [1.7.2], [https://github.com/davatorium/rofi/],[],[https://reddit.com/r/qtools/]) AC_CONFIG_SRCDIR([source/rofi.c]) AC_CONFIG_HEADER([config.h]) diff --git a/meson.build b/meson.build index 153fc51d3..a8d9c4689 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('rofi', 'c', - version: '1.7.1-dev', + version: '1.7.2', meson_version: '>=0.47.0', license: [ 'MIT' ], default_options: [ diff --git a/releasenotes/1.7.2/release-1.7.2.markdown b/releasenotes/1.7.2/release-1.7.2.markdown new file mode 100644 index 000000000..fc30089d6 --- /dev/null +++ b/releasenotes/1.7.2/release-1.7.2.markdown @@ -0,0 +1,23 @@ +# 1.7.2: Shellebrations! + +A quick in between release, a bug got fixed that caused configurations not working any more in theme files. +While this is the desired behaviour, this release reverts it to avoid breaking to many setups. + +# Changelog + +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. + +# Thanks + +Big thanks to everybody reporting issues. +Special thanks goes to: + +* Iggy +* Quentin Glidic +* Danny Colin + +Apologies if I mistyped or missed anybody.