node-gtk 0.10.0 → 0.12.0
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/README.md +54 -53
- package/binding.gyp +36 -18
- package/lib/binding/node-v102-linux-x64/node_gtk.node +0 -0
- package/lib/binding/node-v108-linux-x64/node_gtk.node +0 -0
- package/lib/binding/node-v115-linux-x64/node_gtk.node +0 -0
- package/lib/binding/node-v93-linux-x64/node_gtk.node +0 -0
- package/lib/overrides/Gtk-3.0.js +8 -0
- package/lib/overrides/Gtk-4.0.js +16 -0
- package/package.json +8 -8
- package/scripts/ci.sh +5 -1
- package/src/boxed.cc +3 -3
- package/src/callback.cc +10 -12
- package/src/closure.cc +5 -5
- package/src/closure.h +2 -2
- package/src/debug.cc +2 -2
- package/src/function.cc +41 -26
- package/src/function.h +1 -1
- package/src/gi.cc +17 -17
- package/src/gobject.cc +9 -5
- package/src/loop.cc +5 -0
- package/src/modules/cairo/context.cc +102 -106
- package/src/modules/cairo/generator.js +1 -5
- package/src/type.cc +5 -5
- package/src/util.h +1 -3
- package/src/value.cc +108 -35
- package/src/value.h +1 -1
package/src/function.cc
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
#include <string.h>
|
|
3
2
|
#include <girffi.h>
|
|
4
3
|
|
|
@@ -56,7 +55,7 @@ static void* AllocateArgument (GIBaseInfo *arg_info) {
|
|
|
56
55
|
|
|
57
56
|
GIBaseInfo* base_info = g_type_info_get_interface (&arg_type);
|
|
58
57
|
size_t size = Boxed::GetSize (base_info);
|
|
59
|
-
void* pointer =
|
|
58
|
+
void* pointer = g_malloc0(size);
|
|
60
59
|
|
|
61
60
|
g_base_info_unref(base_info);
|
|
62
61
|
return pointer;
|
|
@@ -165,14 +164,14 @@ bool FunctionInfo::Init() {
|
|
|
165
164
|
|
|
166
165
|
call_parameters[i].direction = direction;
|
|
167
166
|
|
|
168
|
-
if (call_parameters[i].type == ParameterType::
|
|
167
|
+
if (call_parameters[i].type == ParameterType::kSKIP)
|
|
169
168
|
continue;
|
|
170
169
|
|
|
171
170
|
// If there is an array length, this is an array
|
|
172
171
|
int length_i = g_type_info_get_array_length (&type_info);
|
|
173
172
|
if (tag == GI_TYPE_TAG_ARRAY && length_i >= 0) {
|
|
174
|
-
call_parameters[i].type = ParameterType::
|
|
175
|
-
call_parameters[length_i].type = ParameterType::
|
|
173
|
+
call_parameters[i].type = ParameterType::kARRAY;
|
|
174
|
+
call_parameters[length_i].type = ParameterType::kSKIP;
|
|
176
175
|
|
|
177
176
|
// If array length came before, we need to remove it from args count
|
|
178
177
|
|
|
@@ -190,9 +189,9 @@ bool FunctionInfo::Init() {
|
|
|
190
189
|
if (interface_type == GI_INFO_TYPE_CALLBACK) {
|
|
191
190
|
if (IsDestroyNotify(interface_info)) {
|
|
192
191
|
/* Skip GDestroyNotify if they appear before the respective callback */
|
|
193
|
-
call_parameters[i].type = ParameterType::
|
|
192
|
+
call_parameters[i].type = ParameterType::kSKIP;
|
|
194
193
|
} else {
|
|
195
|
-
call_parameters[i].type = ParameterType::
|
|
194
|
+
call_parameters[i].type = ParameterType::kCALLBACK;
|
|
196
195
|
|
|
197
196
|
int destroy_i = g_arg_info_get_destroy(&arg_info);
|
|
198
197
|
int closure_i = g_arg_info_get_closure(&arg_info);
|
|
@@ -204,10 +203,10 @@ bool FunctionInfo::Init() {
|
|
|
204
203
|
}
|
|
205
204
|
|
|
206
205
|
if (destroy_i >= 0 && destroy_i < n_callable_args)
|
|
207
|
-
call_parameters[destroy_i].type = ParameterType::
|
|
206
|
+
call_parameters[destroy_i].type = ParameterType::kSKIP;
|
|
208
207
|
|
|
209
208
|
if (closure_i >= 0 && closure_i < n_callable_args)
|
|
210
|
-
call_parameters[closure_i].type = ParameterType::
|
|
209
|
+
call_parameters[closure_i].type = ParameterType::kSKIP;
|
|
211
210
|
|
|
212
211
|
if (destroy_i < i) {
|
|
213
212
|
if (IsDirectionIn(call_parameters[destroy_i].direction))
|
|
@@ -271,7 +270,7 @@ bool FunctionInfo::TypeCheck (const Nan::FunctionCallbackInfo<Value> &arguments)
|
|
|
271
270
|
for (int in_arg = 0, i = 0; i < n_callable_args; i++) {
|
|
272
271
|
Parameter ¶m = call_parameters[i];
|
|
273
272
|
|
|
274
|
-
if (param.type == ParameterType::
|
|
273
|
+
if (param.type == ParameterType::kSKIP)
|
|
275
274
|
continue;
|
|
276
275
|
|
|
277
276
|
GIArgInfo arg_info;
|
|
@@ -325,7 +324,12 @@ Local<Value> FunctionCall (
|
|
|
325
324
|
* and for error, if it can throw
|
|
326
325
|
*/
|
|
327
326
|
|
|
328
|
-
|
|
327
|
+
#ifndef __linux__
|
|
328
|
+
GIArgument *total_arg_values = new GIArgument[func->n_total_args]();
|
|
329
|
+
#else
|
|
330
|
+
GIArgument total_arg_values[func->n_total_args];
|
|
331
|
+
#endif
|
|
332
|
+
|
|
329
333
|
GIArgument *callable_arg_values;
|
|
330
334
|
GError *error_stack = nullptr;
|
|
331
335
|
|
|
@@ -340,7 +344,6 @@ Local<Value> FunctionCall (
|
|
|
340
344
|
if (func->can_throw)
|
|
341
345
|
callable_arg_values[func->n_callable_args].v_pointer = error != NULL ? error : &error_stack;
|
|
342
346
|
|
|
343
|
-
|
|
344
347
|
/*
|
|
345
348
|
* Second, allocate OUT-arguments and fill IN-arguments
|
|
346
349
|
*/
|
|
@@ -348,7 +351,7 @@ Local<Value> FunctionCall (
|
|
|
348
351
|
for (int in_arg = 0, i = 0; i < func->n_callable_args; i++) {
|
|
349
352
|
Parameter& param = func->call_parameters[i];
|
|
350
353
|
|
|
351
|
-
if (param.type == ParameterType::
|
|
354
|
+
if (param.type == ParameterType::kSKIP)
|
|
352
355
|
continue;
|
|
353
356
|
|
|
354
357
|
GIArgInfo arg_info;
|
|
@@ -357,7 +360,7 @@ Local<Value> FunctionCall (
|
|
|
357
360
|
g_arg_info_load_type (&arg_info, &type_info);
|
|
358
361
|
GIDirection direction = g_arg_info_get_direction (&arg_info);
|
|
359
362
|
|
|
360
|
-
if (param.type == ParameterType::
|
|
363
|
+
if (param.type == ParameterType::kARRAY) {
|
|
361
364
|
GIArgInfo array_length_arg;
|
|
362
365
|
GITypeInfo array_length_type;
|
|
363
366
|
|
|
@@ -383,7 +386,7 @@ Local<Value> FunctionCall (
|
|
|
383
386
|
callable_arg_values[length_i].v_pointer = &len_param.data;
|
|
384
387
|
}
|
|
385
388
|
}
|
|
386
|
-
else if (param.type == ParameterType::
|
|
389
|
+
else if (param.type == ParameterType::kCALLBACK) {
|
|
387
390
|
Callback *callback;
|
|
388
391
|
ffi_closure *closure;
|
|
389
392
|
|
|
@@ -402,12 +405,12 @@ Local<Value> FunctionCall (
|
|
|
402
405
|
int closure_i = g_arg_info_get_closure(&arg_info);
|
|
403
406
|
|
|
404
407
|
if (destroy_i >= 0) {
|
|
405
|
-
g_assert (func->call_parameters[destroy_i].type == ParameterType::
|
|
408
|
+
g_assert (func->call_parameters[destroy_i].type == ParameterType::kSKIP);
|
|
406
409
|
callable_arg_values[destroy_i].v_pointer = callback ? (void*) Callback::DestroyNotify : NULL;
|
|
407
410
|
}
|
|
408
411
|
|
|
409
412
|
if (closure_i >= 0) {
|
|
410
|
-
g_assert (func->call_parameters[closure_i].type == ParameterType::
|
|
413
|
+
g_assert (func->call_parameters[closure_i].type == ParameterType::kSKIP);
|
|
411
414
|
callable_arg_values[closure_i].v_pointer = callback;
|
|
412
415
|
}
|
|
413
416
|
|
|
@@ -426,7 +429,7 @@ Local<Value> FunctionCall (
|
|
|
426
429
|
else /* (direction == GI_DIRECTION_IN || direction == GI_DIRECTION_INOUT) */ {
|
|
427
430
|
|
|
428
431
|
// Callback GIArgument is filled above, for the rest...
|
|
429
|
-
if (param.type != ParameterType::
|
|
432
|
+
if (param.type != ParameterType::kCALLBACK) {
|
|
430
433
|
|
|
431
434
|
// FIXME(handle failure here)
|
|
432
435
|
FillArgument(&arg_info, &callable_arg_values[i], info[in_arg]);
|
|
@@ -448,16 +451,24 @@ Local<Value> FunctionCall (
|
|
|
448
451
|
* Third, make the actual ffi_call
|
|
449
452
|
*/
|
|
450
453
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
+
#ifndef __linux__
|
|
455
|
+
void **ffi_args = new void*[func->n_total_args]();
|
|
456
|
+
#else
|
|
457
|
+
void *ffi_args[func->n_total_args];
|
|
458
|
+
#endif
|
|
454
459
|
|
|
460
|
+
for (int i = 0; i < func->n_total_args; i++)
|
|
461
|
+
ffi_args[i] = (void *)&total_arg_values[i];
|
|
455
462
|
|
|
456
|
-
GIArgument return_value_stack;
|
|
463
|
+
GIArgument return_value_stack = {0};
|
|
457
464
|
|
|
458
465
|
ffi_call (&func->invoker.cif, FFI_FN (func->invoker.native_address),
|
|
459
466
|
use_return_value ? return_value : &return_value_stack, ffi_args);
|
|
460
467
|
|
|
468
|
+
#ifndef __linux__
|
|
469
|
+
delete[] ffi_args;
|
|
470
|
+
#endif
|
|
471
|
+
|
|
461
472
|
|
|
462
473
|
/*
|
|
463
474
|
* Fourth, convert the return value & OUT-arguments back to JS
|
|
@@ -507,13 +518,13 @@ Local<Value> FunctionCall (
|
|
|
507
518
|
GIDirection direction = g_arg_info_get_direction (&arg_info);
|
|
508
519
|
GITransfer transfer = g_arg_info_get_ownership_transfer (&arg_info);
|
|
509
520
|
|
|
510
|
-
if (param.type == ParameterType::
|
|
521
|
+
if (param.type == ParameterType::kARRAY) {
|
|
511
522
|
if (direction == GI_DIRECTION_INOUT || direction == GI_DIRECTION_OUT)
|
|
512
523
|
FreeGIArgumentArray (&arg_type, (GIArgument*)arg_value.v_pointer, transfer, direction, param.length);
|
|
513
524
|
else
|
|
514
525
|
FreeGIArgumentArray (&arg_type, &arg_value, transfer, direction, param.length);
|
|
515
526
|
}
|
|
516
|
-
else if (param.type == ParameterType::
|
|
527
|
+
else if (param.type == ParameterType::kCALLBACK) {
|
|
517
528
|
Callback *callback = static_cast<Callback*>(func->call_parameters[i].data.v_pointer);
|
|
518
529
|
|
|
519
530
|
g_assert(direction == GI_DIRECTION_IN);
|
|
@@ -530,6 +541,10 @@ Local<Value> FunctionCall (
|
|
|
530
541
|
}
|
|
531
542
|
}
|
|
532
543
|
|
|
544
|
+
#ifndef __linux__
|
|
545
|
+
delete[] total_arg_values;
|
|
546
|
+
#endif
|
|
547
|
+
|
|
533
548
|
return jsReturnValue;
|
|
534
549
|
}
|
|
535
550
|
|
|
@@ -595,7 +610,7 @@ Local<Value> FunctionInfo::GetReturnValue (
|
|
|
595
610
|
|
|
596
611
|
if (direction == GI_DIRECTION_OUT || direction == GI_DIRECTION_INOUT) {
|
|
597
612
|
|
|
598
|
-
if (param.type == ParameterType::
|
|
613
|
+
if (param.type == ParameterType::kARRAY) {
|
|
599
614
|
|
|
600
615
|
int length_i = g_type_info_get_array_length(&arg_type);
|
|
601
616
|
GIArgInfo length_arg;
|
|
@@ -614,7 +629,7 @@ Local<Value> FunctionInfo::GetReturnValue (
|
|
|
614
629
|
|
|
615
630
|
ADD_RETURN (result)
|
|
616
631
|
|
|
617
|
-
} else if (param.type == ParameterType::
|
|
632
|
+
} else if (param.type == ParameterType::kNORMAL) {
|
|
618
633
|
|
|
619
634
|
if (IsPointerType(&arg_type) && g_arg_info_is_caller_allocates(&arg_info)) {
|
|
620
635
|
void *pointer = &arg_value.v_pointer;
|
package/src/function.h
CHANGED
package/src/gi.cc
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#include <
|
|
1
|
+
#include <girepository.h>
|
|
2
2
|
#include <node.h>
|
|
3
3
|
#include <nan.h>
|
|
4
4
|
|
|
@@ -345,22 +345,22 @@ NAN_METHOD(RegisterVFunc) {
|
|
|
345
345
|
void InitModule(Local<Object> exports, Local<Value> module, void *priv) {
|
|
346
346
|
GNodeJS::AsyncCallEnvironment::Initialize();
|
|
347
347
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
348
|
+
Nan::Export(exports, "Bootstrap", Bootstrap);
|
|
349
|
+
Nan::Export(exports, "GetModuleCache", GetModuleCache);
|
|
350
|
+
Nan::Export(exports, "GetBaseClass", GetBaseClass);
|
|
351
|
+
Nan::Export(exports, "GetTypeSize", GetTypeSize);
|
|
352
|
+
Nan::Export(exports, "GetConstantValue", GetConstantValue);
|
|
353
|
+
Nan::Export(exports, "MakeBoxedClass", MakeBoxedClass);
|
|
354
|
+
Nan::Export(exports, "MakeObjectClass", MakeObjectClass);
|
|
355
|
+
Nan::Export(exports, "MakeFunction", MakeFunction);
|
|
356
|
+
Nan::Export(exports, "StructFieldGetter", StructFieldGetter);
|
|
357
|
+
Nan::Export(exports, "StructFieldSetter", StructFieldSetter);
|
|
358
|
+
Nan::Export(exports, "ObjectPropertyGetter", ObjectPropertyGetter);
|
|
359
|
+
Nan::Export(exports, "ObjectPropertySetter", ObjectPropertySetter);
|
|
360
|
+
Nan::Export(exports, "StartLoop", StartLoop);
|
|
361
|
+
Nan::Export(exports, "GetLoopStack", GetLoopStack);
|
|
362
|
+
Nan::Export(exports, "RegisterClass", RegisterClass);
|
|
363
|
+
Nan::Export(exports, "RegisterVFunc", RegisterVFunc);
|
|
364
364
|
|
|
365
365
|
Nan::Set(exports, UTF8("System"), GNodeJS::System::GetModule());
|
|
366
366
|
Nan::Set(exports, UTF8("Cairo"), GNodeJS::Cairo::GetModule());
|
package/src/gobject.cc
CHANGED
|
@@ -87,7 +87,11 @@ static GObject* CreateGObjectFromObject(GType gtype, Local<Value> object) {
|
|
|
87
87
|
|
|
88
88
|
out:
|
|
89
89
|
g_strfreev ((gchar**) names);
|
|
90
|
+
|
|
91
|
+
for (int i = 0; i < n_properties; i++)
|
|
92
|
+
g_value_unset(&values[i]);
|
|
90
93
|
g_free (values);
|
|
94
|
+
|
|
91
95
|
g_type_class_unref (klass);
|
|
92
96
|
|
|
93
97
|
return gobject;
|
|
@@ -346,7 +350,7 @@ NAN_METHOD(SignalConnect) {
|
|
|
346
350
|
guint signalId;
|
|
347
351
|
GQuark detail;
|
|
348
352
|
GClosure *gclosure;
|
|
349
|
-
|
|
353
|
+
gulong handler_id;
|
|
350
354
|
|
|
351
355
|
const char *signalName = *Nan::Utf8String (TO_STRING (info[0]));
|
|
352
356
|
if (!g_signal_parse_name(signalName, gtype, &signalId, &detail, FALSE)) {
|
|
@@ -386,7 +390,7 @@ NAN_METHOD(SignalDisconnect) {
|
|
|
386
390
|
}
|
|
387
391
|
|
|
388
392
|
gpointer instance = static_cast<gpointer>(gobject);
|
|
389
|
-
|
|
393
|
+
gulong handler_id = TO_LONG (info[0]);
|
|
390
394
|
g_signal_handler_disconnect (instance, handler_id);
|
|
391
395
|
|
|
392
396
|
info.GetReturnValue().Set((double)handler_id);
|
|
@@ -443,7 +447,7 @@ NAN_METHOD(SignalEmit) {
|
|
|
443
447
|
g_value_set_object(&args[0], gobject);
|
|
444
448
|
|
|
445
449
|
failed = false;
|
|
446
|
-
for (
|
|
450
|
+
for (guint i = 0; i < signal_query.n_params; i++) {
|
|
447
451
|
GValue *gvalue = &args[i + 1];
|
|
448
452
|
|
|
449
453
|
g_value_init(gvalue, signal_query.param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE);
|
|
@@ -466,7 +470,7 @@ NAN_METHOD(SignalEmit) {
|
|
|
466
470
|
}
|
|
467
471
|
}
|
|
468
472
|
|
|
469
|
-
for (
|
|
473
|
+
for (guint i = 0; i < argc; i++) {
|
|
470
474
|
g_value_unset(&args[i]);
|
|
471
475
|
}
|
|
472
476
|
}
|
|
@@ -486,7 +490,7 @@ NAN_METHOD(GObjectToString) {
|
|
|
486
490
|
char *className = *Nan::Utf8String(self->GetConstructorName());
|
|
487
491
|
void *address = self->GetAlignedPointerFromInternalField(0);
|
|
488
492
|
|
|
489
|
-
char *str = g_strdup_printf("[%s:%s %#zx]", typeName, className, (
|
|
493
|
+
char *str = g_strdup_printf("[%s:%s %#zx]", typeName, className, (size_t)address);
|
|
490
494
|
|
|
491
495
|
info.GetReturnValue().Set(UTF8(str));
|
|
492
496
|
g_free(str);
|
package/src/loop.cc
CHANGED
|
@@ -92,9 +92,14 @@ static GSourceFuncs uv_loop_source_funcs = {
|
|
|
92
92
|
static GSource *loop_source_new (uv_loop_t *loop) {
|
|
93
93
|
struct uv_loop_source *source = (struct uv_loop_source *) g_source_new (&uv_loop_source_funcs, sizeof (*source));
|
|
94
94
|
source->loop = loop;
|
|
95
|
+
#if OS_WINDOWS
|
|
96
|
+
// FIXME
|
|
97
|
+
// https://github.com/nodejs/node/issues/36015
|
|
98
|
+
#else
|
|
95
99
|
g_source_add_unix_fd (&source->source,
|
|
96
100
|
uv_backend_fd (loop),
|
|
97
101
|
(GIOCondition) (G_IO_IN | G_IO_OUT | G_IO_ERR));
|
|
102
|
+
#endif
|
|
98
103
|
return &source->source;
|
|
99
104
|
}
|
|
100
105
|
|
|
@@ -1336,119 +1336,115 @@ NAN_METHOD(tagEnd) {
|
|
|
1336
1336
|
}
|
|
1337
1337
|
#endif
|
|
1338
1338
|
|
|
1339
|
-
#define SET_METHOD(tpl, name) Nan::SetPrototypeMethod(tpl, #name, name)
|
|
1340
|
-
|
|
1341
1339
|
static void AttachMethods(Local<FunctionTemplate> tpl) {
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1340
|
+
SET_PROTOTYPE_METHOD(tpl, status);
|
|
1341
|
+
SET_PROTOTYPE_METHOD(tpl, save);
|
|
1342
|
+
SET_PROTOTYPE_METHOD(tpl, restore);
|
|
1343
|
+
SET_PROTOTYPE_METHOD(tpl, getTarget);
|
|
1344
|
+
SET_PROTOTYPE_METHOD(tpl, pushGroup);
|
|
1345
|
+
SET_PROTOTYPE_METHOD(tpl, pushGroupWithContent);
|
|
1346
|
+
SET_PROTOTYPE_METHOD(tpl, popGroup);
|
|
1347
|
+
SET_PROTOTYPE_METHOD(tpl, popGroupToSource);
|
|
1348
|
+
SET_PROTOTYPE_METHOD(tpl, getGroupTarget);
|
|
1349
|
+
SET_PROTOTYPE_METHOD(tpl, setSourceRgb);
|
|
1350
|
+
SET_PROTOTYPE_METHOD(tpl, setSourceRgba);
|
|
1351
|
+
SET_PROTOTYPE_METHOD(tpl, setSource);
|
|
1352
|
+
SET_PROTOTYPE_METHOD(tpl, setSourceSurface);
|
|
1353
|
+
SET_PROTOTYPE_METHOD(tpl, getSource);
|
|
1354
|
+
SET_PROTOTYPE_METHOD(tpl, setAntialias);
|
|
1355
|
+
SET_PROTOTYPE_METHOD(tpl, getAntialias);
|
|
1356
|
+
SET_PROTOTYPE_METHOD(tpl, getDashCount);
|
|
1357
|
+
SET_PROTOTYPE_METHOD(tpl, getDash);
|
|
1358
|
+
SET_PROTOTYPE_METHOD(tpl, setFillRule);
|
|
1359
|
+
SET_PROTOTYPE_METHOD(tpl, getFillRule);
|
|
1360
|
+
SET_PROTOTYPE_METHOD(tpl, setLineCap);
|
|
1361
|
+
SET_PROTOTYPE_METHOD(tpl, getLineCap);
|
|
1362
|
+
SET_PROTOTYPE_METHOD(tpl, setLineJoin);
|
|
1363
|
+
SET_PROTOTYPE_METHOD(tpl, getLineJoin);
|
|
1364
|
+
SET_PROTOTYPE_METHOD(tpl, setLineWidth);
|
|
1365
|
+
SET_PROTOTYPE_METHOD(tpl, getLineWidth);
|
|
1366
|
+
SET_PROTOTYPE_METHOD(tpl, setMiterLimit);
|
|
1367
|
+
SET_PROTOTYPE_METHOD(tpl, getMiterLimit);
|
|
1368
|
+
SET_PROTOTYPE_METHOD(tpl, setOperator);
|
|
1369
|
+
SET_PROTOTYPE_METHOD(tpl, getOperator);
|
|
1370
|
+
SET_PROTOTYPE_METHOD(tpl, setTolerance);
|
|
1371
|
+
SET_PROTOTYPE_METHOD(tpl, getTolerance);
|
|
1372
|
+
SET_PROTOTYPE_METHOD(tpl, clip);
|
|
1373
|
+
SET_PROTOTYPE_METHOD(tpl, clipPreserve);
|
|
1374
|
+
SET_PROTOTYPE_METHOD(tpl, clipExtents);
|
|
1375
|
+
SET_PROTOTYPE_METHOD(tpl, inClip);
|
|
1376
|
+
SET_PROTOTYPE_METHOD(tpl, resetClip);
|
|
1377
|
+
SET_PROTOTYPE_METHOD(tpl, copyClipRectangleList);
|
|
1378
|
+
SET_PROTOTYPE_METHOD(tpl, fill);
|
|
1379
|
+
SET_PROTOTYPE_METHOD(tpl, fillPreserve);
|
|
1380
|
+
SET_PROTOTYPE_METHOD(tpl, fillExtents);
|
|
1381
|
+
SET_PROTOTYPE_METHOD(tpl, inFill);
|
|
1382
|
+
SET_PROTOTYPE_METHOD(tpl, mask);
|
|
1383
|
+
SET_PROTOTYPE_METHOD(tpl, maskSurface);
|
|
1384
|
+
SET_PROTOTYPE_METHOD(tpl, paint);
|
|
1385
|
+
SET_PROTOTYPE_METHOD(tpl, paintWithAlpha);
|
|
1386
|
+
SET_PROTOTYPE_METHOD(tpl, stroke);
|
|
1387
|
+
SET_PROTOTYPE_METHOD(tpl, strokePreserve);
|
|
1388
|
+
SET_PROTOTYPE_METHOD(tpl, strokeExtents);
|
|
1389
|
+
SET_PROTOTYPE_METHOD(tpl, inStroke);
|
|
1390
|
+
SET_PROTOTYPE_METHOD(tpl, copyPage);
|
|
1391
|
+
SET_PROTOTYPE_METHOD(tpl, showPage);
|
|
1392
|
+
SET_PROTOTYPE_METHOD(tpl, getReferenceCount);
|
|
1393
|
+
SET_PROTOTYPE_METHOD(tpl, copyPath);
|
|
1394
|
+
SET_PROTOTYPE_METHOD(tpl, copyPathFlat);
|
|
1395
|
+
SET_PROTOTYPE_METHOD(tpl, appendPath);
|
|
1396
|
+
SET_PROTOTYPE_METHOD(tpl, hasCurrentPoint);
|
|
1397
|
+
SET_PROTOTYPE_METHOD(tpl, getCurrentPoint);
|
|
1398
|
+
SET_PROTOTYPE_METHOD(tpl, newPath);
|
|
1399
|
+
SET_PROTOTYPE_METHOD(tpl, newSubPath);
|
|
1400
|
+
SET_PROTOTYPE_METHOD(tpl, closePath);
|
|
1401
|
+
SET_PROTOTYPE_METHOD(tpl, arc);
|
|
1402
|
+
SET_PROTOTYPE_METHOD(tpl, arcNegative);
|
|
1403
|
+
SET_PROTOTYPE_METHOD(tpl, curveTo);
|
|
1404
|
+
SET_PROTOTYPE_METHOD(tpl, lineTo);
|
|
1405
|
+
SET_PROTOTYPE_METHOD(tpl, moveTo);
|
|
1406
|
+
SET_PROTOTYPE_METHOD(tpl, rectangle);
|
|
1407
|
+
SET_PROTOTYPE_METHOD(tpl, glyphPath);
|
|
1408
|
+
SET_PROTOTYPE_METHOD(tpl, textPath);
|
|
1409
|
+
SET_PROTOTYPE_METHOD(tpl, relCurveTo);
|
|
1410
|
+
SET_PROTOTYPE_METHOD(tpl, relLineTo);
|
|
1411
|
+
SET_PROTOTYPE_METHOD(tpl, relMoveTo);
|
|
1412
|
+
SET_PROTOTYPE_METHOD(tpl, pathExtents);
|
|
1413
|
+
SET_PROTOTYPE_METHOD(tpl, showText);
|
|
1414
|
+
SET_PROTOTYPE_METHOD(tpl, showGlyphs);
|
|
1415
|
+
SET_PROTOTYPE_METHOD(tpl, showTextGlyphs);
|
|
1416
|
+
SET_PROTOTYPE_METHOD(tpl, fontExtents);
|
|
1417
|
+
SET_PROTOTYPE_METHOD(tpl, textExtents);
|
|
1418
|
+
SET_PROTOTYPE_METHOD(tpl, glyphExtents);
|
|
1419
|
+
SET_PROTOTYPE_METHOD(tpl, selectFontFace);
|
|
1420
|
+
SET_PROTOTYPE_METHOD(tpl, setFontSize);
|
|
1421
|
+
SET_PROTOTYPE_METHOD(tpl, setFontMatrix);
|
|
1422
|
+
SET_PROTOTYPE_METHOD(tpl, getFontMatrix);
|
|
1423
|
+
SET_PROTOTYPE_METHOD(tpl, setFontOptions);
|
|
1424
|
+
SET_PROTOTYPE_METHOD(tpl, getFontOptions);
|
|
1425
|
+
SET_PROTOTYPE_METHOD(tpl, setFontFace);
|
|
1426
|
+
SET_PROTOTYPE_METHOD(tpl, getFontFace);
|
|
1427
|
+
SET_PROTOTYPE_METHOD(tpl, setScaledFont);
|
|
1428
|
+
SET_PROTOTYPE_METHOD(tpl, getScaledFont);
|
|
1429
|
+
SET_PROTOTYPE_METHOD(tpl, translate);
|
|
1430
|
+
SET_PROTOTYPE_METHOD(tpl, scale);
|
|
1431
|
+
SET_PROTOTYPE_METHOD(tpl, rotate);
|
|
1432
|
+
SET_PROTOTYPE_METHOD(tpl, transform);
|
|
1433
|
+
SET_PROTOTYPE_METHOD(tpl, setMatrix);
|
|
1434
|
+
SET_PROTOTYPE_METHOD(tpl, getMatrix);
|
|
1435
|
+
SET_PROTOTYPE_METHOD(tpl, identityMatrix);
|
|
1436
|
+
SET_PROTOTYPE_METHOD(tpl, userToDevice);
|
|
1437
|
+
SET_PROTOTYPE_METHOD(tpl, userToDeviceDistance);
|
|
1438
|
+
SET_PROTOTYPE_METHOD(tpl, deviceToUser);
|
|
1439
|
+
SET_PROTOTYPE_METHOD(tpl, deviceToUserDistance);
|
|
1442
1440
|
#if CAIRO_VERSION_MAJOR >= 1 && CAIRO_VERSION_MINOR >= 16
|
|
1443
|
-
|
|
1441
|
+
SET_PROTOTYPE_METHOD(tpl, tagBegin);
|
|
1444
1442
|
#endif
|
|
1445
1443
|
#if CAIRO_VERSION_MAJOR >= 1 && CAIRO_VERSION_MINOR >= 16
|
|
1446
|
-
|
|
1444
|
+
SET_PROTOTYPE_METHOD(tpl, tagEnd);
|
|
1447
1445
|
#endif
|
|
1448
1446
|
}
|
|
1449
1447
|
|
|
1450
|
-
#undef SET_METHOD
|
|
1451
|
-
|
|
1452
1448
|
/* </ auto-generated */
|
|
1453
1449
|
|
|
1454
1450
|
static void InstanceDestroyed(const Nan::WeakCallbackInfo<ContextInfo> &info);
|
|
@@ -521,8 +521,6 @@ function getReturn(fn, outArguments) {
|
|
|
521
521
|
|
|
522
522
|
function getAttachMethods(name, functions) {
|
|
523
523
|
return unindent(`
|
|
524
|
-
#define SET_METHOD(tpl, name) Nan::SetPrototypeMethod(tpl, #name, name)
|
|
525
|
-
|
|
526
524
|
static void AttachMethods(Local<FunctionTemplate> tpl) {
|
|
527
525
|
${functions.map(fn =>
|
|
528
526
|
(fn.attributes.version ? (() => {
|
|
@@ -533,12 +531,10 @@ function getAttachMethods(name, functions) {
|
|
|
533
531
|
(micro ? 'CAIRO_VERSION_MICRO >= ' + micro : undefined),
|
|
534
532
|
].filter(Boolean).join(' && ') + '\n '
|
|
535
533
|
})() : '')
|
|
536
|
-
+ `
|
|
534
|
+
+ `SET_PROTOTYPE_METHOD(tpl, ${getJSName(fn.name)});`
|
|
537
535
|
+ (fn.attributes.version ? '\n #endif' : '')
|
|
538
536
|
).join('\n ')}
|
|
539
537
|
}
|
|
540
|
-
|
|
541
|
-
#undef SET_METHOD
|
|
542
538
|
`)
|
|
543
539
|
}
|
|
544
540
|
|
package/src/type.cc
CHANGED
|
@@ -256,13 +256,13 @@ GITypeTag GetStorageType (GITypeInfo *type_info) {
|
|
|
256
256
|
GITypeTag type_tag = g_type_info_get_tag (type_info);
|
|
257
257
|
|
|
258
258
|
if (type_tag == GI_TYPE_TAG_INTERFACE) {
|
|
259
|
-
GIBaseInfo *
|
|
260
|
-
GIInfoType
|
|
259
|
+
GIBaseInfo *iface = g_type_info_get_interface (type_info);
|
|
260
|
+
GIInfoType iface_type = g_base_info_get_type (iface);
|
|
261
261
|
|
|
262
|
-
if (
|
|
263
|
-
type_tag = g_enum_info_get_storage_type ((GIEnumInfo *)
|
|
262
|
+
if (iface_type == GI_INFO_TYPE_ENUM || iface_type == GI_INFO_TYPE_FLAGS)
|
|
263
|
+
type_tag = g_enum_info_get_storage_type ((GIEnumInfo *)iface);
|
|
264
264
|
|
|
265
|
-
g_base_info_unref (
|
|
265
|
+
g_base_info_unref (iface);
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
return type_tag;
|