textbox: Actually tell pango which space we have (FS#933)
commitd8f0bd13bf4299a0efdce2f49d8cf7150cc187a9
authorUli Schlachter <psychon@znc.in>
Wed, 19 Oct 2011 17:05:25 +0000 (19 19:05 +0200)
committerUli Schlachter <psychon@znc.in>
Wed, 19 Oct 2011 17:05:25 +0000 (19 19:05 +0200)
tree0d019dca22a37a19c062d855310c9915033432df
parent0b689058f3a9399eab44dd2b6fcc5a1d019d7323
textbox: Actually tell pango which space we have (FS#933)

In the textbox' draw() callback we forgot to set the pango layout's width and
height. Whoops.

This was tested with the following code which makes it visible when the textbox
draws outside of its assigned space:

local w = wibox({ screen = 1 })
w.y = 10
w.x = 10
w.width = 150
w.height = 150
w.visible = true

local wi = wibox.widget.base.make_widget()
local t = wibox.widget.textbox()
t:set_markup("Foo <b>bar</b> <i>Foobar</i> und so weiter")

wi.draw = function(d, wibox, cr, width, height)
cr:move_to(24.5, 0)
cr:line_to(24.5, 150)
cr:move_to(0, 24.5)
cr:line_to(150, 24.5)
cr:move_to(124.5, 0)
cr:line_to(124.5, 150)
cr:move_to(0, 124.5)
cr:line_to(150, 124.5)
cr:set_line_width(1)
cr:stroke()

cr:translate(25, 25)
t.draw(t, wibox, cr, 100, 100)
end
w:set_widget(wi)

Signed-off-by: Uli Schlachter <psychon@znc.in>
lib/wibox/widget/textbox.lua.in