node-gtk 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
Binary file
|
package/lib/register-class.js
CHANGED
|
@@ -72,17 +72,14 @@ function setupVirtualFunctions(klass, klassGtype, parentGtype) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
function findVFunc(gtype, parentInfo, name) {
|
|
75
|
-
let
|
|
75
|
+
let vfuncInfo = findVFuncOnParents(parentInfo, name)
|
|
76
76
|
if (!vfuncInfo) {
|
|
77
77
|
vfuncInfo = findVFuncOnInterfaces(gtype, name)
|
|
78
|
-
// definedByParent = false
|
|
79
78
|
}
|
|
80
79
|
return vfuncInfo
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
function findVFuncOnParents(info, name) {
|
|
84
|
-
let definedByParent = false;
|
|
85
|
-
|
|
86
83
|
let parent = info
|
|
87
84
|
|
|
88
85
|
/* Since it isn't possible to override a vfunc on
|
|
@@ -91,15 +88,32 @@ function findVFuncOnParents(info, name) {
|
|
|
91
88
|
let [vfunc, _] =
|
|
92
89
|
GI.object_info_find_vfunc_using_interfaces(parent, name, null)
|
|
93
90
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
if (vfunc) {
|
|
92
|
+
return vfunc
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
while (parent) {
|
|
96
|
+
vfunc = GI.object_info_find_vfunc(info, name)
|
|
97
|
+
|
|
98
|
+
if (vfunc) {
|
|
99
|
+
return vfunc
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* HACK: object_info_find_vfunc sometimes fail, so we also search for
|
|
103
|
+
* the matching entry manually. */
|
|
104
|
+
const n = GI.object_info_get_n_vfuncs(parent)
|
|
105
|
+
for (let i = 0; i < n; i++) {
|
|
106
|
+
const vfunc = GI.object_info_get_vfunc(parent, i)
|
|
107
|
+
const currentName = GI.BaseInfo_get_name.call(vfunc)
|
|
108
|
+
if (currentName === name) {
|
|
109
|
+
return vfunc
|
|
110
|
+
}
|
|
111
|
+
}
|
|
97
112
|
|
|
98
113
|
parent = GI.object_info_get_parent(parent)
|
|
99
|
-
|
|
100
|
-
} while (!vfunc && parent)
|
|
114
|
+
}
|
|
101
115
|
|
|
102
|
-
return
|
|
116
|
+
return null
|
|
103
117
|
}
|
|
104
118
|
|
|
105
119
|
function findVFuncOnInterfaces(gtype, name) {
|
|
@@ -163,18 +177,3 @@ function createGTypeName(klass) {
|
|
|
163
177
|
function sanitizeGType(s) {
|
|
164
178
|
return s.replace(/[^a-z0-9+_-]/gi, '_');
|
|
165
179
|
}
|
|
166
|
-
|
|
167
|
-
function getParents(klass) {
|
|
168
|
-
const parents = []
|
|
169
|
-
|
|
170
|
-
let current = klass
|
|
171
|
-
do {
|
|
172
|
-
let proto = Object.getPrototypeOf(current.prototype)
|
|
173
|
-
current = proto ? proto.constructor : null
|
|
174
|
-
if (!current)
|
|
175
|
-
break
|
|
176
|
-
parents.push(current)
|
|
177
|
-
} while (current)
|
|
178
|
-
|
|
179
|
-
return parents
|
|
180
|
-
}
|