... | ... | @@ -184,19 +184,38 @@ Gtk.WindowType.TOPLEVEL; |
|
|
Gio.ApplicationFlags.FLAGS_NONE
|
|
|
```
|
|
|
|
|
|
[gjs-docs]: http://devdocs.baznga.org/
|
|
|
Flags can be manipulated using native [bitwise operators][mdn-bitwise].
|
|
|
|
|
|
## Structures
|
|
|
```js
|
|
|
let myApp = new Gio.Application({
|
|
|
flags: Gio.ApplicationFlags.HANDLES_OPEN | Gio.ApplicationFlags.HANDLES_COMMAND_LINE
|
|
|
});
|
|
|
|
|
|
if (myApp.flags & Gio.ApplicationFlags.HANDLES_OPEN) {
|
|
|
myApp.flags &= ~Gio.ApplicationFlags.HANDLES_OPEN;
|
|
|
}
|
|
|
```
|
|
|
|
|
|
C structures have JavaScript properties for each member. Generally you should treat these as read-only.
|
|
|
[gjs-docs]: http://devdocs.baznga.org/
|
|
|
[mdn-bitwise]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators
|
|
|
|
|
|
> **PC** I'm not sure it's true anymore that these are read-only. Worth double checking.
|
|
|
## Structs and Unions
|
|
|
|
|
|
## Unions
|
|
|
C structures and unions are documented in the [Gnome API documentation][gjs-docs] (e.g. [Gdk.Event][gdk-event]) and generally have either JavaScript properties or getter methods for each member. Results may vary when trying to modify structs or unions.
|
|
|
|
|
|
Unions are currently opaque.
|
|
|
```js
|
|
|
widget.connect("key-press-event", (widget, event) => {
|
|
|
log(event);
|
|
|
// expected output: [union instance proxy GIName:Gdk.Event jsobj@0x7f19a00b6400 native@0x5620c6a7c6e0]
|
|
|
log(event.get_event_type() === Gdk.EventType.KEY_PRESS);
|
|
|
// expected output: true
|
|
|
let [success, keyval] = event.get_keyval();
|
|
|
log(keyval);
|
|
|
// example output: 65507
|
|
|
});
|
|
|
```
|
|
|
|
|
|
> **PC** I don't think this is true anymore either, though I think they are read-only. Unions are rare anyway.
|
|
|
[gdk-event]: http://devdocs.baznga.org/gdk30~3.22p/gdk.event
|
|
|
|
|
|
## Multiple return values (caller-allocates)
|
|
|
|
... | ... | |