Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve draw_rounded_rect and fix progress bar #1213

Closed
wants to merge 10 commits into from

Conversation

bynect
Copy link
Member

@bynect bynect commented Oct 22, 2023

I started this pr to fix the problem with the progress bar described in #1178.

Before After
image image
image image
image

However I got carried away and also updated draw_rounded_rectangle to be more generic on which corners to round.
I plan on adding a configuration option to select which corners should be rounded.

These are some of the possible corner configurations:

1 2
image image
image image

@bynect
Copy link
Member Author

bynect commented Oct 22, 2023

Note that this is a much more general solution compared to #1183

cairo_fill(c);

// border
cairo_set_source_rgba(c, cl->frame.r, cl->frame.g, cl->frame.b, cl->frame.a);
cairo_set_line_width(c, frame_width * scale);
draw_rounded_rect(c,
frame_x + half_frame_width,
frame_y + half_frame_width,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to improve/fix one of the problem in #1178 where the bar frame is offset from the fill

// right side (background)
cairo_set_source_rgba(c, cl->bg.r, cl->bg.g, cl->bg.b, cl->bg.a);
draw_rounded_rect(c, x_bar_2, frame_y, progress_width_2, progress_height,
settings.progress_bar_corner_radius, scale, true, true);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filling the whole bar with the background and then applying the fill afterwards fixed the problem where the background and the bar mismatched when there were rounded corners

@bynect
Copy link
Member Author

bynect commented Oct 22, 2023

At this point it should be complete. Here a demonstration of what can it do thanks to the added flexibility of corners, progress_bar_corners and icon_corners. On top of that the progress bar offset and blurriness was improved a bit and the flip around error occurring at small percentages was resolved.

image

@fwsmit
Copy link
Member

fwsmit commented Oct 24, 2023

Hey, thanks for picking up this issue! Those images are very clear in explaining the changes. But as you said, you got a bit carried away :) That's a good thing, only the way you structured your changes make it very hard to review this PR. This PR contains a bunch of different changes that belong in different PR's. Your commits also often do more than one thing, for example changing code and fixing some white spacing.

To make it easier for me to review these changes and to get them merged in a timely manner, I want to ask you to do some reordering of these changes. I would start by tackling the issue described in #1178 in a new PR. So this should only contain changes to fix this issue, no added features or white space fixes. You can take a look at this article if you want to know more.

@bynect
Copy link
Member Author

bynect commented Oct 24, 2023

Hey, thanks for picking up this issue! Those images are very clear in explaining the changes. But as you said, you got a bit carried away :) That's a good thing, only the way you structured your changes make it very hard to review this PR. This PR contains a bunch of different changes that belong in different PR's. Your commits also often do more than one thing, for example changing code and fixing some white spacing.

To make it easier for me to review these changes and to get them merged in a timely manner, I want to ask you to do some reordering of these changes. I would start by tackling the issue described in #1178 in a new PR. So this should only contain changes to fix this issue, no added features or white space fixes. You can take a look at this article if you want to know more.

Hello, dividing the fix for #1178 from the implementation of corners would be somehow counterproductive because I still have to create a corner_pos enum. If you want I can remove the white space fixes, I did them because I noticed some styling inconsistencies.

The two main things I changed are:

  • the change in draw_rounded_rect to use corner_pos and apply corrections when needed
  • the settings corners, progress_bar_corners, icon_corners

If it's really needed I can split the first and the second in two different prs, but as I said before these two things are strictly related.

@bynect
Copy link
Member Author

bynect commented Oct 24, 2023

@fwsmit Following your advice I made a separate branch ((https://github.com/bynect/dunst/tree/corners-part1)) with only the first part of this pr (the change in draw_rounded_rect to use corner_pos and apply corrections when needed).
I hope this is easier to review. Honestly I would prefer if this pr could be merged as one piece, but if I need to create 2 other prs I'll adapt 😮‍💨

@bynect
Copy link
Member Author

bynect commented Nov 5, 2023

Is there a problem stopping this?

@fwsmit
Copy link
Member

fwsmit commented Nov 7, 2023

I haven't got around to reviewing the branch you posted. Could you post it as a PR? That makes it easier to find

@fwsmit
Copy link
Member

fwsmit commented Jan 20, 2024

This PR is superseeded by #1227

@fwsmit fwsmit closed this Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants