@gtkx/ffi 0.1.3 → 0.1.4
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/dist/codegen/ffi-generator.d.ts +2 -0
- package/dist/codegen/ffi-generator.js +76 -2
- package/dist/generated/gdk/display-manager.d.ts +1 -0
- package/dist/generated/gdk/display-manager.js +9 -0
- package/dist/generated/gdk/display.d.ts +2 -0
- package/dist/generated/gdk/display.js +20 -0
- package/dist/generated/gdk/drag.d.ts +1 -0
- package/dist/generated/gdk/drag.js +31 -0
- package/dist/generated/gdk/glcontext.d.ts +2 -0
- package/dist/generated/gdk/glcontext.js +14 -0
- package/dist/generated/gdk/scroll-event.d.ts +2 -1
- package/dist/generated/gdk/scroll-event.js +8 -0
- package/dist/generated/gdkpixbuf/pixbuf-animation.d.ts +1 -0
- package/dist/generated/gdkpixbuf/pixbuf-animation.js +20 -0
- package/dist/generated/gdkpixbuf/pixbuf.d.ts +9 -0
- package/dist/generated/gdkpixbuf/pixbuf.js +195 -0
- package/dist/generated/gio/app-info-monitor.d.ts +1 -0
- package/dist/generated/gio/app-info-monitor.js +9 -0
- package/dist/generated/gio/application.d.ts +2 -0
- package/dist/generated/gio/application.js +17 -0
- package/dist/generated/gio/cancellable.d.ts +1 -0
- package/dist/generated/gio/cancellable.js +9 -0
- package/dist/generated/gio/dbus-action-group.d.ts +1 -0
- package/dist/generated/gio/dbus-action-group.js +20 -0
- package/dist/generated/gio/dbus-connection.d.ts +2 -0
- package/dist/generated/gio/dbus-connection.js +60 -0
- package/dist/generated/gio/dbus-menu-model.d.ts +1 -0
- package/dist/generated/gio/dbus-menu-model.js +20 -0
- package/dist/generated/gio/dbus-message.d.ts +1 -0
- package/dist/generated/gio/dbus-message.js +26 -0
- package/dist/generated/gio/dbus-object-manager-client.d.ts +2 -0
- package/dist/generated/gio/dbus-object-manager-client.js +88 -0
- package/dist/generated/gio/dbus-proxy.d.ts +2 -0
- package/dist/generated/gio/dbus-proxy.js +80 -0
- package/dist/generated/gio/iomodule.d.ts +1 -0
- package/dist/generated/gio/iomodule.js +6 -0
- package/dist/generated/gio/iostream.d.ts +1 -0
- package/dist/generated/gio/iostream.js +19 -0
- package/dist/generated/gio/network-address.d.ts +2 -0
- package/dist/generated/gio/network-address.js +50 -0
- package/dist/generated/gio/resolver.d.ts +3 -0
- package/dist/generated/gio/resolver.js +25 -0
- package/dist/generated/gio/settings-backend.d.ts +3 -0
- package/dist/generated/gio/settings-backend.js +35 -0
- package/dist/generated/gio/settings.d.ts +4 -0
- package/dist/generated/gio/settings.js +27 -0
- package/dist/generated/gio/simple-async-result.d.ts +1 -0
- package/dist/generated/gio/simple-async-result.js +16 -0
- package/dist/generated/gio/simple-proxy-resolver.d.ts +1 -0
- package/dist/generated/gio/simple-proxy-resolver.js +12 -0
- package/dist/generated/gio/socket-connection.d.ts +3 -0
- package/dist/generated/gio/socket-connection.js +36 -0
- package/dist/generated/gio/socket-control-message.d.ts +1 -0
- package/dist/generated/gio/socket-control-message.js +26 -0
- package/dist/generated/gio/task.d.ts +3 -0
- package/dist/generated/gio/task.js +68 -0
- package/dist/generated/gio/test-dbus.d.ts +1 -0
- package/dist/generated/gio/test-dbus.js +3 -0
- package/dist/generated/gio/tls-certificate.d.ts +1 -0
- package/dist/generated/gio/tls-certificate.js +19 -0
- package/dist/generated/gio/unix-credentials-message.d.ts +1 -0
- package/dist/generated/gio/unix-credentials-message.js +3 -0
- package/dist/generated/gio/unix-socket-address.d.ts +1 -0
- package/dist/generated/gio/unix-socket-address.js +3 -0
- package/dist/generated/gio/vfs.d.ts +2 -0
- package/dist/generated/gio/vfs.js +18 -0
- package/dist/generated/gio/volume-monitor.d.ts +2 -0
- package/dist/generated/gio/volume-monitor.js +17 -0
- package/dist/generated/gobject/object.d.ts +4 -0
- package/dist/generated/gobject/object.js +51 -0
- package/dist/generated/gobject/param-spec.d.ts +3 -0
- package/dist/generated/gobject/param-spec.js +35 -0
- package/dist/generated/gsk/render-node.d.ts +1 -0
- package/dist/generated/gsk/render-node.js +19 -0
- package/dist/generated/gsk/subsurface-node.d.ts +1 -0
- package/dist/generated/gsk/subsurface-node.js +8 -0
- package/dist/generated/gtk/activate-action.d.ts +1 -0
- package/dist/generated/gtk/activate-action.js +10 -0
- package/dist/generated/gtk/drag-icon.d.ts +2 -0
- package/dist/generated/gtk/drag-icon.js +28 -0
- package/dist/generated/gtk/icon-theme.d.ts +1 -0
- package/dist/generated/gtk/icon-theme.js +11 -0
- package/dist/generated/gtk/mnemonic-action.d.ts +1 -0
- package/dist/generated/gtk/mnemonic-action.js +10 -0
- package/dist/generated/gtk/never-trigger.d.ts +1 -0
- package/dist/generated/gtk/never-trigger.js +10 -0
- package/dist/generated/gtk/nothing-action.d.ts +1 -0
- package/dist/generated/gtk/nothing-action.js +10 -0
- package/dist/generated/gtk/recent-manager.d.ts +1 -0
- package/dist/generated/gtk/recent-manager.js +9 -0
- package/dist/generated/gtk/settings.d.ts +2 -0
- package/dist/generated/gtk/settings.js +20 -0
- package/dist/generated/gtk/style-context.d.ts +2 -0
- package/dist/generated/gtk/style-context.js +28 -0
- package/dist/generated/gtk/widget.d.ts +2 -0
- package/dist/generated/gtk/widget.js +15 -0
- package/dist/generated/gtk/window.d.ts +6 -0
- package/dist/generated/gtk/window.js +41 -0
- package/dist/generated/pango/coverage.d.ts +1 -0
- package/dist/generated/pango/coverage.js +18 -0
- package/dist/generated/pango/font.d.ts +2 -0
- package/dist/generated/pango/font.js +37 -0
- package/dist/generated/pango/layout.d.ts +2 -1
- package/dist/generated/pango/layout.js +29 -0
- package/dist/native.d.ts +3 -0
- package/dist/native.js +13 -0
- package/package.json +3 -3
|
@@ -24,6 +24,8 @@ export declare class CodeGenerator {
|
|
|
24
24
|
private generateConstructor;
|
|
25
25
|
private generateCreatePtr;
|
|
26
26
|
private generateStaticFactoryMethod;
|
|
27
|
+
private generateStaticFunctions;
|
|
28
|
+
private generateStaticFunction;
|
|
27
29
|
private generateMethods;
|
|
28
30
|
private generateMethod;
|
|
29
31
|
private generateProperties;
|
|
@@ -222,8 +222,9 @@ export class CodeGenerator {
|
|
|
222
222
|
this.resetState();
|
|
223
223
|
this.usesRef =
|
|
224
224
|
cls.methods.some((m) => hasOutParameter(m.parameters)) ||
|
|
225
|
-
cls.constructors.some((c) => hasOutParameter(c.parameters))
|
|
226
|
-
|
|
225
|
+
cls.constructors.some((c) => hasOutParameter(c.parameters)) ||
|
|
226
|
+
cls.functions.some((f) => hasOutParameter(f.parameters));
|
|
227
|
+
this.usesCall = cls.methods.length > 0 || cls.constructors.length > 0 || cls.functions.length > 0 || cls.signals.length > 0;
|
|
227
228
|
const className = normalizeClassName(cls.name);
|
|
228
229
|
const hasParent = !!(cls.parent && classMap.has(cls.parent));
|
|
229
230
|
const parentClassName = cls.parent ? normalizeClassName(cls.parent) : "";
|
|
@@ -242,6 +243,7 @@ export class CodeGenerator {
|
|
|
242
243
|
}
|
|
243
244
|
sections.push(this.generateConstructors(cls, sharedLibrary, hasParent));
|
|
244
245
|
sections.push(this.generateCreatePtr(cls, sharedLibrary, hasParent));
|
|
246
|
+
sections.push(this.generateStaticFunctions(cls.functions, sharedLibrary, className));
|
|
245
247
|
sections.push(this.generateMethods(cls.methods, sharedLibrary, cls.name));
|
|
246
248
|
sections.push(this.generateProperties(cls.properties, cls.methods));
|
|
247
249
|
if (cls.signals.length > 0) {
|
|
@@ -362,6 +364,78 @@ ${args}
|
|
|
362
364
|
}
|
|
363
365
|
`;
|
|
364
366
|
}
|
|
367
|
+
generateStaticFunctions(functions, sharedLibrary, className) {
|
|
368
|
+
const sections = [];
|
|
369
|
+
for (const func of functions) {
|
|
370
|
+
sections.push(this.generateStaticFunction(func, sharedLibrary, className));
|
|
371
|
+
}
|
|
372
|
+
return sections.join("\n");
|
|
373
|
+
}
|
|
374
|
+
generateStaticFunction(func, sharedLibrary, className) {
|
|
375
|
+
const funcName = toValidIdentifier(toCamelCase(func.name));
|
|
376
|
+
const params = this.generateParameterList(func.parameters);
|
|
377
|
+
const returnTypeMapping = this.typeMapper.mapType(func.returnType, true);
|
|
378
|
+
const returnsOwnClass = func.returnType.name === className || func.returnType.name?.endsWith(`.${className}`);
|
|
379
|
+
const rawReturnType = returnsOwnClass ? className : returnTypeMapping.ts;
|
|
380
|
+
const tsReturnType = rawReturnType === "void" ? "" : `: ${rawReturnType}`;
|
|
381
|
+
const hasResultParam = func.parameters.some((p) => toValidIdentifier(toCamelCase(p.name)) === "result");
|
|
382
|
+
const resultVarName = hasResultParam ? "_result" : "result";
|
|
383
|
+
const needsCast = rawReturnType !== "void" && rawReturnType !== "unknown";
|
|
384
|
+
const hasReturnValue = rawReturnType !== "void";
|
|
385
|
+
const lines = [];
|
|
386
|
+
const funcDoc = formatMethodDoc(func.doc, func.parameters);
|
|
387
|
+
if (funcDoc) {
|
|
388
|
+
lines.push(funcDoc.trimEnd());
|
|
389
|
+
}
|
|
390
|
+
lines.push(` static ${funcName}(${params})${tsReturnType} {`);
|
|
391
|
+
if (func.throws) {
|
|
392
|
+
lines.push(` const error = { value: null as unknown };`);
|
|
393
|
+
}
|
|
394
|
+
const args = this.generateCallArguments(func.parameters);
|
|
395
|
+
const errorArg = func.throws ? this.generateErrorArgument() : "";
|
|
396
|
+
const allArgs = errorArg ? args + (args ? ",\n" : "") + errorArg : args;
|
|
397
|
+
if (returnsOwnClass) {
|
|
398
|
+
lines.push(` const ptr = call(
|
|
399
|
+
"${sharedLibrary}",
|
|
400
|
+
"${func.cIdentifier}",
|
|
401
|
+
[
|
|
402
|
+
${allArgs ? `${allArgs},` : ""}
|
|
403
|
+
],
|
|
404
|
+
${this.generateTypeDescriptor(returnTypeMapping.ffi)}
|
|
405
|
+
);`);
|
|
406
|
+
if (func.throws) {
|
|
407
|
+
lines.push(this.generateErrorCheck());
|
|
408
|
+
}
|
|
409
|
+
lines.push(` const instance = Object.create(${className}.prototype) as ${className} & { ptr: unknown };
|
|
410
|
+
instance.ptr = ptr;
|
|
411
|
+
return instance;`);
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
const callPrefix = func.throws
|
|
415
|
+
? hasReturnValue
|
|
416
|
+
? `const ${resultVarName} = `
|
|
417
|
+
: ""
|
|
418
|
+
: hasReturnValue
|
|
419
|
+
? "return "
|
|
420
|
+
: "";
|
|
421
|
+
lines.push(` ${callPrefix}call(
|
|
422
|
+
"${sharedLibrary}",
|
|
423
|
+
"${func.cIdentifier}",
|
|
424
|
+
[
|
|
425
|
+
${allArgs ? `${allArgs},` : ""}
|
|
426
|
+
],
|
|
427
|
+
${this.generateTypeDescriptor(returnTypeMapping.ffi)}
|
|
428
|
+
)${needsCast ? ` as ${rawReturnType}` : ""};`);
|
|
429
|
+
if (func.throws) {
|
|
430
|
+
lines.push(this.generateErrorCheck());
|
|
431
|
+
if (hasReturnValue) {
|
|
432
|
+
lines.push(` return ${resultVarName};`);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
lines.push(` }`);
|
|
437
|
+
return `${lines.join("\n")}\n`;
|
|
438
|
+
}
|
|
365
439
|
generateMethods(methods, sharedLibrary, className) {
|
|
366
440
|
const generatedMethods = new Set();
|
|
367
441
|
const sections = [];
|
|
@@ -8,6 +8,15 @@ export class DisplayManager {
|
|
|
8
8
|
createPtr(_args) {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
|
+
static get() {
|
|
12
|
+
const ptr = call("libgtk-4.so.1", "gdk_display_manager_get", [], {
|
|
13
|
+
type: "gobject",
|
|
14
|
+
borrowed: true,
|
|
15
|
+
});
|
|
16
|
+
const instance = Object.create(DisplayManager.prototype);
|
|
17
|
+
instance.ptr = ptr;
|
|
18
|
+
return instance;
|
|
19
|
+
}
|
|
11
20
|
getDefaultDisplay() {
|
|
12
21
|
return call("libgtk-4.so.1", "gdk_display_manager_get_default_display", [
|
|
13
22
|
{
|
|
@@ -4,6 +4,8 @@ export declare class Display {
|
|
|
4
4
|
ptr: unknown;
|
|
5
5
|
constructor(_args?: unknown[]);
|
|
6
6
|
protected createPtr(_args: unknown[]): unknown;
|
|
7
|
+
static getDefault(): Display;
|
|
8
|
+
static open(displayName?: string): Display;
|
|
7
9
|
beep(): void;
|
|
8
10
|
close(): void;
|
|
9
11
|
createGlContext(): unknown;
|
|
@@ -8,6 +8,26 @@ export class Display {
|
|
|
8
8
|
createPtr(_args) {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
|
+
static getDefault() {
|
|
12
|
+
const ptr = call("libgtk-4.so.1", "gdk_display_get_default", [], {
|
|
13
|
+
type: "gobject",
|
|
14
|
+
borrowed: true,
|
|
15
|
+
});
|
|
16
|
+
const instance = Object.create(Display.prototype);
|
|
17
|
+
instance.ptr = ptr;
|
|
18
|
+
return instance;
|
|
19
|
+
}
|
|
20
|
+
static open(displayName) {
|
|
21
|
+
const ptr = call("libgtk-4.so.1", "gdk_display_open", [
|
|
22
|
+
{
|
|
23
|
+
type: { type: "string" },
|
|
24
|
+
value: displayName,
|
|
25
|
+
},
|
|
26
|
+
], { type: "gobject", borrowed: true });
|
|
27
|
+
const instance = Object.create(Display.prototype);
|
|
28
|
+
instance.ptr = ptr;
|
|
29
|
+
return instance;
|
|
30
|
+
}
|
|
11
31
|
beep() {
|
|
12
32
|
call("libgtk-4.so.1", "gdk_display_beep", [
|
|
13
33
|
{
|
|
@@ -3,6 +3,7 @@ export declare class Drag {
|
|
|
3
3
|
ptr: unknown;
|
|
4
4
|
constructor(_args?: unknown[]);
|
|
5
5
|
protected createPtr(_args: unknown[]): unknown;
|
|
6
|
+
static begin(surface: unknown, device: unknown, content: unknown, actions: DragAction, dx: number, dy: number): Drag;
|
|
6
7
|
dropDone(success: boolean): void;
|
|
7
8
|
getActions(): DragAction;
|
|
8
9
|
getContent(): unknown;
|
|
@@ -7,6 +7,37 @@ export class Drag {
|
|
|
7
7
|
createPtr(_args) {
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
|
+
static begin(surface, device, content, actions, dx, dy) {
|
|
11
|
+
const ptr = call("libgtk-4.so.1", "gdk_drag_begin", [
|
|
12
|
+
{
|
|
13
|
+
type: { type: "gobject" },
|
|
14
|
+
value: surface,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: { type: "gobject" },
|
|
18
|
+
value: device,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
type: { type: "gobject" },
|
|
22
|
+
value: content,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
type: { type: "int", size: 32, unsigned: false },
|
|
26
|
+
value: actions,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: { type: "float", size: 64 },
|
|
30
|
+
value: dx,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: { type: "float", size: 64 },
|
|
34
|
+
value: dy,
|
|
35
|
+
},
|
|
36
|
+
], { type: "gobject", borrowed: true });
|
|
37
|
+
const instance = Object.create(Drag.prototype);
|
|
38
|
+
instance.ptr = ptr;
|
|
39
|
+
return instance;
|
|
40
|
+
}
|
|
10
41
|
dropDone(success) {
|
|
11
42
|
call("libgtk-4.so.1", "gdk_drag_drop_done", [
|
|
12
43
|
{
|
|
@@ -4,6 +4,8 @@ import { DrawContext } from "./draw-context.js";
|
|
|
4
4
|
export declare class GLContext extends DrawContext {
|
|
5
5
|
constructor(_args?: unknown[]);
|
|
6
6
|
protected createPtr(_args: unknown[]): unknown;
|
|
7
|
+
static clearCurrent(): void;
|
|
8
|
+
static getCurrent(): GLContext;
|
|
7
9
|
getAllowedApis(): GLAPI;
|
|
8
10
|
getApi(): GLAPI;
|
|
9
11
|
getDebugEnabled(): boolean;
|
|
@@ -7,6 +7,20 @@ export class GLContext extends DrawContext {
|
|
|
7
7
|
createPtr(_args) {
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
|
+
static clearCurrent() {
|
|
11
|
+
call("libgtk-4.so.1", "gdk_gl_context_clear_current", [], {
|
|
12
|
+
type: "undefined",
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
static getCurrent() {
|
|
16
|
+
const ptr = call("libgtk-4.so.1", "gdk_gl_context_get_current", [], {
|
|
17
|
+
type: "gobject",
|
|
18
|
+
borrowed: true,
|
|
19
|
+
});
|
|
20
|
+
const instance = Object.create(GLContext.prototype);
|
|
21
|
+
instance.ptr = ptr;
|
|
22
|
+
return instance;
|
|
23
|
+
}
|
|
10
24
|
getAllowedApis() {
|
|
11
25
|
return call("libgtk-4.so.1", "gdk_gl_context_get_allowed_apis", [
|
|
12
26
|
{
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Ref } from "@gtkx/native";
|
|
2
|
-
import { ScrollDirection, ScrollUnit } from "./enums.js";
|
|
2
|
+
import { ScrollDirection, ScrollRelativeDirection, ScrollUnit } from "./enums.js";
|
|
3
3
|
import { Event } from "./event.js";
|
|
4
4
|
export declare class ScrollEvent extends Event {
|
|
5
5
|
constructor(_args?: unknown[]);
|
|
6
6
|
protected createPtr(_args: unknown[]): unknown;
|
|
7
|
+
static getRelativeDirection(event: unknown): ScrollRelativeDirection;
|
|
7
8
|
getDeltas(deltaX: Ref<number>, deltaY: Ref<number>): void;
|
|
8
9
|
getDirection(): ScrollDirection;
|
|
9
10
|
getUnit(): ScrollUnit;
|
|
@@ -7,6 +7,14 @@ export class ScrollEvent extends Event {
|
|
|
7
7
|
createPtr(_args) {
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
|
+
static getRelativeDirection(event) {
|
|
11
|
+
return call("libgtk-4.so.1", "gdk_scroll_event_get_relative_direction", [
|
|
12
|
+
{
|
|
13
|
+
type: { type: "gobject" },
|
|
14
|
+
value: event,
|
|
15
|
+
},
|
|
16
|
+
], { type: "int", size: 32, unsigned: false });
|
|
17
|
+
}
|
|
10
18
|
getDeltas(deltaX, deltaY) {
|
|
11
19
|
call("libgtk-4.so.1", "gdk_scroll_event_get_deltas", [
|
|
12
20
|
{
|
|
@@ -6,6 +6,7 @@ export declare class PixbufAnimation {
|
|
|
6
6
|
static animationNewFromStream(stream: unknown, cancellable?: unknown): PixbufAnimation;
|
|
7
7
|
static animationNewFromStreamFinish(asyncResult: unknown): PixbufAnimation;
|
|
8
8
|
protected createPtr(_args: unknown[]): unknown;
|
|
9
|
+
static newFromStreamAsync(stream: unknown, cancellable?: unknown, callback?: unknown, userData?: unknown): void;
|
|
9
10
|
getHeight(): number;
|
|
10
11
|
getIter(startTime?: unknown): unknown;
|
|
11
12
|
getStaticImage(): unknown;
|
|
@@ -51,6 +51,26 @@ export class PixbufAnimation {
|
|
|
51
51
|
},
|
|
52
52
|
], { type: "gobject", borrowed: true });
|
|
53
53
|
}
|
|
54
|
+
static newFromStreamAsync(stream, cancellable, callback, userData) {
|
|
55
|
+
call("libgdk_pixbuf-2.0.so.0", "gdk_pixbuf_animation_new_from_stream_async", [
|
|
56
|
+
{
|
|
57
|
+
type: { type: "gobject" },
|
|
58
|
+
value: stream,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: { type: "gobject" },
|
|
62
|
+
value: cancellable,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: { type: "gobject" },
|
|
66
|
+
value: callback,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: { type: "gobject" },
|
|
70
|
+
value: userData,
|
|
71
|
+
},
|
|
72
|
+
], { type: "undefined" });
|
|
73
|
+
}
|
|
54
74
|
getHeight() {
|
|
55
75
|
return call("libgdk_pixbuf-2.0.so.0", "gdk_pixbuf_animation_get_height", [
|
|
56
76
|
{
|
|
@@ -17,6 +17,15 @@ export declare class Pixbuf {
|
|
|
17
17
|
static newFromStreamFinish(asyncResult: unknown): Pixbuf;
|
|
18
18
|
static newFromXpmData(data: string[]): Pixbuf;
|
|
19
19
|
protected createPtr(_args: unknown[]): unknown;
|
|
20
|
+
static calculateRowstride(colorspace: Colorspace, hasAlpha: boolean, bitsPerSample: number, width: number, height: number): number;
|
|
21
|
+
static getFileInfo(filename: string, width?: Ref<number>, height?: Ref<number>): unknown;
|
|
22
|
+
static getFileInfoAsync(filename: string, cancellable?: unknown, callback?: unknown, userData?: unknown): void;
|
|
23
|
+
static getFileInfoFinish(asyncResult: unknown, width: Ref<number>, height: Ref<number>): unknown;
|
|
24
|
+
static getFormats(): unknown;
|
|
25
|
+
static initModules(path: string): boolean;
|
|
26
|
+
static newFromStreamAsync(stream: unknown, cancellable?: unknown, callback?: unknown, userData?: unknown): void;
|
|
27
|
+
static newFromStreamAtScaleAsync(stream: unknown, width: number, height: number, preserveAspectRatio: boolean, cancellable?: unknown, callback?: unknown, userData?: unknown): void;
|
|
28
|
+
static saveToStreamFinish(asyncResult: unknown): boolean;
|
|
20
29
|
addAlpha(substituteColor: boolean, r: number, g: number, b: number): unknown;
|
|
21
30
|
applyEmbeddedOrientation(): unknown;
|
|
22
31
|
composite(dest: unknown, destX: number, destY: number, destWidth: number, destHeight: number, offsetX: number, offsetY: number, scaleX: number, scaleY: number, interpType: InterpType, overallAlpha: number): void;
|
|
@@ -284,6 +284,201 @@ export class Pixbuf {
|
|
|
284
284
|
},
|
|
285
285
|
], { type: "gobject", borrowed: true });
|
|
286
286
|
}
|
|
287
|
+
static calculateRowstride(colorspace, hasAlpha, bitsPerSample, width, height) {
|
|
288
|
+
return call("libgdk_pixbuf-2.0.so.0", "gdk_pixbuf_calculate_rowstride", [
|
|
289
|
+
{
|
|
290
|
+
type: { type: "int", size: 32, unsigned: false },
|
|
291
|
+
value: colorspace,
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
type: { type: "boolean" },
|
|
295
|
+
value: hasAlpha,
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
type: { type: "int", size: 32, unsigned: false },
|
|
299
|
+
value: bitsPerSample,
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
type: { type: "int", size: 32, unsigned: false },
|
|
303
|
+
value: width,
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
type: { type: "int", size: 32, unsigned: false },
|
|
307
|
+
value: height,
|
|
308
|
+
},
|
|
309
|
+
], { type: "int", size: 32, unsigned: false });
|
|
310
|
+
}
|
|
311
|
+
static getFileInfo(filename, width, height) {
|
|
312
|
+
return call("libgdk_pixbuf-2.0.so.0", "gdk_pixbuf_get_file_info", [
|
|
313
|
+
{
|
|
314
|
+
type: { type: "string" },
|
|
315
|
+
value: filename,
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
type: {
|
|
319
|
+
type: "ref",
|
|
320
|
+
innerType: { type: "int", size: 32, unsigned: false },
|
|
321
|
+
},
|
|
322
|
+
value: width,
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
type: {
|
|
326
|
+
type: "ref",
|
|
327
|
+
innerType: { type: "int", size: 32, unsigned: false },
|
|
328
|
+
},
|
|
329
|
+
value: height,
|
|
330
|
+
},
|
|
331
|
+
], { type: "gobject", borrowed: true });
|
|
332
|
+
}
|
|
333
|
+
static getFileInfoAsync(filename, cancellable, callback, userData) {
|
|
334
|
+
call("libgdk_pixbuf-2.0.so.0", "gdk_pixbuf_get_file_info_async", [
|
|
335
|
+
{
|
|
336
|
+
type: { type: "string" },
|
|
337
|
+
value: filename,
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
type: { type: "gobject" },
|
|
341
|
+
value: cancellable,
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
type: { type: "gobject" },
|
|
345
|
+
value: callback,
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
type: { type: "gobject" },
|
|
349
|
+
value: userData,
|
|
350
|
+
},
|
|
351
|
+
], { type: "undefined" });
|
|
352
|
+
}
|
|
353
|
+
static getFileInfoFinish(asyncResult, width, height) {
|
|
354
|
+
const error = { value: null };
|
|
355
|
+
const result = call("libgdk_pixbuf-2.0.so.0", "gdk_pixbuf_get_file_info_finish", [
|
|
356
|
+
{
|
|
357
|
+
type: { type: "gobject" },
|
|
358
|
+
value: asyncResult,
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
type: {
|
|
362
|
+
type: "ref",
|
|
363
|
+
innerType: { type: "int", size: 32, unsigned: false },
|
|
364
|
+
},
|
|
365
|
+
value: width,
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
type: {
|
|
369
|
+
type: "ref",
|
|
370
|
+
innerType: { type: "int", size: 32, unsigned: false },
|
|
371
|
+
},
|
|
372
|
+
value: height,
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
type: { type: "ref", innerType: { type: "gobject" } },
|
|
376
|
+
value: error,
|
|
377
|
+
},
|
|
378
|
+
], { type: "gobject", borrowed: true });
|
|
379
|
+
if (error.value !== null) {
|
|
380
|
+
const jsError = new Error("GLib Error occurred");
|
|
381
|
+
jsError.gError = error.value;
|
|
382
|
+
throw jsError;
|
|
383
|
+
}
|
|
384
|
+
return result;
|
|
385
|
+
}
|
|
386
|
+
static getFormats() {
|
|
387
|
+
return call("libgdk_pixbuf-2.0.so.0", "gdk_pixbuf_get_formats", [], {
|
|
388
|
+
type: "gobject",
|
|
389
|
+
borrowed: true,
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
static initModules(path) {
|
|
393
|
+
const error = { value: null };
|
|
394
|
+
const result = call("libgdk_pixbuf-2.0.so.0", "gdk_pixbuf_init_modules", [
|
|
395
|
+
{
|
|
396
|
+
type: { type: "string" },
|
|
397
|
+
value: path,
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
type: { type: "ref", innerType: { type: "gobject" } },
|
|
401
|
+
value: error,
|
|
402
|
+
},
|
|
403
|
+
], { type: "boolean" });
|
|
404
|
+
if (error.value !== null) {
|
|
405
|
+
const jsError = new Error("GLib Error occurred");
|
|
406
|
+
jsError.gError = error.value;
|
|
407
|
+
throw jsError;
|
|
408
|
+
}
|
|
409
|
+
return result;
|
|
410
|
+
}
|
|
411
|
+
static newFromStreamAsync(stream, cancellable, callback, userData) {
|
|
412
|
+
call("libgdk_pixbuf-2.0.so.0", "gdk_pixbuf_new_from_stream_async", [
|
|
413
|
+
{
|
|
414
|
+
type: { type: "gobject" },
|
|
415
|
+
value: stream,
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
type: { type: "gobject" },
|
|
419
|
+
value: cancellable,
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
type: { type: "gobject" },
|
|
423
|
+
value: callback,
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
type: { type: "gobject" },
|
|
427
|
+
value: userData,
|
|
428
|
+
},
|
|
429
|
+
], { type: "undefined" });
|
|
430
|
+
}
|
|
431
|
+
static newFromStreamAtScaleAsync(stream, width, height, preserveAspectRatio, cancellable, callback, userData) {
|
|
432
|
+
call("libgdk_pixbuf-2.0.so.0", "gdk_pixbuf_new_from_stream_at_scale_async", [
|
|
433
|
+
{
|
|
434
|
+
type: { type: "gobject" },
|
|
435
|
+
value: stream,
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
type: { type: "int", size: 32, unsigned: false },
|
|
439
|
+
value: width,
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
type: { type: "int", size: 32, unsigned: false },
|
|
443
|
+
value: height,
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
type: { type: "boolean" },
|
|
447
|
+
value: preserveAspectRatio,
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
type: { type: "gobject" },
|
|
451
|
+
value: cancellable,
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
type: { type: "gobject" },
|
|
455
|
+
value: callback,
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
type: { type: "gobject" },
|
|
459
|
+
value: userData,
|
|
460
|
+
},
|
|
461
|
+
], { type: "undefined" });
|
|
462
|
+
}
|
|
463
|
+
static saveToStreamFinish(asyncResult) {
|
|
464
|
+
const error = { value: null };
|
|
465
|
+
const result = call("libgdk_pixbuf-2.0.so.0", "gdk_pixbuf_save_to_stream_finish", [
|
|
466
|
+
{
|
|
467
|
+
type: { type: "gobject" },
|
|
468
|
+
value: asyncResult,
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
type: { type: "ref", innerType: { type: "gobject" } },
|
|
472
|
+
value: error,
|
|
473
|
+
},
|
|
474
|
+
], { type: "boolean" });
|
|
475
|
+
if (error.value !== null) {
|
|
476
|
+
const jsError = new Error("GLib Error occurred");
|
|
477
|
+
jsError.gError = error.value;
|
|
478
|
+
throw jsError;
|
|
479
|
+
}
|
|
480
|
+
return result;
|
|
481
|
+
}
|
|
287
482
|
addAlpha(substituteColor, r, g, b) {
|
|
288
483
|
return call("libgdk_pixbuf-2.0.so.0", "gdk_pixbuf_add_alpha", [
|
|
289
484
|
{
|
|
@@ -7,6 +7,15 @@ export class AppInfoMonitor {
|
|
|
7
7
|
createPtr(_args) {
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
|
+
static get() {
|
|
11
|
+
const ptr = call("libgio-2.0.so.0", "g_app_info_monitor_get", [], {
|
|
12
|
+
type: "gobject",
|
|
13
|
+
borrowed: true,
|
|
14
|
+
});
|
|
15
|
+
const instance = Object.create(AppInfoMonitor.prototype);
|
|
16
|
+
instance.ptr = ptr;
|
|
17
|
+
return instance;
|
|
18
|
+
}
|
|
10
19
|
connect(signal, handler, after = false) {
|
|
11
20
|
const signalMeta = {
|
|
12
21
|
changed: [],
|
|
@@ -4,6 +4,8 @@ export declare class Application {
|
|
|
4
4
|
constructor(flags: ApplicationFlags, applicationId?: string);
|
|
5
5
|
constructor(_args: unknown[]);
|
|
6
6
|
protected createPtr(_args: unknown[]): unknown;
|
|
7
|
+
static getDefault(): Application;
|
|
8
|
+
static idIsValid(applicationId: string): boolean;
|
|
7
9
|
activate(): void;
|
|
8
10
|
addMainOption(longName: string, shortName: number, flags: unknown, arg: unknown, description: string, argDescription?: string): void;
|
|
9
11
|
addMainOptionEntries(entries: unknown[]): void;
|
|
@@ -19,6 +19,23 @@ export class Application {
|
|
|
19
19
|
},
|
|
20
20
|
], { type: "gobject", borrowed: true });
|
|
21
21
|
}
|
|
22
|
+
static getDefault() {
|
|
23
|
+
const ptr = call("libgio-2.0.so.0", "g_application_get_default", [], {
|
|
24
|
+
type: "gobject",
|
|
25
|
+
borrowed: true,
|
|
26
|
+
});
|
|
27
|
+
const instance = Object.create(Application.prototype);
|
|
28
|
+
instance.ptr = ptr;
|
|
29
|
+
return instance;
|
|
30
|
+
}
|
|
31
|
+
static idIsValid(applicationId) {
|
|
32
|
+
return call("libgio-2.0.so.0", "g_application_id_is_valid", [
|
|
33
|
+
{
|
|
34
|
+
type: { type: "string" },
|
|
35
|
+
value: applicationId,
|
|
36
|
+
},
|
|
37
|
+
], { type: "boolean" });
|
|
38
|
+
}
|
|
22
39
|
activate() {
|
|
23
40
|
call("libgio-2.0.so.0", "g_application_activate", [
|
|
24
41
|
{
|
|
@@ -2,6 +2,7 @@ export declare class Cancellable {
|
|
|
2
2
|
ptr: unknown;
|
|
3
3
|
constructor(_args?: unknown[]);
|
|
4
4
|
protected createPtr(_args: unknown[]): unknown;
|
|
5
|
+
static getCurrent(): Cancellable;
|
|
5
6
|
cancel(): void;
|
|
6
7
|
connect(callback: unknown, data?: unknown, dataDestroyFunc?: unknown): number;
|
|
7
8
|
disconnect(handlerId: number): void;
|
|
@@ -10,6 +10,15 @@ export class Cancellable {
|
|
|
10
10
|
borrowed: true,
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
+
static getCurrent() {
|
|
14
|
+
const ptr = call("libgio-2.0.so.0", "g_cancellable_get_current", [], {
|
|
15
|
+
type: "gobject",
|
|
16
|
+
borrowed: true,
|
|
17
|
+
});
|
|
18
|
+
const instance = Object.create(Cancellable.prototype);
|
|
19
|
+
instance.ptr = ptr;
|
|
20
|
+
return instance;
|
|
21
|
+
}
|
|
13
22
|
cancel() {
|
|
14
23
|
call("libgio-2.0.so.0", "g_cancellable_cancel", [
|
|
15
24
|
{
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { call } from "@gtkx/native";
|
|
1
2
|
export class DBusActionGroup {
|
|
2
3
|
ptr;
|
|
3
4
|
constructor(_args = []) {
|
|
@@ -6,4 +7,23 @@ export class DBusActionGroup {
|
|
|
6
7
|
createPtr(_args) {
|
|
7
8
|
return null;
|
|
8
9
|
}
|
|
10
|
+
static get(connection, objectPath, busName) {
|
|
11
|
+
const ptr = call("libgio-2.0.so.0", "g_dbus_action_group_get", [
|
|
12
|
+
{
|
|
13
|
+
type: { type: "gobject" },
|
|
14
|
+
value: connection,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: { type: "string" },
|
|
18
|
+
value: busName,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
type: { type: "string" },
|
|
22
|
+
value: objectPath,
|
|
23
|
+
},
|
|
24
|
+
], { type: "gobject", borrowed: true });
|
|
25
|
+
const instance = Object.create(DBusActionGroup.prototype);
|
|
26
|
+
instance.ptr = ptr;
|
|
27
|
+
return instance;
|
|
28
|
+
}
|
|
9
29
|
}
|
|
@@ -8,6 +8,8 @@ export declare class DBusConnection {
|
|
|
8
8
|
static connectionNewForAddressSync(address: string, flags: DBusConnectionFlags, observer?: unknown, cancellable?: unknown): DBusConnection;
|
|
9
9
|
static connectionNewSync(stream: unknown, flags: DBusConnectionFlags, guid?: string, observer?: unknown, cancellable?: unknown): DBusConnection;
|
|
10
10
|
protected createPtr(_args: unknown[]): unknown;
|
|
11
|
+
static _new(stream: unknown, flags: DBusConnectionFlags, guid?: string, observer?: unknown, cancellable?: unknown, callback?: unknown, userData?: unknown): void;
|
|
12
|
+
static newForAddress(address: string, flags: DBusConnectionFlags, observer?: unknown, cancellable?: unknown, callback?: unknown, userData?: unknown): void;
|
|
11
13
|
addFilter(filterFunction: unknown, userDataFreeFunc: unknown, userData?: unknown): number;
|
|
12
14
|
call(objectPath: string, interfaceName: string, methodName: string, flags: DBusCallFlags, timeoutMsec: number, busName?: string, parameters?: unknown, replyType?: unknown, cancellable?: unknown, callback?: unknown, userData?: unknown): void;
|
|
13
15
|
callFinish(res: unknown): unknown;
|