From b7eb233aee3010a8f90db4c5b23e4192b559f708 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 27 Nov 2012 17:24:54 +0100 Subject: [PATCH] imagebox: Use a different entry for saving the image In 3.4, an imagebox' image is set via "box.image = foo". Since widgets are just ordinary tables in 3.5, this will actually mess with the imagebox' image without setting it correctly. Fix this by renaming the entry to "_image". A similar patch was applied to the textbox widget ages ago. Signed-off-by: Uli Schlachter --- lib/wibox/widget/imagebox.lua.in | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/wibox/widget/imagebox.lua.in b/lib/wibox/widget/imagebox.lua.in index b59192b0..7aa8b09d 100644 --- a/lib/wibox/widget/imagebox.lua.in +++ b/lib/wibox/widget/imagebox.lua.in @@ -17,21 +17,21 @@ local imagebox = { mt = {} } --- Draw an imagebox with the given cairo context in the given geometry. function imagebox:draw(wibox, cr, width, height) - if not self.image then return end + if not self._image then return end cr:save() if not self.resize_forbidden then -- Let's scale the image so that it fits into (width, height) - local w = self.image:get_width() - local h = self.image:get_height() + local w = self._image:get_width() + local h = self._image:get_height() local aspect = width / w local aspect_h = height / h if aspect > aspect_h then aspect = aspect_h end cr:scale(aspect, aspect) end - cr:set_source_surface(self.image, 0, 0) + cr:set_source_surface(self._image, 0, 0) cr:paint() cr:restore() @@ -39,12 +39,12 @@ end --- Fit the imagebox into the given geometry function imagebox:fit(width, height) - if not self.image then + if not self._image then return 0, 0 end - local w = self.image:get_width() - local h = self.image:get_height() + local w = self._image:get_width() + local h = self._image:get_height() if w > width then h = h * width / w @@ -93,7 +93,7 @@ function imagebox:set_image(image) end end - self.image = image + self._image = image self:emit_signal("widget::updated") return true