Skip to content
This repository was archived by the owner on Mar 12, 2022. It is now read-only.

Commit 0b5321f

Browse files
committed
update to be coroutine friendly; see HS pull #2308
1 parent a5c81ee commit 0b5321f

File tree

6 files changed

+165
-126
lines changed

6 files changed

+165
-126
lines changed

Diff for: CGSConnection.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
/*
22
* Copyright (C) 2007-2008 Alacatia Labs
3-
*
3+
*
44
* This software is provided 'as-is', without any express or implied
55
* warranty. In no event will the authors be held liable for any damages
66
* arising from the use of this software.
7-
*
7+
*
88
* Permission is granted to anyone to use this software for any purpose,
99
* including commercial applications, and to alter it and redistribute it
1010
* freely, subject to the following restrictions:
11-
*
11+
*
1212
* 1. The origin of this software must not be misrepresented; you must not
1313
* claim that you wrote the original software. If you use this software
1414
* in a product, an acknowledgment in the product documentation would be
1515
* appreciated but is not required.
1616
* 2. Altered source versions must be plainly marked as such, and must not be
1717
* misrepresented as being the original software.
1818
* 3. This notice may not be removed or altered from any source distribution.
19-
*
19+
*
2020
* Joe Ranieri joe@alacatia.com
2121
*
2222
*/
@@ -230,7 +230,7 @@ CG_EXTERN CGError CGSSetLoginwindowConnection(CGSConnectionID cid) AVAILABLE_MAC
230230

231231
//! The data sent with kCGSNotificationAppUnresponsive and kCGSNotificationAppResponsive.
232232
typedef struct {
233-
#if __BIG_ENDIAN__
233+
#ifdef __BIG_ENDIAN__
234234
uint16_t majorVersion;
235235
uint16_t minorVersion;
236236
#else

Diff for: Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
22
current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
33

4-
MODULE := $(current_dir)
4+
MODULE := $(lastword $(subst ., ,$(current_dir)))
55
PREFIX ?= ~/.hammerspoon
66
MODPATH = hs/_asm/undocumented
77
VERSION ?= 0.x
@@ -35,8 +35,8 @@ ALLFILES += $(SOFILE)
3535

3636
#CC=cc
3737
CC=@clang
38-
WARNINGS ?= -Weverything -Wno-objc-missing-property-synthesis -Wno-implicit-atomic-properties -Wno-direct-ivar-access -Wno-cstring-format-directive -Wno-padded -Wno-covered-switch-default -Wno-missing-prototypes -Werror-implicit-function-declaration
39-
EXTRA_CFLAGS ?= -F$(HS_APPLICATION)/Hammerspoon.app/Contents/Frameworks -mmacosx-version-min=10.10
38+
WARNINGS ?= -Weverything -Wno-objc-missing-property-synthesis -Wno-implicit-atomic-properties -Wno-direct-ivar-access -Wno-cstring-format-directive -Wno-padded -Wno-covered-switch-default -Wno-missing-prototypes -Werror-implicit-function-declaration -Wno-documentation-unknown-command
39+
EXTRA_CFLAGS ?= -F$(HS_APPLICATION)/Hammerspoon.app/Contents/Frameworks -mmacosx-version-min=10.12
4040

4141
CFLAGS += $(DEBUG_CFLAGS) -fmodules -fobjc-arc -DHS_EXTERNAL_MODULE $(WARNINGS) $(EXTRA_CFLAGS)
4242
LDFLAGS += -dynamiclib -undefined dynamic_lookup $(EXTRA_LDFLAGS)

Diff for: docs.json

+70-69
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@
88
],
99
"Function" : [
1010
{
11-
"parameters" : [
12-
13-
],
11+
"name" : "count",
1412
"stripped_doc" : [
1513
"LEGACY: The number of spaces you currently have.",
1614
""
1715
],
16+
"def" : "hs._asm.undocumented.spaces.count() -> number",
1817
"doc" : "LEGACY: The number of spaces you currently have.\n\nNotes:\n * this function may go away in a future update\n\n * this functions is included for backwards compatibility. It is not recommended because it worked by indexing the spaces ignoring that fullscreen applications are included in the list twice, and only worked with one monitor. Use `hs._asm.undocumented.spaces.query` or `hs._asm.undocumented.spaces.spacesByScreenUUID`.",
19-
"desc" : "LEGACY: The number of spaces you currently have.",
2018
"notes" : [
2119
" * this function may go away in a future update",
2220
"",
@@ -27,19 +25,19 @@
2725
"returns" : [
2826

2927
],
30-
"def" : "hs._asm.undocumented.spaces.count() -> number",
31-
"name" : "count"
32-
},
33-
{
28+
"desc" : "LEGACY: The number of spaces you currently have.",
3429
"parameters" : [
3530

36-
],
31+
]
32+
},
33+
{
34+
"name" : "currentSpace",
3735
"stripped_doc" : [
3836
"LEGACY: The index of the space you're currently on, 1-indexed (as usual).",
3937
""
4038
],
39+
"def" : "hs._asm.undocumented.spaces.currentSpace() -> number",
4140
"doc" : "LEGACY: The index of the space you're currently on, 1-indexed (as usual).\n\nNotes:\n * this function may go away in a future update\n\n * this functions is included for backwards compatibility. It is not recommended because it worked by indexing the spaces, which can be rearranged by the operating system anyways. Use `hs._asm.undocumented.spaces.query` or `hs._asm.undocumented.spaces.spacesByScreenUUID`.",
42-
"desc" : "LEGACY: The index of the space you're currently on, 1-indexed (as usual).",
4341
"notes" : [
4442
" * this function may go away in a future update",
4543
"",
@@ -50,19 +48,19 @@
5048
"returns" : [
5149

5250
],
53-
"def" : "hs._asm.undocumented.spaces.currentSpace() -> number",
54-
"name" : "currentSpace"
55-
},
56-
{
51+
"desc" : "LEGACY: The index of the space you're currently on, 1-indexed (as usual).",
5752
"parameters" : [
5853

59-
],
54+
]
55+
},
56+
{
57+
"name" : "moveToSpace",
6058
"stripped_doc" : [
6159
"LEGACY: Switches to the space at the given index, 1-indexed (as usual).",
6260
""
6361
],
62+
"def" : "hs._asm.undocumented.spaces.moveToSpace(number)",
6463
"doc" : "LEGACY: Switches to the space at the given index, 1-indexed (as usual).\n\nNotes:\n * this function may go away in a future update\n\n * this functions is included for backwards compatibility. It is not recommended because it was never really reliable and worked by indexing the spaces, which can be rearranged by the operating system anyways. Use `hs._asm.undocumented.spaces.changeToSpace`.",
65-
"desc" : "LEGACY: Switches to the space at the given index, 1-indexed (as usual).",
6664
"notes" : [
6765
" * this function may go away in a future update",
6866
"",
@@ -73,20 +71,19 @@
7371
"returns" : [
7472

7573
],
76-
"def" : "hs._asm.undocumented.spaces.moveToSpace(number)",
77-
"name" : "moveToSpace"
74+
"desc" : "LEGACY: Switches to the space at the given index, 1-indexed (as usual).",
75+
"parameters" : [
76+
77+
]
7878
},
7979
{
80-
"parameters" : [
81-
" * screen - an optional hs.screen object specifying the specific monitor to check the animation status for.",
82-
""
83-
],
80+
"name" : "isAnimating",
8481
"stripped_doc" : [
8582
"Returns the state of space changing animation for the specified monitor, or for any monitor if no parameter is specified.",
8683
""
8784
],
85+
"def" : "hs._asm.undocumented.spaces.isAnimating([screen]) -> bool",
8886
"doc" : "Returns the state of space changing animation for the specified monitor, or for any monitor if no parameter is specified.\n\nParameters:\n * screen - an optional hs.screen object specifying the specific monitor to check the animation status for.\n\nReturns:\n * a boolean value indicating whether or not a space changing animation is currently active.\n\nNotes:\n * This function can be used in `hs.eventtap` based space changing functions to determine when to release the mouse and key events.\n\n * This function is also added to the `hs.screen` object metatable so that you can check a specific screen's animation status with `hs.screen:spacesAnimating()`.",
89-
"desc" : "Returns the state of space changing animation for the specified monitor, or for any monitor if no parameter is specified.",
9087
"notes" : [
9188
" * This function can be used in `hs.eventtap` based space changing functions to determine when to release the mouse and key events.",
9289
"",
@@ -98,20 +95,20 @@
9895
" * a boolean value indicating whether or not a space changing animation is currently active.",
9996
""
10097
],
101-
"def" : "hs._asm.undocumented.spaces.isAnimating([screen]) -> bool",
102-
"name" : "isAnimating"
103-
},
104-
{
98+
"desc" : "Returns the state of space changing animation for the specified monitor, or for any monitor if no parameter is specified.",
10599
"parameters" : [
106-
" * None",
100+
" * screen - an optional hs.screen object specifying the specific monitor to check the animation status for.",
107101
""
108-
],
102+
]
103+
},
104+
{
105+
"name" : "screensHaveSeparateSpaces",
109106
"stripped_doc" : [
110107
"Determine if the user has enabled the \"Displays Have Separate Spaces\" option within Mission Control.",
111108
""
112109
],
110+
"def" : "hs._asm.undocumented.spaces.screensHaveSeparateSpaces() -> bool",
113111
"doc" : "Determine if the user has enabled the \"Displays Have Separate Spaces\" option within Mission Control.\n\nParameters:\n * None\n\nReturns:\n * true or false representing the status of the \"Displays Have Separate Spaces\" option within Mission Control.\n\nNotes:\n * This function uses standard OS X APIs and is not likely to be affected by updates or patches.",
114-
"desc" : "Determine if the user has enabled the \"Displays Have Separate Spaces\" option within Mission Control.",
115112
"notes" : [
116113
" * This function uses standard OS X APIs and is not likely to be affected by updates or patches."
117114
],
@@ -121,8 +118,11 @@
121118
" * true or false representing the status of the \"Displays Have Separate Spaces\" option within Mission Control.",
122119
""
123120
],
124-
"def" : "hs._asm.undocumented.spaces.screensHaveSeparateSpaces() -> bool",
125-
"name" : "screensHaveSeparateSpaces"
121+
"desc" : "Determine if the user has enabled the \"Displays Have Separate Spaces\" option within Mission Control.",
122+
"parameters" : [
123+
" * None",
124+
""
125+
]
126126
}
127127
],
128128
"Variable" : [
@@ -134,14 +134,12 @@
134134
"Deprecated" : [
135135

136136
],
137-
"type" : "Module",
138137
"desc" : "These functions utilize private API's within the OS X internals, and are known to have unpredictable behavior under Mavericks and Yosemite when \"Displays have separate Spaces\" is checked under the Mission Control system preferences.",
138+
"type" : "Module",
139139
"Constructor" : [
140140

141141
],
142-
"Field" : [
143-
144-
],
142+
"doc" : "These functions utilize private API's within the OS X internals, and are known to have unpredictable behavior under Mavericks and Yosemite when \"Displays have separate Spaces\" is checked under the Mission Control system preferences.",
145143
"Method" : [
146144

147145
],
@@ -150,15 +148,13 @@
150148
],
151149
"items" : [
152150
{
153-
"parameters" : [
154-
155-
],
151+
"name" : "count",
156152
"stripped_doc" : [
157153
"LEGACY: The number of spaces you currently have.",
158154
""
159155
],
156+
"def" : "hs._asm.undocumented.spaces.count() -> number",
160157
"doc" : "LEGACY: The number of spaces you currently have.\n\nNotes:\n * this function may go away in a future update\n\n * this functions is included for backwards compatibility. It is not recommended because it worked by indexing the spaces ignoring that fullscreen applications are included in the list twice, and only worked with one monitor. Use `hs._asm.undocumented.spaces.query` or `hs._asm.undocumented.spaces.spacesByScreenUUID`.",
161-
"desc" : "LEGACY: The number of spaces you currently have.",
162158
"notes" : [
163159
" * this function may go away in a future update",
164160
"",
@@ -169,19 +165,19 @@
169165
"returns" : [
170166

171167
],
172-
"def" : "hs._asm.undocumented.spaces.count() -> number",
173-
"name" : "count"
174-
},
175-
{
168+
"desc" : "LEGACY: The number of spaces you currently have.",
176169
"parameters" : [
177170

178-
],
171+
]
172+
},
173+
{
174+
"name" : "currentSpace",
179175
"stripped_doc" : [
180176
"LEGACY: The index of the space you're currently on, 1-indexed (as usual).",
181177
""
182178
],
179+
"def" : "hs._asm.undocumented.spaces.currentSpace() -> number",
183180
"doc" : "LEGACY: The index of the space you're currently on, 1-indexed (as usual).\n\nNotes:\n * this function may go away in a future update\n\n * this functions is included for backwards compatibility. It is not recommended because it worked by indexing the spaces, which can be rearranged by the operating system anyways. Use `hs._asm.undocumented.spaces.query` or `hs._asm.undocumented.spaces.spacesByScreenUUID`.",
184-
"desc" : "LEGACY: The index of the space you're currently on, 1-indexed (as usual).",
185181
"notes" : [
186182
" * this function may go away in a future update",
187183
"",
@@ -192,20 +188,19 @@
192188
"returns" : [
193189

194190
],
195-
"def" : "hs._asm.undocumented.spaces.currentSpace() -> number",
196-
"name" : "currentSpace"
191+
"desc" : "LEGACY: The index of the space you're currently on, 1-indexed (as usual).",
192+
"parameters" : [
193+
194+
]
197195
},
198196
{
199-
"parameters" : [
200-
" * screen - an optional hs.screen object specifying the specific monitor to check the animation status for.",
201-
""
202-
],
197+
"name" : "isAnimating",
203198
"stripped_doc" : [
204199
"Returns the state of space changing animation for the specified monitor, or for any monitor if no parameter is specified.",
205200
""
206201
],
202+
"def" : "hs._asm.undocumented.spaces.isAnimating([screen]) -> bool",
207203
"doc" : "Returns the state of space changing animation for the specified monitor, or for any monitor if no parameter is specified.\n\nParameters:\n * screen - an optional hs.screen object specifying the specific monitor to check the animation status for.\n\nReturns:\n * a boolean value indicating whether or not a space changing animation is currently active.\n\nNotes:\n * This function can be used in `hs.eventtap` based space changing functions to determine when to release the mouse and key events.\n\n * This function is also added to the `hs.screen` object metatable so that you can check a specific screen's animation status with `hs.screen:spacesAnimating()`.",
208-
"desc" : "Returns the state of space changing animation for the specified monitor, or for any monitor if no parameter is specified.",
209204
"notes" : [
210205
" * This function can be used in `hs.eventtap` based space changing functions to determine when to release the mouse and key events.",
211206
"",
@@ -217,19 +212,20 @@
217212
" * a boolean value indicating whether or not a space changing animation is currently active.",
218213
""
219214
],
220-
"def" : "hs._asm.undocumented.spaces.isAnimating([screen]) -> bool",
221-
"name" : "isAnimating"
215+
"desc" : "Returns the state of space changing animation for the specified monitor, or for any monitor if no parameter is specified.",
216+
"parameters" : [
217+
" * screen - an optional hs.screen object specifying the specific monitor to check the animation status for.",
218+
""
219+
]
222220
},
223221
{
224-
"parameters" : [
225-
226-
],
222+
"name" : "moveToSpace",
227223
"stripped_doc" : [
228224
"LEGACY: Switches to the space at the given index, 1-indexed (as usual).",
229225
""
230226
],
227+
"def" : "hs._asm.undocumented.spaces.moveToSpace(number)",
231228
"doc" : "LEGACY: Switches to the space at the given index, 1-indexed (as usual).\n\nNotes:\n * this function may go away in a future update\n\n * this functions is included for backwards compatibility. It is not recommended because it was never really reliable and worked by indexing the spaces, which can be rearranged by the operating system anyways. Use `hs._asm.undocumented.spaces.changeToSpace`.",
232-
"desc" : "LEGACY: Switches to the space at the given index, 1-indexed (as usual).",
233229
"notes" : [
234230
" * this function may go away in a future update",
235231
"",
@@ -240,20 +236,19 @@
240236
"returns" : [
241237

242238
],
243-
"def" : "hs._asm.undocumented.spaces.moveToSpace(number)",
244-
"name" : "moveToSpace"
239+
"desc" : "LEGACY: Switches to the space at the given index, 1-indexed (as usual).",
240+
"parameters" : [
241+
242+
]
245243
},
246244
{
247-
"parameters" : [
248-
" * None",
249-
""
250-
],
245+
"name" : "screensHaveSeparateSpaces",
251246
"stripped_doc" : [
252247
"Determine if the user has enabled the \"Displays Have Separate Spaces\" option within Mission Control.",
253248
""
254249
],
250+
"def" : "hs._asm.undocumented.spaces.screensHaveSeparateSpaces() -> bool",
255251
"doc" : "Determine if the user has enabled the \"Displays Have Separate Spaces\" option within Mission Control.\n\nParameters:\n * None\n\nReturns:\n * true or false representing the status of the \"Displays Have Separate Spaces\" option within Mission Control.\n\nNotes:\n * This function uses standard OS X APIs and is not likely to be affected by updates or patches.",
256-
"desc" : "Determine if the user has enabled the \"Displays Have Separate Spaces\" option within Mission Control.",
257252
"notes" : [
258253
" * This function uses standard OS X APIs and is not likely to be affected by updates or patches."
259254
],
@@ -263,11 +258,17 @@
263258
" * true or false representing the status of the \"Displays Have Separate Spaces\" option within Mission Control.",
264259
""
265260
],
266-
"def" : "hs._asm.undocumented.spaces.screensHaveSeparateSpaces() -> bool",
267-
"name" : "screensHaveSeparateSpaces"
261+
"desc" : "Determine if the user has enabled the \"Displays Have Separate Spaces\" option within Mission Control.",
262+
"parameters" : [
263+
" * None",
264+
""
265+
]
268266
}
269267
],
270-
"doc" : "These functions utilize private API's within the OS X internals, and are known to have unpredictable behavior under Mavericks and Yosemite when \"Displays have separate Spaces\" is checked under the Mission Control system preferences.",
268+
"Field" : [
269+
270+
],
271271
"name" : "hs._asm.undocumented.spaces"
272272
}
273273
]
274+
Menu Developer Updated: Contents

Diff for: init.lua

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
if package.searchpath("hs._asm.coroutineshim", package.path) then
2+
require"hs._asm.coroutineshim"
3+
end
14
--- === hs._asm.undocumented.spaces ===
25
---
36
--- These functions utilize private API's within the OS X internals, and are known to have unpredictable behavior under Mavericks and Yosemite when "Displays have separate Spaces" is checked under the Mission Control system preferences.

0 commit comments

Comments
 (0)