diff --git a/src/robotjs.cc b/src/robotjs.cc index 7585fffb..7c1e668d 100644 --- a/src/robotjs.cc +++ b/src/robotjs.cc @@ -683,25 +683,22 @@ NAN_METHOD(getScreenSize) NAN_METHOD(getXDisplayName) { - NanScope(); - #if defined(USE_X11) - NanReturnValue(NanNew(getXDisplay())); + const char* display = getXDisplay(); + info.GetReturnValue().Set(Nan::New(display).ToLocalChecked()); #else - NanThrowError("getXDisplayName is only supported on Linux"); + Nan::ThrowError("getXDisplayName is only supported on Linux"); #endif } NAN_METHOD(setXDisplayName) { - NanScope(); - #if defined(USE_X11) - NanUtf8String name(args[0]); - setXDisplay(*name); - NanReturnValue(NanNew("1")); + Nan::Utf8String string(info[0]); + setXDisplay(*string); + info.GetReturnValue().Set(Nan::New(1)); #else - NanThrowError("setXDisplayName is only supported on Linux"); + Nan::ThrowError("setXDisplayName is only supported on Linux"); #endif }