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/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 = calloc(1, size);
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::SKIP)
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::ARRAY;
175
- call_parameters[length_i].type = ParameterType::SKIP;
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::SKIP;
192
+ call_parameters[i].type = ParameterType::kSKIP;
194
193
  } else {
195
- call_parameters[i].type = ParameterType::CALLBACK;
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::SKIP;
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::SKIP;
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 &param = call_parameters[i];
273
272
 
274
- if (param.type == ParameterType::SKIP)
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
- GIArgument total_arg_values[func->n_total_args];
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::SKIP)
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::ARRAY) {
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::CALLBACK) {
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::SKIP);
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::SKIP);
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::CALLBACK) {
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
- void *ffi_args[func->n_total_args];
452
- for (int i = 0; i < func->n_total_args; i++)
453
- ffi_args[i] = &total_arg_values[i];
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::ARRAY) {
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::CALLBACK) {
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::ARRAY) {
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::NORMAL) {
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
@@ -16,7 +16,7 @@ using v8::String;
16
16
  namespace GNodeJS {
17
17
 
18
18
  enum ParameterType {
19
- NORMAL, ARRAY, SKIP, CALLBACK
19
+ kNORMAL, kARRAY, kSKIP, kCALLBACK
20
20
  };
21
21
 
22
22
  struct Parameter {
package/src/gi.cc CHANGED
@@ -1,4 +1,4 @@
1
- #include <gobject-introspection-1.0/girepository.h>
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
- NAN_EXPORT(exports, Bootstrap);
349
- NAN_EXPORT(exports, GetModuleCache);
350
- NAN_EXPORT(exports, GetBaseClass);
351
- NAN_EXPORT(exports, GetTypeSize);
352
- NAN_EXPORT(exports, GetConstantValue);
353
- NAN_EXPORT(exports, MakeBoxedClass);
354
- NAN_EXPORT(exports, MakeObjectClass);
355
- NAN_EXPORT(exports, MakeFunction);
356
- NAN_EXPORT(exports, StructFieldGetter);
357
- NAN_EXPORT(exports, StructFieldSetter);
358
- NAN_EXPORT(exports, ObjectPropertyGetter);
359
- NAN_EXPORT(exports, ObjectPropertySetter);
360
- NAN_EXPORT(exports, StartLoop);
361
- NAN_EXPORT(exports, GetLoopStack);
362
- NAN_EXPORT(exports, RegisterClass);
363
- NAN_EXPORT(exports, RegisterVFunc);
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
- ulong handler_id;
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
- ulong handler_id = TO_LONG (info[0]);
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 (uint i = 0; i < signal_query.n_params; i++) {
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 (uint i = 0; i < argc; i++) {
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, (unsigned long)address);
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
- SET_METHOD(tpl, status);
1343
- SET_METHOD(tpl, save);
1344
- SET_METHOD(tpl, restore);
1345
- SET_METHOD(tpl, getTarget);
1346
- SET_METHOD(tpl, pushGroup);
1347
- SET_METHOD(tpl, pushGroupWithContent);
1348
- SET_METHOD(tpl, popGroup);
1349
- SET_METHOD(tpl, popGroupToSource);
1350
- SET_METHOD(tpl, getGroupTarget);
1351
- SET_METHOD(tpl, setSourceRgb);
1352
- SET_METHOD(tpl, setSourceRgba);
1353
- SET_METHOD(tpl, setSource);
1354
- SET_METHOD(tpl, setSourceSurface);
1355
- SET_METHOD(tpl, getSource);
1356
- SET_METHOD(tpl, setAntialias);
1357
- SET_METHOD(tpl, getAntialias);
1358
- SET_METHOD(tpl, getDashCount);
1359
- SET_METHOD(tpl, getDash);
1360
- SET_METHOD(tpl, setFillRule);
1361
- SET_METHOD(tpl, getFillRule);
1362
- SET_METHOD(tpl, setLineCap);
1363
- SET_METHOD(tpl, getLineCap);
1364
- SET_METHOD(tpl, setLineJoin);
1365
- SET_METHOD(tpl, getLineJoin);
1366
- SET_METHOD(tpl, setLineWidth);
1367
- SET_METHOD(tpl, getLineWidth);
1368
- SET_METHOD(tpl, setMiterLimit);
1369
- SET_METHOD(tpl, getMiterLimit);
1370
- SET_METHOD(tpl, setOperator);
1371
- SET_METHOD(tpl, getOperator);
1372
- SET_METHOD(tpl, setTolerance);
1373
- SET_METHOD(tpl, getTolerance);
1374
- SET_METHOD(tpl, clip);
1375
- SET_METHOD(tpl, clipPreserve);
1376
- SET_METHOD(tpl, clipExtents);
1377
- SET_METHOD(tpl, inClip);
1378
- SET_METHOD(tpl, resetClip);
1379
- SET_METHOD(tpl, copyClipRectangleList);
1380
- SET_METHOD(tpl, fill);
1381
- SET_METHOD(tpl, fillPreserve);
1382
- SET_METHOD(tpl, fillExtents);
1383
- SET_METHOD(tpl, inFill);
1384
- SET_METHOD(tpl, mask);
1385
- SET_METHOD(tpl, maskSurface);
1386
- SET_METHOD(tpl, paint);
1387
- SET_METHOD(tpl, paintWithAlpha);
1388
- SET_METHOD(tpl, stroke);
1389
- SET_METHOD(tpl, strokePreserve);
1390
- SET_METHOD(tpl, strokeExtents);
1391
- SET_METHOD(tpl, inStroke);
1392
- SET_METHOD(tpl, copyPage);
1393
- SET_METHOD(tpl, showPage);
1394
- SET_METHOD(tpl, getReferenceCount);
1395
- SET_METHOD(tpl, copyPath);
1396
- SET_METHOD(tpl, copyPathFlat);
1397
- SET_METHOD(tpl, appendPath);
1398
- SET_METHOD(tpl, hasCurrentPoint);
1399
- SET_METHOD(tpl, getCurrentPoint);
1400
- SET_METHOD(tpl, newPath);
1401
- SET_METHOD(tpl, newSubPath);
1402
- SET_METHOD(tpl, closePath);
1403
- SET_METHOD(tpl, arc);
1404
- SET_METHOD(tpl, arcNegative);
1405
- SET_METHOD(tpl, curveTo);
1406
- SET_METHOD(tpl, lineTo);
1407
- SET_METHOD(tpl, moveTo);
1408
- SET_METHOD(tpl, rectangle);
1409
- SET_METHOD(tpl, glyphPath);
1410
- SET_METHOD(tpl, textPath);
1411
- SET_METHOD(tpl, relCurveTo);
1412
- SET_METHOD(tpl, relLineTo);
1413
- SET_METHOD(tpl, relMoveTo);
1414
- SET_METHOD(tpl, pathExtents);
1415
- SET_METHOD(tpl, showText);
1416
- SET_METHOD(tpl, showGlyphs);
1417
- SET_METHOD(tpl, showTextGlyphs);
1418
- SET_METHOD(tpl, fontExtents);
1419
- SET_METHOD(tpl, textExtents);
1420
- SET_METHOD(tpl, glyphExtents);
1421
- SET_METHOD(tpl, selectFontFace);
1422
- SET_METHOD(tpl, setFontSize);
1423
- SET_METHOD(tpl, setFontMatrix);
1424
- SET_METHOD(tpl, getFontMatrix);
1425
- SET_METHOD(tpl, setFontOptions);
1426
- SET_METHOD(tpl, getFontOptions);
1427
- SET_METHOD(tpl, setFontFace);
1428
- SET_METHOD(tpl, getFontFace);
1429
- SET_METHOD(tpl, setScaledFont);
1430
- SET_METHOD(tpl, getScaledFont);
1431
- SET_METHOD(tpl, translate);
1432
- SET_METHOD(tpl, scale);
1433
- SET_METHOD(tpl, rotate);
1434
- SET_METHOD(tpl, transform);
1435
- SET_METHOD(tpl, setMatrix);
1436
- SET_METHOD(tpl, getMatrix);
1437
- SET_METHOD(tpl, identityMatrix);
1438
- SET_METHOD(tpl, userToDevice);
1439
- SET_METHOD(tpl, userToDeviceDistance);
1440
- SET_METHOD(tpl, deviceToUser);
1441
- SET_METHOD(tpl, deviceToUserDistance);
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
- SET_METHOD(tpl, tagBegin);
1441
+ SET_PROTOTYPE_METHOD(tpl, tagBegin);
1444
1442
  #endif
1445
1443
  #if CAIRO_VERSION_MAJOR >= 1 && CAIRO_VERSION_MINOR >= 16
1446
- SET_METHOD(tpl, tagEnd);
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
- + `SET_METHOD(tpl, ${getJSName(fn.name)});`
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 *interface = g_type_info_get_interface (type_info);
260
- GIInfoType interface_type = g_base_info_get_type (interface);
259
+ GIBaseInfo *iface = g_type_info_get_interface (type_info);
260
+ GIInfoType iface_type = g_base_info_get_type (iface);
261
261
 
262
- if (interface_type == GI_INFO_TYPE_ENUM || interface_type == GI_INFO_TYPE_FLAGS)
263
- type_tag = g_enum_info_get_storage_type ((GIEnumInfo *)interface);
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 (interface);
265
+ g_base_info_unref (iface);
266
266
  }
267
267
 
268
268
  return type_tag;
package/src/util.h CHANGED
@@ -55,9 +55,7 @@ inline void SetProtoAccessor(
55
55
  setter,
56
56
  v8::Local<v8::Value>(),
57
57
  v8::DEFAULT,
58
- v8::None,
59
- v8::AccessorSignature::New(v8::Isolate::GetCurrent(), ctor)
60
- );
58
+ v8::None);
61
59
  }
62
60
 
63
61
  namespace Util