Skip to content

Commit

Permalink
fixing whitespaces caused by editor-settings
Browse files Browse the repository at this point in the history
  • Loading branch information
chaosprinz committed May 1, 2016
1 parent 3ce729f commit 037abf3
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 45 deletions.
4 changes: 2 additions & 2 deletions src/keycode.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "os.h"

#ifdef __cplusplus
extern "C"
extern "C"
{
#endif

Expand All @@ -14,7 +14,7 @@ extern "C"
#include <Carbon/Carbon.h> /* Really only need <HIToolbox/Events.h> */
#include <ApplicationServices/ApplicationServices.h>
#import <IOKit/hidsystem/ev_keymap.h>

enum _MMKeyCode {
K_NOT_A_KEY = 9999,
K_BACKSPACE = kVK_Delete,
Expand Down
86 changes: 43 additions & 43 deletions src/robotjs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ int mouseDelay = 10;
int keyboardDelay = 10;

/*
__ __
| \/ | ___ _ _ ___ ___
__ __
| \/ | ___ _ _ ___ ___
| |\/| |/ _ \| | | / __|/ _ \
| | | | (_) | |_| \__ \ __/
|_| |_|\___/ \__,_|___/\___|
Expand Down Expand Up @@ -238,21 +238,21 @@ NAN_METHOD(setMouseDelay)
info.GetReturnValue().Set(Nan::New(1));
}

NAN_METHOD(scrollMouse)
NAN_METHOD(scrollMouse)
{
Nan::HandleScope scope;

//Get the values of magnitude and direction from the arguments list.
if(info.Length() == 2)
if(info.Length() == 2)
{
int scrollMagnitude = info[0]->Int32Value();
char *s;

Nan::Utf8String sstr(info[1]);
s = *sstr;

MMMouseWheelDirection scrollDirection;

if (strcmp(s, "up") == 0)
{
scrollDirection = DIRECTION_UP;
Expand All @@ -265,26 +265,26 @@ NAN_METHOD(scrollMouse)
{
return Nan::ThrowError("Invalid scroll direction specified.");
}

scrollMouse(scrollMagnitude, scrollDirection);
microsleep(mouseDelay);

info.GetReturnValue().Set(Nan::New(1));
}
else
}
else
{
return Nan::ThrowError("Invalid number of arguments.");
}
}
/*
_ __ _ _
_ __ _ _
| |/ /___ _ _| |__ ___ __ _ _ __ __| |
| ' // _ \ | | | '_ \ / _ \ / _` | '__/ _` |
| . \ __/ |_| | |_) | (_) | (_| | | | (_| |
|_|\_\___|\__, |_.__/ \___/ \__,_|_| \__,_|
|___/
|___/
*/
struct KeyNames
struct KeyNames
{
const char* name;
MMKeyCode key;
Expand Down Expand Up @@ -324,7 +324,7 @@ static KeyNames key_names[] =
{ "space", K_SPACE },
{ "printscreen", K_PRINTSCREEN },
{ "insert", K_INSERT },

{ "audio_mute", K_AUDIO_VOLUME_MUTE },
{ "audio_vol_down", K_AUDIO_VOLUME_DOWN },
{ "audio_vol_up", K_AUDIO_VOLUME_UP },
Expand All @@ -337,7 +337,7 @@ static KeyNames key_names[] =
{ "audio_forward", K_AUDIO_FORWARD },
{ "audio_repeat", K_AUDIO_REPEAT },
{ "audio_random", K_AUDIO_RANDOM },

{ "lights_mon_up", K_LIGHTS_MON_UP },
{ "lights_mon_down", K_LIGHTS_MON_DOWN },
{ "lights_kbd_toggle",K_LIGHTS_KBD_TOGGLE },
Expand All @@ -360,7 +360,7 @@ int CheckKeyCodes(char* k, MMKeyCode *key)
*key = K_NOT_A_KEY;

KeyNames* kn = key_names;
while (kn->name)
while (kn->name)
{
if (strcmp(k, kn->name) == 0)
{
Expand All @@ -370,7 +370,7 @@ int CheckKeyCodes(char* k, MMKeyCode *key)
kn++;
}

if (*key == K_NOT_A_KEY)
if (*key == K_NOT_A_KEY)
{
return -2;
}
Expand Down Expand Up @@ -578,9 +578,9 @@ NAN_METHOD(typeStringDelayed)
{
char *str;
Nan::Utf8String string(info[0]);

str = *string;

size_t cpm = info[1]->Int32Value();

typeStringDelayed(str, cpm);
Expand All @@ -601,12 +601,12 @@ NAN_METHOD(setKeyboardDelay)
}

/*
____
/ ___| ___ _ __ ___ ___ _ __
\___ \ / __| '__/ _ \/ _ \ '_ \
____
/ ___| ___ _ __ ___ ___ _ __
\___ \ / __| '__/ _ \/ _ \ '_ \
___) | (__| | | __/ __/ | | |
|____/ \___|_| \___|\___|_| |_|
*/

/**
Expand All @@ -627,7 +627,7 @@ NAN_METHOD(getPixelColor)
{
return Nan::ThrowError("Invalid number of arguments.");
}

MMBitmapRef bitmap;
MMRGBHex color;

Expand All @@ -642,9 +642,9 @@ NAN_METHOD(getPixelColor)
bitmap = copyMMBitmapFromDisplayInRect(MMRectMake(x, y, 1, 1));

color = MMRGBHexAtPoint(bitmap, 0, 0);

char hex[7];

padHex(color, hex);

destroyMMBitmap(bitmap);
Expand All @@ -666,18 +666,18 @@ NAN_METHOD(getScreenSize)
info.GetReturnValue().Set(obj);
}

NAN_METHOD(captureScreen)
NAN_METHOD(captureScreen)
{
size_t x;
size_t y;
size_t w;
size_t h;

//If user has provided screen coords, use them!
//If user has provided screen coords, use them!
if (info.Length() == 4)
{
//TODO: Make sure requested coords are within the screen bounds, or we get a seg fault.
// An error message is much nicer!
// An error message is much nicer!

x = info[0]->Int32Value();
y = info[1]->Int32Value();
Expand All @@ -689,15 +689,15 @@ NAN_METHOD(captureScreen)
//We're getting the full screen.
x = 0;
y = 0;

//Get screen size.
MMSize displaySize = getMainDisplaySize();
w = displaySize.width;
h = displaySize.height;
}

MMBitmapRef bitmap = copyMMBitmapFromDisplayInRect(MMRectMake(x, y, w, h));

uint32_t bufferSize = bitmap->bytewidth * bitmap->height;
Local<Object> buffer = Nan::NewBuffer((char*)bitmap->imageBuffer, bufferSize, destroyMMBitmapBuffer, NULL).ToLocalChecked();

Expand All @@ -708,17 +708,17 @@ NAN_METHOD(captureScreen)
Nan::Set(obj, Nan::New("bitsPerPixel").ToLocalChecked(), Nan::New<Number>(bitmap->bitsPerPixel));
Nan::Set(obj, Nan::New("bytesPerPixel").ToLocalChecked(), Nan::New<Number>(bitmap->bytesPerPixel));
Nan::Set(obj, Nan::New("image").ToLocalChecked(), buffer);

info.GetReturnValue().Set(obj);
}

/*
____ _ _
| __ )(_) |_ _ __ ___ __ _ _ __
| _ \| | __| '_ ` _ \ / _` | '_ \
____ _ _
| __ )(_) |_ _ __ ___ __ _ _ __
| _ \| | __| '_ ` _ \ / _` | '_ \
| |_) | | |_| | | | | | (_| | |_) |
|____/|_|\__|_| |_| |_|\__,_| .__/
|_|
|____/|_|\__|_| |_| |_|\__,_| .__/
|_|
*/

class BMP
Expand All @@ -733,7 +733,7 @@ class BMP
};

//Convert object from Javascript to a C++ class (BMP).
BMP buildBMP(Local<Object> info)
BMP buildBMP(Local<Object> info)
{
Local<Object> obj = Nan::To<v8::Object>(info).ToLocalChecked();

Expand Down Expand Up @@ -805,7 +805,7 @@ NAN_MODULE_INIT(InitAll)

Nan::Set(target, Nan::New("mouseToggle").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(mouseToggle)).ToLocalChecked());

Nan::Set(target, Nan::New("scrollMouse").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(scrollMouse)).ToLocalChecked());

Expand All @@ -832,10 +832,10 @@ NAN_MODULE_INIT(InitAll)

Nan::Set(target, Nan::New("getScreenSize").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(getScreenSize)).ToLocalChecked());

Nan::Set(target, Nan::New("captureScreen").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(captureScreen)).ToLocalChecked());

Nan::Set(target, Nan::New("getColor").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(getColor)).ToLocalChecked());
}
Expand Down

0 comments on commit 037abf3

Please sign in to comment.