Skip to content

Commit

Permalink
shape: Use an explicit move_to to set rounded_rect position
Browse files Browse the repository at this point in the history
All other shape did it. While it usually have no side effects,
as seen in #920 screenshot from @actionless, there is instances
where this produce a invalid rectangle.
  • Loading branch information
Elv13 committed Jul 4, 2016
1 parent 0c909e8 commit 441587a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/gears/shape.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ local module = {}
-- @tparam number height The rectangle height
-- @tparam number radius the corner radius
function module.rounded_rect(cr, width, height, radius)

radius = radius or 10

if width / 2 < radius then
Expand All @@ -45,6 +46,8 @@ function module.rounded_rect(cr, width, height, radius)
radius = height / 2
end

cr:move_to(0, radius)

cr:arc( radius , radius , radius, math.pi , 3*(math.pi/2) )
cr:arc( width-radius, radius , radius, 3*(math.pi/2), math.pi*2 )
cr:arc( width-radius, height-radius, radius, math.pi*2 , math.pi/2 )
Expand Down

3 comments on commit 441587a

@actionless
Copy link
Member

@actionless actionless commented on 441587a Jul 4, 2016

Choose a reason for hiding this comment

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

thanks! now it's fine

i am wondering, could we move some smart_wibox's logic to wibox?

currently i have overridden naughty like that:
master...actionless:rounded-naughty

i am wondering how easy it could be to bring such shaping behaviour to upstream (of course it will be better to use beautiful instead of the hardcoded shape)

@Elv13
Copy link
Member Author

@Elv13 Elv13 commented on 441587a Jul 4, 2016

Choose a reason for hiding this comment

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

i am wondering, could we move some smart_wibox's logic to wibox?

Eventually, but really, really, this is enough for 3.6. I just want my tooltip PR merged (btw, can you comment on the issue regarding xresource, thanks) then that's it. I will be against merging any new code other than bug fixes. There is 1700 commits and 4 years since the last release... Plus there is tons of mature new features the 3.5/stable users miss for no good reasons.

And me and @mindeunix also have notification shapes using dirty hacks. I planned to do it, it was geometry_overhaul part 3.05 (3.04 was for awful.menu), but that PR pull some other code from the dynamic layout code (it places wiboxes using wibox.layout and the placement API) and I wont merge this for 3.6. Same goes for the gears.pattern/gears.pixmap PR and the big "merge my widgets" PR. Those are on ice.

@actionless
Copy link
Member

@actionless actionless commented on 441587a Jul 4, 2016

Choose a reason for hiding this comment

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

could you please give a link to that issue?

UPD: hopefully i've found (and fixed) it

btw, could you check those two, #772 and #877

Please sign in to comment.