From f2e554de91d0c275292e418de59784141a9780e1 Mon Sep 17 00:00:00 2001 From: actionless Date: Mon, 21 Sep 2015 23:59:35 +0200 Subject: [PATCH] fix(lib: naughty: core): make it work with textbox per-screen dpi Closes https://github.com/awesomeWM/awesome/pull/464. --- lib/naughty/core.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/naughty/core.lua b/lib/naughty/core.lua index 14d1a6b1b..2b99e5e8b 100644 --- a/lib/naughty/core.lua +++ b/lib/naughty/core.lua @@ -454,6 +454,8 @@ 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) @@ -526,7 +528,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(nil, -1, -1) -- Hack! :( + local w, h = actiontextbox:fit(textbox_context, -1, -1) -- Hack! :( local height = h + 2 * margin local width = w + 2 * margin @@ -596,7 +598,7 @@ function naughty.notify(args) -- calculate the height if not height then - local w, h = textbox:fit(nil, -1, -1) -- Hack! :-( + local w, h = textbox:fit(textbox_context, -1, -1) -- Hack! :-( if iconbox and icon_h + 2 * margin > h + 2 * margin then height = icon_h + 2 * margin else @@ -608,7 +610,7 @@ function naughty.notify(args) -- calculate the width if not width then - local w, h = textbox:fit(nil, -1, -1) -- Hack! :-( + local w, h = textbox:fit(textbox_context, -1, -1) -- Hack! :-( width = w + (iconbox and icon_w + 2 * margin or 0) + 2 * margin end