-
Notifications
You must be signed in to change notification settings - Fork 599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
awful.widget.launcher
has weird error when SVG string passed into image
#3835
Comments
it seems to be not updated to suort new rsvg handle, it should be smth like this, but i don't have time to finish it as a comlete and tested patch: diff --git a/lib/awful/widget/button.lua b/lib/awful/widget/button.lua
index c71dc8831..733885b29 100644
--- a/lib/awful/widget/button.lua
+++ b/lib/awful/widget/button.lua
@@ -39,12 +39,23 @@ function button.new(args)
local img_press
function w:set_image(image)
- img_release = surface.load(image)
- img_press = img_release:create_similar(cairo.Content.COLOR_ALPHA, img_release.width, img_release.height)
- local cr = cairo.Context(img_press)
- cr:set_source_surface(img_release, 2, 2)
- cr:paint()
- orig_set_image(self, img_release)
+ orig_set_image(self, image)
+ img_release = w._private.image
+ if not img_release then
+ local handle = w._private.handle
+ if handle then
+ local surf = cairo.ImageSurface(-2, -2, w._private.default.width, w._private.default.height)
+ local cr = cairo.Context(surf)
+ handle:render_cairo(cr)
+ img_release = surf
+ end
+ end
+ if img_release then
+ img_press = img_release:create_similar(cairo.Content.COLOR_ALPHA, img_release.width, img_release.height)
+ end
end
w:set_image(args.image) |
Hello @NobbZ, Thank you for the report. The bug comes from this method override in awesome/lib/awful/widget/button.lua Lines 41 to 48 in 0e5fc45
The implementation needs to be revisited. |
Oops! You're too fast @actionless I'll mark the issue as "Good first issue" so new contributors can pick up your patch and finish the work 😄 |
i also was thinking that strategically it might be better to extract logic from imagebox:set_image() somewhere into gears.surface, to not write |
Output of
awesome --version
:Build from:
How to reproduce the issue:
In the default config, replace the
mylauncher
definition with the following:Actual result:
I got an error like this:
Expected result:
Two variants:
Preferably 2, as that would reflect what is currently documented: https://awesomewm.org/apidoc/widgets/awful.widget.launcher.html#image
The text was updated successfully, but these errors were encountered: