diff --git a/lib/awful/tooltip.lua b/lib/awful/tooltip.lua index 653a1823c..ca51e8012 100644 --- a/lib/awful/tooltip.lua +++ b/lib/awful/tooltip.lua @@ -71,9 +71,8 @@ end -- @tparam tooltip self A tooltip object. local function set_geometry(self) local my_geo = self.wibox:geometry() - local textbox_context = {dpi=beautiful.xresources.get_dpi(mouse.screen)} -- calculate width / height - local n_w, n_h = self.textbox:fit(textbox_context, -1, -1) -- Hack! :( + local n_w, n_h = self.textbox:get_preferred_size(mouse.screen) n_w = n_w + self.marginbox.left + self.marginbox.right n_h = n_h + self.marginbox.top + self.marginbox.bottom if my_geo.width ~= n_w or my_geo.height ~= n_h then diff --git a/lib/naughty/core.lua b/lib/naughty/core.lua index 546d9fc9c..9033957b2 100644 --- a/lib/naughty/core.lua +++ b/lib/naughty/core.lua @@ -458,8 +458,6 @@ function naughty.notify(args) local border_color = args.border_color or preset.border_color or beautiful.bg_focus or '#535d6c' local notification = { screen = screen, destroy_cb = destroy_cb, timeout = timeout } - local textbox_context = {dpi=bt.xresources.get_dpi(s)} - -- replace notification if needed if args.replaces_id then local obj = naughty.getById(args.replaces_id) @@ -532,7 +530,7 @@ function naughty.notify(args) actiontextbox:set_font(font) actiontextbox:set_markup(string.format('%s', action)) -- calculate the height and width - local w, h = actiontextbox:fit(textbox_context, -1, -1) -- Hack! :( + local w, h = actiontextbox:get_preferred_size(s) local height = h + 2 * margin local width = w + 2 * margin @@ -602,7 +600,7 @@ function naughty.notify(args) -- calculate the height if not height then - local w, h = textbox:fit(textbox_context, -1, -1) -- Hack! :-( + local w, h = textbox:get_preferred_size(s) if iconbox and icon_h + 2 * margin > h + 2 * margin then height = icon_h + 2 * margin else @@ -614,7 +612,7 @@ function naughty.notify(args) -- calculate the width if not width then - local w, h = textbox:fit(textbox_context, -1, -1) -- Hack! :-( + local w, h = textbox:get_preferred_size(s) width = w + (iconbox and icon_w + 2 * margin or 0) + 2 * margin end