summaryrefslogtreecommitdiff
path: root/devel/lua-lgi/files/patch-lgi-override-Gdk.lua
blob: 934111f5a098d58afa5260fe12e39031db88f101 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--- lgi/override/Gdk.lua.orig	2013-06-25 14:33:15.000000000 +0300
+++ lgi/override/Gdk.lua	2013-06-25 14:34:28.000000000 +0300
@@ -54,16 +54,18 @@
 } 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