11 #include <Carbon/Carbon.h>
18 "title" :
"Modifier Key",
21 "VuoList_VuoModifierKey",
34 const char *valueAsString =
"";
35 if (json_object_get_type(js) == json_type_string)
36 valueAsString = json_object_get_string(js);
40 if (! strcmp(valueAsString,
"any")) {
41 value = VuoModifierKey_Any;
42 }
else if (! strcmp(valueAsString,
"command")) {
43 value = VuoModifierKey_Command;
44 }
else if (! strcmp(valueAsString,
"option")) {
45 value = VuoModifierKey_Option;
46 }
else if (! strcmp(valueAsString,
"control")) {
47 value = VuoModifierKey_Control;
48 }
else if (! strcmp(valueAsString,
"shift")) {
49 value = VuoModifierKey_Shift;
50 }
else if (! strcmp(valueAsString,
"none")) {
51 value = VuoModifierKey_None;
63 char *valueAsString =
"";
66 case VuoModifierKey_Any:
67 valueAsString =
"any";
69 case VuoModifierKey_Command:
70 valueAsString =
"command";
72 case VuoModifierKey_Option:
73 valueAsString =
"option";
75 case VuoModifierKey_Control:
76 valueAsString =
"control";
78 case VuoModifierKey_Shift:
79 valueAsString =
"shift";
81 case VuoModifierKey_None:
82 valueAsString =
"none";
86 return json_object_new_string(valueAsString);
110 char *valueAsString =
"";
113 case VuoModifierKey_Any:
114 valueAsString =
"Any";
116 case VuoModifierKey_Command:
117 valueAsString =
"Command";
119 case VuoModifierKey_Option:
120 valueAsString =
"Option";
122 case VuoModifierKey_Control:
123 valueAsString =
"Control";
125 case VuoModifierKey_Shift:
126 valueAsString =
"Shift";
128 case VuoModifierKey_None:
129 valueAsString =
"None";
133 return strdup(valueAsString);
141 bool isCommand = (flags & kCGEventFlagMaskCommand);
142 bool isOption = (flags & kCGEventFlagMaskAlternate);
143 bool isControl = (flags & kCGEventFlagMaskControl);
144 bool isShift = (flags & kCGEventFlagMaskShift);
148 case VuoModifierKey_Any:
150 case VuoModifierKey_Command:
152 case VuoModifierKey_Option:
154 case VuoModifierKey_Control:
156 case VuoModifierKey_Shift:
158 case VuoModifierKey_None:
159 return ! isCommand && ! isOption && ! isControl && ! isShift;