Fix compatibility with Gtk+ 2.x

from upstream
This commit is contained in:
jasper 2013-05-05 18:50:21 +00:00
parent 6017dac3c5
commit d2602e91b8
2 changed files with 40 additions and 1 deletions

View File

@ -1,10 +1,11 @@
# $OpenBSD: Makefile,v 1.16 2013/04/12 07:21:59 jasper Exp $
# $OpenBSD: Makefile,v 1.17 2013/05/05 18:50:21 jasper Exp $
SHARED_ONLY= Yes
COMMENT= lua bindings to libraries using GObject-Introspection
DISTNAME= lgi-0.7.1
REVISION= 0
PKGNAME= lua-${DISTNAME}
CATEGORIES= devel

View File

@ -0,0 +1,38 @@
$OpenBSD: patch-lgi_override_Gdk_lua,v 1.1 2013/05/05 18:50:21 jasper Exp $
From 8000f6d1362fc38ebe349119554d291f6226e04e Mon Sep 17 00:00:00 2001
From: <andy@hammerhartes.de>
Date: Thu, 25 Apr 2013 22:49:20 +0200
Subject: [PATCH] Fix compatibility with Gtk+ 2.x: Gdk.RGBA is only available in Gtk+ 3.
--- lgi/override/Gdk.lua.orig Mon Mar 4 22:10:19 2013
+++ lgi/override/Gdk.lua Sun May 5 20:49:26 2013
@@ -54,16 +54,18 @@ for name, val in pairs {
} do Gdk._constant[name] = Gdk.Atom(val) end
-- Easier-to-use Gdk.RGBA.parse() override.
-local parse = Gdk.RGBA.parse
-function Gdk.RGBA._method.parse(arg1, arg2)
- if Gdk.RGBA:is_type_of(arg1) then
- -- Standard member method.
- return parse(arg1, arg2)
- else
- -- Static constructor variant.
- local rgba = Gdk.RGBA()
- return parse(rgba, arg1) and rgba or nil
- end
+if Gdk.RGBA then
+ local parse = Gdk.RGBA.parse
+ function Gdk.RGBA._method.parse(arg1, arg2)
+ if Gdk.RGBA:is_type_of(arg1) then
+ -- Standard member method.
+ return parse(arg1, arg2)
+ else
+ -- Static constructor variant.
+ local rgba = Gdk.RGBA()
+ return parse(rgba, arg1) and rgba or nil
+ end
+ end
end
-- Gdk.Window.destroy() actually consumes 'self'. Prepare workaround