dunst-project / dunst

Lightweight and customizable notification daemon
https://dunst-project.org
Other
4.6k stars 342 forks source link

Added rounded corners option for progress bar #1119

Closed ghost closed 1 year ago

ghost commented 2 years ago

This PR adds the option progress_bar_corner_radius to enable rounded corners on the progress bar. If its value is non-zero, draw_rounded_rect is used in place of draw_rect to render the bar. Please let me know if anything needs to be changed!

codecov-commenter commented 2 years ago

Codecov Report

Merging #1119 (4ca4fc8) into master (53a2ff1) will decrease coverage by 0.09%. The diff coverage is 5.26%.

@@            Coverage Diff             @@
##           master    #1119      +/-   ##
==========================================
- Coverage   65.26%   65.16%   -0.10%     
==========================================
  Files          46       46              
  Lines        7358     7370      +12     
==========================================
+ Hits         4802     4803       +1     
- Misses       2556     2567      +11     
Flag Coverage Δ
unittests 65.16% <5.26%> (-0.10%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/draw.c 50.61% <0.00%> (-1.06%) :arrow_down:
src/settings.c 47.57% <50.00%> (+0.04%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

fwsmit commented 1 year ago

@vlfldr would you mind finishing this PR?

ghost commented 1 year ago

@fwsmit Sorry for the delay. Just want to clarify, when you say "With whole number scaling it should work like this" in a comment above do you mean it should work as-is with the parameters changed to floats, or it should work by rounding to the nearest .5?

I am going to hold off on passing the frame width to draw_rounded_rect to support fractional scaling for now as it would involved either overloading or touching more of the codebase than this PR intended to.

fwsmit commented 1 year ago

@fwsmit Sorry for the delay. Just want to clarify, when you say "With whole number scaling it should work like this" in a comment above do you mean it should work as-is with the parameters changed to floats, or it should work by rounding to the nearest .5?

It should work as is. You can best check this by setting the progress bar width to 1 and seeing if the progress bar border is a nice 1-pixel line and not a blurry multi-pixel line.

I've tested it and it works great.

I am going to hold off on passing the frame width to draw_rounded_rect to support fractional scaling for now as it would involved either overloading or touching more of the codebase than this PR intended to.

Okay that's fine

fwsmit commented 1 year ago

After you address the open comment it's good

fwsmit commented 1 year ago

Thanks! This is a great addition to dunst. I'll go ahead and merge it