Fix wibox.hierarchy's empty_clip()
This function checks if a given cairo context has an empty clip. It was written with the assumption that cairo_clip_extents() produces the x, y, width, height of the clip extents. However, that function actually produces x1, y1, x2, y2, where (x1, y1) and (x2, y2) are the corners of the rectangles. Due to the way the function is written, it will return non-zero numbers when there is a translation (cr:translate()). Thus, this function worked basically never. Fix this by checking if both points have the same X- or Y-coordinate. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
2aa198a57b
commit
a4dadde335
|
@ -304,8 +304,8 @@ end
|
||||||
|
|
||||||
--- Does the given cairo context have an empty clip (aka "no drawing possible")?
|
--- Does the given cairo context have an empty clip (aka "no drawing possible")?
|
||||||
local function empty_clip(cr)
|
local function empty_clip(cr)
|
||||||
local _, _, width, height = cr:clip_extents()
|
local x1, y1, x2, y2 = cr:clip_extents()
|
||||||
return width == 0 or height == 0
|
return x2 - x1 == 0 or y2 - y1 == 0
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Draw a hierarchy to some cairo context.
|
--- Draw a hierarchy to some cairo context.
|
||||||
|
|
Loading…
Reference in New Issue