From 314e307cd6c7fbd630baaaddb87337df0beac344 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sat, 18 Nov 2017 22:42:48 -0500 Subject: [PATCH] textbox: Ensure that the DPI arguments are not nil Otherwise it fails. This allows better error message to be sent to the user. --- lib/wibox/widget/textbox.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/wibox/widget/textbox.lua b/lib/wibox/widget/textbox.lua index 432c158a..5630eb23 100644 --- a/lib/wibox/widget/textbox.lua +++ b/lib/wibox/widget/textbox.lua @@ -23,6 +23,7 @@ local textbox = { mt = {} } --- Set the DPI of a Pango layout local function setup_dpi(box, dpi) + assert(dpi, "No DPI provided") if box._private.dpi ~= dpi then box._private.dpi = dpi box._private.ctx:set_resolution(dpi) @@ -80,6 +81,7 @@ function textbox:get_preferred_size(s) gdebug.deprecate("textbox:get_preferred_size() requires a screen argument", {deprecated_in=5, raw=true}) dpi = beautiful.xresources.get_dpi() end + return self:get_preferred_size_at_dpi(dpi) end