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)
115115 }
116116}
117117
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+
118129char * gradient_to_string (const struct gradient * grad )
119130{
120131 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);
6767
6868void gradient_pattern (struct gradient * grad );
6969
70+ struct gradient * gradient_copy (const struct gradient * grad );
71+
7072char * gradient_to_string (const struct gradient * grad );
7173
7274
Original file line number Diff line number Diff line change @@ -513,7 +513,7 @@ void notification_init(struct notification *n)
513513 if (!COLOR_VALID (n -> colors .bg )) n -> colors .bg = defcolors .bg ;
514514 if (!COLOR_VALID (n -> colors .frame )) n -> colors .frame = defcolors .frame ;
515515
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 ) ;
517517
518518 /* Sanitize misc hints */
519519 if (n -> progress < 0 )
You can’t perform that action at this time.
0 commit comments