Skip to content

Commit

Permalink
Fixed code style.
Browse files Browse the repository at this point in the history
Tabs for indentation.
  • Loading branch information
octalmage committed Jan 30, 2015
1 parent 9f97237 commit de175e7
Showing 1 changed file with 45 additions and 45 deletions.
90 changes: 45 additions & 45 deletions src/robotjs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,42 @@ using namespace v8;

NAN_METHOD(moveMouse)
{
NanScope();
if (args.Length() < 2)
{
return NanThrowError("Invalid number of arguments");
}
size_t x = args[0]->Int32Value();
size_t y = args[1]->Int32Value();

MMPoint point;
point = MMPointMake(x, y);
moveMouse(point);
NanReturnValue(NanNew("1"));
NanScope();
if (args.Length() < 2)
{
return NanThrowError("Invalid number of arguments");
}
size_t x = args[0]->Int32Value();
size_t y = args[1]->Int32Value();

MMPoint point;
point = MMPointMake(x, y);
moveMouse(point);
NanReturnValue(NanNew("1"));
}

NAN_METHOD(getMousePos)
{
NanScope();
NanScope();

MMPoint pos = getMousePos();
MMPoint pos = getMousePos();

//Return object with .x and .y.
Local<Object> obj = NanNew<Object>();
obj->Set(NanNew<String>("x"), NanNew<Number>(pos.x));
obj->Set(NanNew<String>("y"), NanNew<Number>(pos.y));
NanReturnValue(obj);
//Return object with .x and .y.
Local<Object> obj = NanNew<Object>();
obj->Set(NanNew<String>("x"), NanNew<Number>(pos.x));
obj->Set(NanNew<String>("y"), NanNew<Number>(pos.y));
NanReturnValue(obj);
}

NAN_METHOD(mouseClick)
{
NanScope();
NanScope();

MMMouseButton button = LEFT_BUTTON;
MMMouseButton button = LEFT_BUTTON;

clickMouse(button);
clickMouse(button);

NanReturnValue(NanNew("1"));
NanReturnValue(NanNew("1"));
}

/*
Expand All @@ -68,48 +68,48 @@ NAN_METHOD(mouseClick)

NAN_METHOD (keyTap)
{
NanScope();
NanScope();

MMKeyFlags flags = MOD_NONE;
MMKeyFlags flags = MOD_NONE;

const char c = (*v8::String::Utf8Value(args[0]->ToString()))[0];
const char c = (*v8::String::Utf8Value(args[0]->ToString()))[0];

tapKey(c, flags);
tapKey(c, flags);

NanReturnValue(NanNew("1"));
NanReturnValue(NanNew("1"));
}

NAN_METHOD (typeString)
{
NanScope();
char *str;
NanUtf8String string(args[0]);
NanScope();

char *str;
NanUtf8String string(args[0]);

str= *string;
str = *string;

typeString(str);
typeString(str);

NanReturnValue(NanNew("1"));
NanReturnValue(NanNew("1"));
}

void init(Handle<Object> target)
{

target->Set(NanNew<String>("moveMouse"),
NanNew<FunctionTemplate>(moveMouse)->GetFunction());
target->Set(NanNew<String>("moveMouse"),
NanNew<FunctionTemplate>(moveMouse)->GetFunction());

target->Set(NanNew<String>("getMousePos"),
NanNew<FunctionTemplate>(getMousePos)->GetFunction());
target->Set(NanNew<String>("getMousePos"),
NanNew<FunctionTemplate>(getMousePos)->GetFunction());

target->Set(NanNew<String>("mouseClick"),
NanNew<FunctionTemplate>(mouseClick)->GetFunction());
target->Set(NanNew<String>("mouseClick"),
NanNew<FunctionTemplate>(mouseClick)->GetFunction());

target->Set(NanNew<String>("keyTap"),
NanNew<FunctionTemplate>(keyTap)->GetFunction());
target->Set(NanNew<String>("keyTap"),
NanNew<FunctionTemplate>(keyTap)->GetFunction());

target->Set(NanNew<String>("typeString"),
NanNew<FunctionTemplate>(typeString)->GetFunction());
target->Set(NanNew<String>("typeString"),
NanNew<FunctionTemplate>(typeString)->GetFunction());

}

Expand Down

0 comments on commit de175e7

Please sign in to comment.