@gtkx/gir 0.1.47 → 0.1.48
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.
- package/package.json +1 -1
- package/src/types.ts +23 -3
package/package.json
CHANGED
package/src/types.ts
CHANGED
|
@@ -326,8 +326,8 @@ export interface FfiTypeDescriptor {
|
|
|
326
326
|
itemType?: FfiTypeDescriptor;
|
|
327
327
|
/** List type for arrays (glist, gslist) - indicates native GList/GSList iteration. */
|
|
328
328
|
listType?: "glist" | "gslist";
|
|
329
|
-
/** Trampoline type for callbacks (asyncReady, destroy, sourceFunc, drawFunc). Default is "closure". */
|
|
330
|
-
trampoline?: "asyncReady" | "destroy" | "sourceFunc" | "drawFunc";
|
|
329
|
+
/** Trampoline type for callbacks (asyncReady, destroy, sourceFunc, drawFunc, compareDataFunc). Default is "closure". */
|
|
330
|
+
trampoline?: "asyncReady" | "destroy" | "sourceFunc" | "drawFunc" | "compareDataFunc";
|
|
331
331
|
/** Source type for asyncReady callback (the GObject source). */
|
|
332
332
|
sourceType?: FfiTypeDescriptor;
|
|
333
333
|
/** Result type for asyncReady callback (the GAsyncResult). */
|
|
@@ -1048,6 +1048,20 @@ export class TypeMapper {
|
|
|
1048
1048
|
};
|
|
1049
1049
|
}
|
|
1050
1050
|
|
|
1051
|
+
if (param.type.name === "GLib.CompareDataFunc" || param.type.name === "CompareDataFunc") {
|
|
1052
|
+
return {
|
|
1053
|
+
ts: "(a: unknown, b: unknown) => number",
|
|
1054
|
+
ffi: {
|
|
1055
|
+
type: "callback",
|
|
1056
|
+
trampoline: "compareDataFunc",
|
|
1057
|
+
argTypes: [
|
|
1058
|
+
{ type: "gobject", borrowed: true },
|
|
1059
|
+
{ type: "gobject", borrowed: true },
|
|
1060
|
+
],
|
|
1061
|
+
},
|
|
1062
|
+
};
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1051
1065
|
if (param.type.name === "GLib.Closure" || this.isCallback(param.type.name)) {
|
|
1052
1066
|
return {
|
|
1053
1067
|
ts: "(...args: unknown[]) => unknown",
|
|
@@ -1089,7 +1103,13 @@ export class TypeMapper {
|
|
|
1089
1103
|
* @returns True if this parameter is user_data or destroy for a trampoline callback
|
|
1090
1104
|
*/
|
|
1091
1105
|
isClosureTarget(paramIndex: number, allParams: GirParameter[]): boolean {
|
|
1092
|
-
const trampolineCallbacks = [
|
|
1106
|
+
const trampolineCallbacks = [
|
|
1107
|
+
"Gio.AsyncReadyCallback",
|
|
1108
|
+
"Gtk.DrawingAreaDrawFunc",
|
|
1109
|
+
"DrawingAreaDrawFunc",
|
|
1110
|
+
"GLib.CompareDataFunc",
|
|
1111
|
+
"CompareDataFunc",
|
|
1112
|
+
];
|
|
1093
1113
|
return allParams.some(
|
|
1094
1114
|
(p) => trampolineCallbacks.includes(p.type.name) && (p.closure === paramIndex || p.destroy === paramIndex),
|
|
1095
1115
|
);
|