File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,17 @@ void gradient_pattern(struct gradient *grad)
115
115
}
116
116
}
117
117
118
+ struct gradient * gradient_copy (const struct gradient * grad )
119
+ {
120
+ if (grad == NULL )
121
+ return NULL ;
122
+
123
+ struct gradient * copy = gradient_alloc (grad -> length );
124
+ memcpy (copy -> colors , grad -> colors , grad -> length * sizeof (struct color ));
125
+ gradient_pattern (copy );
126
+ return copy ;
127
+ }
128
+
118
129
char * gradient_to_string (const struct gradient * grad )
119
130
{
120
131
if (!GRADIENT_VALID (grad )) return NULL ;
Original file line number Diff line number Diff line change @@ -67,6 +67,8 @@ void gradient_free(struct gradient *grad);
67
67
68
68
void gradient_pattern (struct gradient * grad );
69
69
70
+ struct gradient * gradient_copy (const struct gradient * grad );
71
+
70
72
char * gradient_to_string (const struct gradient * grad );
71
73
72
74
Original file line number Diff line number Diff line change @@ -513,7 +513,7 @@ void notification_init(struct notification *n)
513
513
if (!COLOR_VALID (n -> colors .bg )) n -> colors .bg = defcolors .bg ;
514
514
if (!COLOR_VALID (n -> colors .frame )) n -> colors .frame = defcolors .frame ;
515
515
516
- if (!GRADIENT_VALID (n -> colors .highlight )) n -> colors .highlight = defcolors .highlight ;
516
+ if (!GRADIENT_VALID (n -> colors .highlight )) n -> colors .highlight = gradient_copy ( defcolors .highlight ) ;
517
517
518
518
/* Sanitize misc hints */
519
519
if (n -> progress < 0 )
You can’t perform that action at this time.
0 commit comments