From 91cd9ce9ef54575d1ef80724eea94bfce1d73e15 Mon Sep 17 00:00:00 2001 From: jub3i Date: Thu, 16 Jul 2015 12:06:17 +0200 Subject: [PATCH] fix os compatibility --- src/robotjs.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/robotjs.cc b/src/robotjs.cc index b03d5742..7585fffb 100644 --- a/src/robotjs.cc +++ b/src/robotjs.cc @@ -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; @@ -682,17 +684,25 @@ NAN_METHOD(getScreenSize) NAN_METHOD(getXDisplayName) { NanScope(); + + #if defined(USE_X11) NanReturnValue(NanNew(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)