12 #include <Carbon/Carbon.h>
19 "title" :
"Modifier Key",
22 "VuoList_VuoModifierKey",
35 const char *valueAsString =
"";
36 if (json_object_get_type(js) == json_type_string)
37 valueAsString = json_object_get_string(js);
41 if (! strcmp(valueAsString,
"any")) {
42 value = VuoModifierKey_Any;
43 }
else if (! strcmp(valueAsString,
"command")) {
44 value = VuoModifierKey_Command;
45 }
else if (! strcmp(valueAsString,
"option")) {
46 value = VuoModifierKey_Option;
47 }
else if (! strcmp(valueAsString,
"control")) {
48 value = VuoModifierKey_Control;
49 }
else if (! strcmp(valueAsString,
"shift")) {
50 value = VuoModifierKey_Shift;
51 }
else if (! strcmp(valueAsString,
"none")) {
52 value = VuoModifierKey_None;
64 char *valueAsString =
"";
67 case VuoModifierKey_Any:
68 valueAsString =
"any";
70 case VuoModifierKey_Command:
71 valueAsString =
"command";
73 case VuoModifierKey_Option:
74 valueAsString =
"option";
76 case VuoModifierKey_Control:
77 valueAsString =
"control";
79 case VuoModifierKey_Shift:
80 valueAsString =
"shift";
82 case VuoModifierKey_None:
83 valueAsString =
"none";
87 return json_object_new_string(valueAsString);
111 char *valueAsString =
"";
114 case VuoModifierKey_Any:
115 valueAsString =
"Any";
117 case VuoModifierKey_Command:
118 valueAsString =
"Command";
120 case VuoModifierKey_Option:
121 valueAsString =
"Option";
123 case VuoModifierKey_Control:
124 valueAsString =
"Control";
126 case VuoModifierKey_Shift:
127 valueAsString =
"Shift";
129 case VuoModifierKey_None:
130 valueAsString =
"None";
134 return strdup(valueAsString);
142 bool isCommand = (flags & kCGEventFlagMaskCommand);
143 bool isOption = (flags & kCGEventFlagMaskAlternate);
144 bool isControl = (flags & kCGEventFlagMaskControl);
145 bool isShift = (flags & kCGEventFlagMaskShift);
149 case VuoModifierKey_Any:
151 case VuoModifierKey_Command:
153 case VuoModifierKey_Option:
155 case VuoModifierKey_Control:
157 case VuoModifierKey_Shift:
159 case VuoModifierKey_None:
160 return ! isCommand && ! isOption && ! isControl && ! isShift;