diff --git a/src/robotjs.cc b/src/robotjs.cc index 7585fffb..9ec94425 100644 --- a/src/robotjs.cc +++ b/src/robotjs.cc @@ -683,10 +683,9 @@ 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"); #endif @@ -694,12 +693,10 @@ NAN_METHOD(getXDisplayName) 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"); #endif