]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: Only reparent static methods within the same GIR
authorLuca Bruno <lucabru@src.gnome.org>
Thu, 5 Jan 2012 18:27:04 +0000 (19:27 +0100)
committerLuca Bruno <lucabru@src.gnome.org>
Thu, 5 Jan 2012 18:27:14 +0000 (19:27 +0100)
vala/valagirparser.vala
vapi/gdk-3.0.vapi

index eecb9d47c7ec4675555696cf8b023b339229cebd..c6ced4b86e5bc226dfe3a2229ecad77d78eade19 100644 (file)
@@ -3214,6 +3214,12 @@ public class Vala.GirParser : CodeVisitor {
                }
        }
 
+       bool same_gir (Symbol gir_component, Symbol sym) {
+               var gir_name = gir_component.source_reference.file.gir_namespace;
+               var gir_version = gir_component.source_reference.file.gir_version;
+               return "%s-%s".printf (gir_name, gir_version) in sym.source_reference.file.filename;
+       }
+
        void process_namespace_method (Node ns, Node node) {
                /* transform static methods into instance methods if possible.
                   In most of cases this is a .gir fault we are going to fix */
@@ -3230,7 +3236,7 @@ public class Vala.GirParser : CodeVisitor {
                        // check if it's a missed instance method (often happens for structs)
                        var sym = ((UnresolvedType) first_param.variable_type).unresolved_symbol;
                        var parent = resolve_node (ns, sym);
-                       if (parent != null && parent.parent == ns && is_container (parent.symbol) && cname.has_prefix (parent.get_lower_case_cprefix ())) {
+                       if (parent != null && same_gir (method, parent.symbol) && parent.parent == ns && is_container (parent.symbol) && cname.has_prefix (parent.get_lower_case_cprefix ())) {
                                // instance method
                                var new_name = method.name.substring (parent.get_lower_case_cprefix().length - ns_cprefix.length);
                                if (parent.lookup (new_name) == null) {
@@ -3249,7 +3255,7 @@ public class Vala.GirParser : CodeVisitor {
                Node parent = ns;
                find_parent (cname, ns, ref parent, ref match);
                var new_name = method.name.substring (parent.get_lower_case_cprefix().length - ns_cprefix.length);
-               if (parent.lookup (new_name) == null) {
+               if (same_gir (method, parent.symbol) && parent.lookup (new_name) == null) {
                        ns.remove_member (node);
                        node.name = new_name;
                        method.name = new_name;
index ed14c82dbfbcbdac2695cbc20e4663ef758df378..baffe138bedac69c9bd647d93d9252f524c82c6d 100644 (file)
@@ -5864,6 +5864,10 @@ namespace Gdk {
        [CCode (cheader_filename = "gdk/gdk.h")]
        public static void parse_args ([CCode (array_length_cname = "argc", array_length_pos = 0.5)] ref unowned string[] argv);
        [CCode (cheader_filename = "gdk/gdk.h")]
+       public static Gdk.Pixbuf pixbuf_get_from_surface (Cairo.Surface surface, int src_x, int src_y, int width, int height);
+       [CCode (cheader_filename = "gdk/gdk.h")]
+       public static Gdk.Pixbuf pixbuf_get_from_window (Gdk.Window window, int src_x, int src_y, int width, int height);
+       [CCode (cheader_filename = "gdk/gdk.h")]
        [Deprecated (since = "3.0")]
        public static Gdk.GrabStatus pointer_grab (Gdk.Window window, bool owner_events, Gdk.EventMask event_mask, Gdk.Window? confine_to, Gdk.Cursor? cursor, uint32 time_);
        [CCode (cheader_filename = "gdk/gdk.h")]