Skip to content

Commit

Permalink
fix os compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jub3i authored and illegalprime committed Jun 1, 2016
1 parent 9257211 commit 91cd9ce
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/robotjs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#include "MMBitmap.h"
#include "snprintf.h"
#include "microsleep.h"
#include "xdisplay.h"
#if defined(USE_X11)
#include "xdisplay.h"
#endif

using namespace v8;

Expand Down Expand Up @@ -682,17 +684,25 @@ NAN_METHOD(getScreenSize)
NAN_METHOD(getXDisplayName)
{
NanScope();

#if defined(USE_X11)
NanReturnValue(NanNew<String>(getXDisplay()));
#else
NanThrowError("getXDisplayName is only supported on Linux");
#endif
}

NAN_METHOD(setXDisplayName)
{
NanScope();

#if defined(USE_X11)
NanUtf8String name(args[0]);
setXDisplay(*name);

NanReturnUndefined();
NanReturnValue(NanNew("1"));
#else
NanThrowError("setXDisplayName is only supported on Linux");
#endif
}

NAN_METHOD(captureScreen)
Expand Down

0 comments on commit 91cd9ce

Please sign in to comment.