@gtkx/ffi 0.18.4 → 0.18.6

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.
Files changed (77) hide show
  1. package/dist/generated/adw/constants.d.ts +2 -2
  2. package/dist/generated/adw/constants.js +2 -2
  3. package/dist/generated/gdkwayland/index.d.ts +9 -0
  4. package/dist/generated/gdkwayland/index.d.ts.map +1 -0
  5. package/dist/generated/gdkwayland/index.js +9 -0
  6. package/dist/generated/gdkwayland/index.js.map +1 -0
  7. package/dist/generated/gdkwayland/wayland-device.d.ts +29 -0
  8. package/dist/generated/gdkwayland/wayland-device.d.ts.map +1 -0
  9. package/dist/generated/gdkwayland/wayland-device.js +81 -0
  10. package/dist/generated/gdkwayland/wayland-device.js.map +1 -0
  11. package/dist/generated/gdkwayland/wayland-display.d.ts +44 -0
  12. package/dist/generated/gdkwayland/wayland-display.d.ts.map +1 -0
  13. package/dist/generated/gdkwayland/wayland-display.js +161 -0
  14. package/dist/generated/gdkwayland/wayland-display.js.map +1 -0
  15. package/dist/generated/gdkwayland/wayland-gl-context.d.ts +8 -0
  16. package/dist/generated/gdkwayland/wayland-gl-context.d.ts.map +1 -0
  17. package/dist/generated/gdkwayland/wayland-gl-context.js +33 -0
  18. package/dist/generated/gdkwayland/wayland-gl-context.js.map +1 -0
  19. package/dist/generated/gdkwayland/wayland-monitor.d.ts +14 -0
  20. package/dist/generated/gdkwayland/wayland-monitor.d.ts.map +1 -0
  21. package/dist/generated/gdkwayland/wayland-monitor.js +39 -0
  22. package/dist/generated/gdkwayland/wayland-monitor.js.map +1 -0
  23. package/dist/generated/gdkwayland/wayland-popup.d.ts +49 -0
  24. package/dist/generated/gdkwayland/wayland-popup.d.ts.map +1 -0
  25. package/dist/generated/gdkwayland/wayland-popup.js +199 -0
  26. package/dist/generated/gdkwayland/wayland-popup.js.map +1 -0
  27. package/dist/generated/gdkwayland/wayland-seat.d.ts +14 -0
  28. package/dist/generated/gdkwayland/wayland-seat.d.ts.map +1 -0
  29. package/dist/generated/gdkwayland/wayland-seat.js +39 -0
  30. package/dist/generated/gdkwayland/wayland-seat.js.map +1 -0
  31. package/dist/generated/gdkwayland/wayland-surface.d.ts +16 -0
  32. package/dist/generated/gdkwayland/wayland-surface.d.ts.map +1 -0
  33. package/dist/generated/gdkwayland/wayland-surface.js +53 -0
  34. package/dist/generated/gdkwayland/wayland-surface.js.map +1 -0
  35. package/dist/generated/gdkwayland/wayland-toplevel.d.ts +252 -0
  36. package/dist/generated/gdkwayland/wayland-toplevel.d.ts.map +1 -0
  37. package/dist/generated/gdkwayland/wayland-toplevel.js +1022 -0
  38. package/dist/generated/gdkwayland/wayland-toplevel.js.map +1 -0
  39. package/dist/generated/gst/constants.d.ts +1 -1
  40. package/dist/generated/gst/constants.d.ts.map +1 -1
  41. package/dist/generated/gst/constants.js +1 -1
  42. package/dist/generated/gst/constants.js.map +1 -1
  43. package/dist/generated/gtk4layershell/functions.d.ts +18 -7
  44. package/dist/generated/gtk4layershell/functions.d.ts.map +1 -1
  45. package/dist/generated/gtk4layershell/functions.js +50 -5
  46. package/dist/generated/gtk4layershell/functions.js.map +1 -1
  47. package/dist/generated/gtk4sessionlock/functions.d.ts +3 -0
  48. package/dist/generated/gtk4sessionlock/functions.d.ts.map +1 -0
  49. package/dist/generated/gtk4sessionlock/functions.js +8 -0
  50. package/dist/generated/gtk4sessionlock/functions.js.map +1 -0
  51. package/dist/generated/gtk4sessionlock/index.d.ts +3 -0
  52. package/dist/generated/gtk4sessionlock/index.d.ts.map +1 -0
  53. package/dist/generated/gtk4sessionlock/index.js +3 -0
  54. package/dist/generated/gtk4sessionlock/index.js.map +1 -0
  55. package/dist/generated/gtk4sessionlock/instance.d.ts +36 -0
  56. package/dist/generated/gtk4sessionlock/instance.d.ts.map +1 -0
  57. package/dist/generated/gtk4sessionlock/instance.js +215 -0
  58. package/dist/generated/gtk4sessionlock/instance.js.map +1 -0
  59. package/dist/generated/vte/constants.d.ts +1 -1
  60. package/dist/generated/vte/constants.js +1 -1
  61. package/package.json +3 -3
  62. package/src/generated/adw/constants.ts +2 -2
  63. package/src/generated/gdkwayland/index.ts +8 -0
  64. package/src/generated/gdkwayland/wayland-device.ts +99 -0
  65. package/src/generated/gdkwayland/wayland-display.ts +197 -0
  66. package/src/generated/gdkwayland/wayland-gl-context.ts +39 -0
  67. package/src/generated/gdkwayland/wayland-monitor.ts +45 -0
  68. package/src/generated/gdkwayland/wayland-popup.ts +247 -0
  69. package/src/generated/gdkwayland/wayland-seat.ts +45 -0
  70. package/src/generated/gdkwayland/wayland-surface.ts +65 -0
  71. package/src/generated/gdkwayland/wayland-toplevel.ts +1260 -0
  72. package/src/generated/gst/constants.ts +1 -1
  73. package/src/generated/gtk4layershell/functions.ts +62 -8
  74. package/src/generated/gtk4sessionlock/functions.ts +8 -0
  75. package/src/generated/gtk4sessionlock/index.ts +2 -0
  76. package/src/generated/gtk4sessionlock/instance.ts +271 -0
  77. package/src/generated/vte/constants.ts +1 -1
@@ -662,7 +662,7 @@ export const VALUE_UNORDERED = 2;
662
662
  /** The major version of GStreamer at compile time: */
663
663
  export const VERSION_MAJOR = 1;
664
664
  /** The micro version of GStreamer at compile time: */
665
- export const VERSION_MICRO = 9;
665
+ export const VERSION_MICRO = 10;
666
666
  /** The minor version of GStreamer at compile time: */
667
667
  export const VERSION_MINOR = 26;
668
668
  /**
@@ -186,9 +186,9 @@ export const getMinorVersion = (): number => {
186
186
  };
187
187
  /**
188
188
  * NOTE: To get which monitor the surface is actually on, use
189
- * gdk_display_get_monitor_at_window().
189
+ * gdk_display_get_monitor_at_surface().
190
190
  */
191
- export const getMonitor = (window: Gtk.Window): Gdk.Monitor => {
191
+ export const getMonitor = (window: Gtk.Window): Gdk.Monitor | null => {
192
192
  const ptr = call(
193
193
  "libgtk4-layer-shell.so.0",
194
194
  "gtk_layer_get_monitor",
@@ -206,6 +206,7 @@ export const getMonitor = (window: Gtk.Window): Gdk.Monitor => {
206
206
  ownership: "borrowed",
207
207
  },
208
208
  );
209
+ if (ptr === null) return null;
209
210
  return getNativeObject(ptr as NativeHandle) as Gdk.Monitor;
210
211
  };
211
212
  /**
@@ -239,6 +240,24 @@ export const getProtocolVersion = (): number => {
239
240
  unsigned: true,
240
241
  }) as number;
241
242
  };
243
+ export const getRespectClose = (window: Gtk.Window): boolean => {
244
+ return call(
245
+ "libgtk4-layer-shell.so.0",
246
+ "gtk_layer_get_respect_close",
247
+ [
248
+ {
249
+ type: {
250
+ type: "gobject",
251
+ ownership: "borrowed",
252
+ },
253
+ value: window.handle,
254
+ },
255
+ ],
256
+ {
257
+ type: "boolean",
258
+ },
259
+ ) as boolean;
260
+ };
242
261
  /**
243
262
  * Set the `window` up to be a layer surface once it is mapped. this must be called before
244
263
  * the `window` is realized.
@@ -360,7 +379,8 @@ export const setExclusiveZone = (window: Gtk.Window, exclusiveZone: number) => {
360
379
  };
361
380
  /**
362
381
  * Sets if/when `window` should receive keyboard events from the compositor, see
363
- * GtkLayerShellKeyboardMode for details.
382
+ * GtkLayerShellKeyboardMode for details. To control mouse/touch interactivity use input regions,
383
+ * see [#61](https://github.com/wmww/gtk4-layer-shell/issues/61) for details.
364
384
  *
365
385
  * Default is %GTK_LAYER_SHELL_KEYBOARD_MODE_NONE
366
386
  */
@@ -391,7 +411,7 @@ export const setKeyboardMode = (window: Gtk.Window, mode: KeyboardMode) => {
391
411
  );
392
412
  };
393
413
  /**
394
- * Set the "layer" on which the surface appears (controls if it is over top of or below other surfaces). The layer may
414
+ * Set the "layer" on which the surface appears(controls if it is over top of or below other surfaces). The layer may
395
415
  * be changed on-the-fly in the current version of the layer shell protocol, but on compositors that only support an
396
416
  * older version the `window` is remapped so the change can take effect.
397
417
  *
@@ -425,7 +445,7 @@ export const setLayer = (window: Gtk.Window, layer: Layer) => {
425
445
  };
426
446
  /**
427
447
  * Set the margin for a specific `edge` of a `window`. Effects both surface's distance from
428
- * the edge and its exclusive zone size (if auto exclusive zone enabled).
448
+ * the edge and its exclusive zone size(if auto exclusive zone enabled).
429
449
  *
430
450
  * Default is 0 for each #GtkLayerShellEdge
431
451
  */
@@ -469,7 +489,7 @@ export const setMargin = (window: Gtk.Window, edge: Edge, marginSize: number) =>
469
489
  *
470
490
  * Default is %NULL
471
491
  */
472
- export const setMonitor = (window: Gtk.Window, monitor: Gdk.Monitor) => {
492
+ export const setMonitor = (window: Gtk.Window, monitor?: Gdk.Monitor | null) => {
473
493
  call(
474
494
  "libgtk4-layer-shell.so.0",
475
495
  "gtk_layer_set_monitor",
@@ -486,7 +506,8 @@ export const setMonitor = (window: Gtk.Window, monitor: Gdk.Monitor) => {
486
506
  type: "gobject",
487
507
  ownership: "borrowed",
488
508
  },
489
- value: monitor.handle,
509
+ value: monitor?.handle,
510
+ optional: true,
490
511
  },
491
512
  ],
492
513
  {
@@ -504,7 +525,7 @@ export const setMonitor = (window: Gtk.Window, monitor: Gdk.Monitor) => {
504
525
  *
505
526
  * Default is "gtk4-layer-shell" (which will be used if set to %NULL)
506
527
  */
507
- export const setNamespace = (window: Gtk.Window, nameSpace: string) => {
528
+ export const setNamespace = (window: Gtk.Window, nameSpace?: string | null) => {
508
529
  call(
509
530
  "libgtk4-layer-shell.so.0",
510
531
  "gtk_layer_set_namespace",
@@ -522,6 +543,39 @@ export const setNamespace = (window: Gtk.Window, nameSpace: string) => {
522
543
  ownership: "borrowed",
523
544
  },
524
545
  value: nameSpace,
546
+ optional: true,
547
+ },
548
+ ],
549
+ {
550
+ type: "undefined",
551
+ },
552
+ );
553
+ };
554
+ /**
555
+ * Compositors may send the `zwlr_layer_surface_v1.closed` event in some cases (such as
556
+ * when an output is destroyed). Prior to v1.3 this always triggered a GTK `close-request`
557
+ * signal, which would destroy the window if not intercepted by application code. In v1.3+
558
+ * this behavior is disabled by default, and can be turned back on by calling this
559
+ * function with %TRUE. To handle the `.closed` event without destroying your window
560
+ * turn respect_close on and connect a `close-request` listener that returns %TRUE.
561
+ */
562
+ export const setRespectClose = (window: Gtk.Window, respectClose: boolean) => {
563
+ call(
564
+ "libgtk4-layer-shell.so.0",
565
+ "gtk_layer_set_respect_close",
566
+ [
567
+ {
568
+ type: {
569
+ type: "gobject",
570
+ ownership: "borrowed",
571
+ },
572
+ value: window.handle,
573
+ },
574
+ {
575
+ type: {
576
+ type: "boolean",
577
+ },
578
+ value: respectClose,
525
579
  },
526
580
  ],
527
581
  {
@@ -0,0 +1,8 @@
1
+ import { call } from "../../native.js";
2
+
3
+ /** May block for a Wayland roundtrip the first time it's called. */
4
+ export const isSupported = (): boolean => {
5
+ return call("libgtk4-layer-shell.so.0", "gtk_session_lock_is_supported", [], {
6
+ type: "boolean",
7
+ }) as boolean;
8
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./functions.js";
2
+ export * from "./instance.js";
@@ -0,0 +1,271 @@
1
+ import { isInstantiating, setInstantiating } from "../../lifecycle.js";
2
+ import { NativeHandle } from "../../object.js";
3
+ import { call } from "../../native.js";
4
+ import { getNativeObject, registerNativeClass, registerNativeObject } from "../../registry.js";
5
+ import * as GObject from "../gobject/index.js";
6
+ import * as Gdk from "../gdk/index.js";
7
+ import * as Gtk from "../gtk/index.js";
8
+
9
+ /**
10
+ * An instance of the object used to control locking the screen.
11
+ * Multiple instances can exist at once, but only one can be locked at a time.
12
+ */
13
+ export class Instance extends GObject.Object {
14
+ static override readonly glibTypeName: string = "GtkSessionLockInstance";
15
+ static override readonly objectType = "gobject" as const;
16
+
17
+ constructor() {
18
+ if (!isInstantiating) {
19
+ setInstantiating(true);
20
+ // @ts-ignore
21
+ super();
22
+ setInstantiating(false);
23
+ this.handle = call("libgtk4-layer-shell.so.0", "gtk_session_lock_instance_new", [], {
24
+ type: "gobject",
25
+ ownership: "full",
26
+ }) as NativeHandle;
27
+ registerNativeObject(this);
28
+ } else {
29
+ // @ts-ignore
30
+ super();
31
+ }
32
+ }
33
+
34
+ /**
35
+ * This must be called with a different unrealized window once for each monitor immediately after calling
36
+ * gtk_session_lock_lock(). Hiding a window that is active on a monitor or not letting a window be resized by the
37
+ * library is not allowed (may result in a Wayland protocol error). The window will be unmapped and gtk_window_destroy()
38
+ * called on it when the current lock ends.
39
+ */
40
+ assignWindowToMonitor(window: Gtk.Window, monitor: Gdk.Monitor) {
41
+ call(
42
+ "libgtk4-layer-shell.so.0",
43
+ "gtk_session_lock_instance_assign_window_to_monitor",
44
+ [
45
+ {
46
+ type: {
47
+ type: "gobject",
48
+ ownership: "borrowed",
49
+ },
50
+ value: this.handle,
51
+ },
52
+ {
53
+ type: {
54
+ type: "gobject",
55
+ ownership: "borrowed",
56
+ },
57
+ value: window.handle,
58
+ },
59
+ {
60
+ type: {
61
+ type: "gobject",
62
+ ownership: "borrowed",
63
+ },
64
+ value: monitor.handle,
65
+ },
66
+ ],
67
+ {
68
+ type: "undefined",
69
+ },
70
+ );
71
+ }
72
+
73
+ /** Returns if this instance currently holds a lock. */
74
+ isLocked(): boolean {
75
+ return call(
76
+ "libgtk4-layer-shell.so.0",
77
+ "gtk_session_lock_instance_is_locked",
78
+ [
79
+ {
80
+ type: {
81
+ type: "gobject",
82
+ ownership: "borrowed",
83
+ },
84
+ value: this.handle,
85
+ },
86
+ ],
87
+ {
88
+ type: "boolean",
89
+ },
90
+ ) as boolean;
91
+ }
92
+
93
+ /**
94
+ * Lock the screen. This should be called before assigning any windows to monitors. If this function fails the ::failed
95
+ * signal is emitted, if it succeeds the ::locked signal is emitted. The ::failed signal may be emitted before the
96
+ * function returns (for example, if another #GtkSessionLockInstance holds a lock) or later (if another process holds a
97
+ * lock). The only case where neither signal is triggered is if the instance is already locked.
98
+ */
99
+ lock(): boolean {
100
+ return call(
101
+ "libgtk4-layer-shell.so.0",
102
+ "gtk_session_lock_instance_lock",
103
+ [
104
+ {
105
+ type: {
106
+ type: "gobject",
107
+ ownership: "borrowed",
108
+ },
109
+ value: this.handle,
110
+ },
111
+ ],
112
+ {
113
+ type: "boolean",
114
+ },
115
+ ) as boolean;
116
+ }
117
+
118
+ /** If the screen is locked by this instance unlocks it and fires ::unlocked. Otherwise has no effect */
119
+ unlock() {
120
+ call(
121
+ "libgtk4-layer-shell.so.0",
122
+ "gtk_session_lock_instance_unlock",
123
+ [
124
+ {
125
+ type: {
126
+ type: "gobject",
127
+ ownership: "borrowed",
128
+ },
129
+ value: this.handle,
130
+ },
131
+ ],
132
+ {
133
+ type: "undefined",
134
+ },
135
+ );
136
+ }
137
+
138
+ connect(signal: "failed", handler: (self: Instance) => void, after?: boolean): number;
139
+ connect(signal: "locked", handler: (self: Instance) => void, after?: boolean): number;
140
+ connect(signal: "monitor", handler: (self: Instance, monitor: Gdk.Monitor) => void, after?: boolean): number;
141
+ connect(signal: "unlocked", handler: (self: Instance) => void, after?: boolean): number;
142
+ connect(signal: string, handler: (...args: any[]) => any, after?: boolean): number;
143
+ /**
144
+ * Connects a handler to a signal on this Instance.
145
+ *
146
+ * @param signal - The signal name to connect to
147
+ * @param handler - Callback function invoked when signal is emitted
148
+ * @param after - If true, handler is called after default handler
149
+ * @returns Connection ID for disconnecting
150
+ */
151
+ connect(signal: string, handler: (...args: any[]) => any, after = false): number {
152
+ switch (signal) {
153
+ case "failed": {
154
+ const wrappedHandler = (...args: unknown[]) => {
155
+ return handler(getNativeObject(args[0] as NativeHandle) as Instance);
156
+ };
157
+ return call(
158
+ "libgtk4-layer-shell.so.0",
159
+ "g_signal_connect_closure",
160
+ [
161
+ { type: { type: "gobject", ownership: "borrowed" }, value: this.handle },
162
+ { type: { type: "string", ownership: "borrowed" }, value: signal },
163
+ {
164
+ type: {
165
+ type: "callback",
166
+ argTypes: [{ type: "gobject", ownership: "borrowed" }],
167
+ returnType: {
168
+ type: "undefined",
169
+ },
170
+ kind: "closure",
171
+ },
172
+ value: wrappedHandler,
173
+ },
174
+ { type: { type: "boolean" }, value: after },
175
+ ],
176
+ { type: "int", size: 64, unsigned: true },
177
+ ) as number;
178
+ }
179
+ case "locked": {
180
+ const wrappedHandler = (...args: unknown[]) => {
181
+ return handler(getNativeObject(args[0] as NativeHandle) as Instance);
182
+ };
183
+ return call(
184
+ "libgtk4-layer-shell.so.0",
185
+ "g_signal_connect_closure",
186
+ [
187
+ { type: { type: "gobject", ownership: "borrowed" }, value: this.handle },
188
+ { type: { type: "string", ownership: "borrowed" }, value: signal },
189
+ {
190
+ type: {
191
+ type: "callback",
192
+ argTypes: [{ type: "gobject", ownership: "borrowed" }],
193
+ returnType: {
194
+ type: "undefined",
195
+ },
196
+ kind: "closure",
197
+ },
198
+ value: wrappedHandler,
199
+ },
200
+ { type: { type: "boolean" }, value: after },
201
+ ],
202
+ { type: "int", size: 64, unsigned: true },
203
+ ) as number;
204
+ }
205
+ case "monitor": {
206
+ const wrappedHandler = (...args: unknown[]) => {
207
+ return handler(
208
+ getNativeObject(args[0] as NativeHandle) as Instance,
209
+ getNativeObject(args[1] as NativeHandle) as Gdk.Monitor,
210
+ );
211
+ };
212
+ return call(
213
+ "libgtk4-layer-shell.so.0",
214
+ "g_signal_connect_closure",
215
+ [
216
+ { type: { type: "gobject", ownership: "borrowed" }, value: this.handle },
217
+ { type: { type: "string", ownership: "borrowed" }, value: signal },
218
+ {
219
+ type: {
220
+ type: "callback",
221
+ argTypes: [
222
+ { type: "gobject", ownership: "borrowed" },
223
+ {
224
+ type: "gobject",
225
+ ownership: "borrowed",
226
+ },
227
+ ],
228
+ returnType: {
229
+ type: "undefined",
230
+ },
231
+ kind: "closure",
232
+ },
233
+ value: wrappedHandler,
234
+ },
235
+ { type: { type: "boolean" }, value: after },
236
+ ],
237
+ { type: "int", size: 64, unsigned: true },
238
+ ) as number;
239
+ }
240
+ case "unlocked": {
241
+ const wrappedHandler = (...args: unknown[]) => {
242
+ return handler(getNativeObject(args[0] as NativeHandle) as Instance);
243
+ };
244
+ return call(
245
+ "libgtk4-layer-shell.so.0",
246
+ "g_signal_connect_closure",
247
+ [
248
+ { type: { type: "gobject", ownership: "borrowed" }, value: this.handle },
249
+ { type: { type: "string", ownership: "borrowed" }, value: signal },
250
+ {
251
+ type: {
252
+ type: "callback",
253
+ argTypes: [{ type: "gobject", ownership: "borrowed" }],
254
+ returnType: {
255
+ type: "undefined",
256
+ },
257
+ kind: "closure",
258
+ },
259
+ value: wrappedHandler,
260
+ },
261
+ { type: { type: "boolean" }, value: after },
262
+ ],
263
+ { type: "int", size: 64, unsigned: true },
264
+ ) as number;
265
+ }
266
+ default:
267
+ return super.connect(signal, handler, after);
268
+ }
269
+ }
270
+ }
271
+ registerNativeClass(Instance);
@@ -7,7 +7,7 @@ export const MAJOR_VERSION = 0;
7
7
  * The micro version number of the VTE library
8
8
  * (e.g. in version 3.1.4 this is 4).
9
9
  */
10
- export const MICRO_VERSION = 2;
10
+ export const MICRO_VERSION = 3;
11
11
  /**
12
12
  * The minor version number of the VTE library
13
13
  * (e.g. in version 3.1.4 this is 1).