@@ -237,12 +237,12 @@ int string_parse_color(const char *s, struct color *ret)
237237
238238int string_parse_gradient (const char * s , struct gradient * * ret )
239239{
240- struct color colors [10 ];
240+ struct color colors [16 ];
241241 size_t length = 0 ;
242242
243243 gchar * * strs = g_strsplit (s , "," , -1 );
244244 for (int i = 0 ; strs [i ] != NULL ; i ++ ) {
245- if (i > 10 ) {
245+ if (i > 16 ) {
246246 LOG_W ("Do you really need so many colors? ;)" );
247247 break ;
248248 }
@@ -255,7 +255,8 @@ int string_parse_gradient(const char *s, struct gradient **ret)
255255
256256 g_strfreev (strs );
257257 if (length == 0 ) {
258- DIE ("Unreachable" );
258+ LOG_W ("Provide at least one color" );
259+ return false;
259260 }
260261
261262 * ret = gradient_alloc (length );
@@ -431,6 +432,21 @@ bool set_from_string(void *target, struct setting setting, const char *value) {
431432 LOG_M ("Using legacy offset syntax NxN, you should switch to the new syntax (N, N)" );
432433 return true;
433434 }
435+
436+ // Keep compatibility with old height semantics
437+ if (STR_EQ (setting .name , "height" ) && string_is_int (value )) {
438+ LOG_M ("Setting 'height' has changed behaviour after dunst 1.12.0, see https://dunst-project.org/release/#v1.12.0." );
439+ LOG_M ("Legacy height support may be dropped in the future. If you want to hide this message transition to" );
440+ LOG_M ("'height = (0, X)' for dynamic height (old behaviour equivalent) or to 'height = (X, X)' for a fixed height." );
441+
442+ int height ;
443+ if (!safe_string_to_int (& height , value ))
444+ return false;
445+
446+ ((struct length * )target )-> min = 0 ;
447+ ((struct length * )target )-> max = height ;
448+ return true;
449+ }
434450 return string_parse_length (target , value );
435451 case TYPE_COLOR :
436452 return string_parse_color (value , target );
@@ -525,7 +541,8 @@ void save_settings(struct ini *ini) {
525541 }
526542 } else {
527543 // set as a regular setting
528- set_setting (curr_setting , curr_entry .value );
544+ char * value = g_strstrip (curr_entry .value );
545+ set_setting (curr_setting , value );
529546 }
530547 } else {
531548 // interpret this section as a rule
0 commit comments