Merge fix from the stable branch:

awful.widget.button: Override :set_image() to do the right thing
(upstream git commit 03b432cdff1146f30fa398b7ca6eb4a6b8e96f20)
This commit is contained in:
dcoppa 2014-09-22 09:24:55 +00:00
parent 521dbfd099
commit 1d3dca956b
2 changed files with 45 additions and 2 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.83 2014/09/11 10:27:17 dcoppa Exp $
# $OpenBSD: Makefile,v 1.84 2014/09/22 09:24:55 dcoppa Exp $
COMMENT= highly configurable framework window manager
DISTNAME= awesome-3.5.5
REVISION= 5
REVISION= 6
EXTRACT_SUFX= .tar.xz
CATEGORIES= x11

View File

@ -0,0 +1,43 @@
$OpenBSD: patch-lib_awful_widget_button_lua_in,v 1.1 2014/09/22 09:24:55 dcoppa Exp $
commit 03b432cdff1146f30fa398b7ca6eb4a6b8e96f20
Author: Uli Schlachter <psychon@znc.in>
Date: Mon Sep 15 13:55:21 2014 +0200
awful.widget.button: Override :set_image() to do the right thing
Reported-at: http://article.gmane.org/gmane.comp.window-managers.awesome/10778
Signed-off-by: Uli Schlachter <psychon@znc.in>
--- lib/awful/widget/button.lua.in.orig Fri Apr 11 11:07:10 2014
+++ lib/awful/widget/button.lua.in Mon Sep 22 11:18:04 2014
@@ -24,15 +24,22 @@ function button.new(args)
if not args or not args.image then
return widget.empty_widget()
end
- local img_release = surface.load(args.image)
- local img_press = cairo.ImageSurface(cairo.Format.ARGB32, img_release.width, img_release.height)
- local cr = cairo.Context(img_press)
- cr:set_source_surface(img_release, 2, 2)
- cr:paint()
local w = imagebox()
- w:set_image(img_release)
- w:buttons(abutton({}, 1, function () w:set_image(img_press) end, function () w:set_image(img_release) end))
+ local orig_set_image = w.set_image
+ local img_release
+ local img_press
+
+ w.set_image = function(w, 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(w, img_release)
+ end
+ w:set_image(args.image)
+ w:buttons(abutton({}, 1, function () orig_set_image(w, img_press) end, function () orig_set_image(w, img_release) end))
return w
end