Skip to content

Commit

Permalink
updated jub3i's code to work with new nan, fixes #153
Browse files Browse the repository at this point in the history
  • Loading branch information
illegalprime committed Jun 1, 2016
1 parent 91cd9ce commit 3f3dc7b
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/robotjs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -683,25 +683,22 @@ NAN_METHOD(getScreenSize)

NAN_METHOD(getXDisplayName)
{
NanScope();

#if defined(USE_X11)
NanReturnValue(NanNew<String>(getXDisplay()));
const char* display = getXDisplay();
info.GetReturnValue().Set(Nan::New<String>(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
}

Expand Down

0 comments on commit 3f3dc7b

Please sign in to comment.