naugthy: Force reload the surface when the icon changes.

Fixes #2851
This commit is contained in:
Emmanuel Lepage Vallee 2023-12-29 18:08:06 -08:00
parent 271e6c3cc9
commit 4533bb00bd
1 changed files with 12 additions and 8 deletions

View File

@ -162,28 +162,32 @@ end
local function new(args)
args = args or {}
local tb = imagebox()
local ib = imagebox()
gtable.crush(tb, icon, true)
tb._private.notification = {}
gtable.crush(ib, icon, true)
ib._private.notification = {}
function tb._private.icon_changed_callback()
local n = tb._private.notification[1]
function ib._private.icon_changed_callback()
local n = ib._private.notification[1]
if not n then return end
local icn = gsurface.load_silently(n.icon)
if icn then
tb:set_image(icn)
ib:set_image(icn)
-- Some clients will write the image to the same path over and
-- over, but the content will change.
ib:refresh()
end
end
if args.notification then
tb:set_notification(args.notification)
ib:set_notification(args.notification)
end
return tb
return ib
end
--@DOC_object_COMMON@