Scoop API

scoop:scoop.window:0.1.0

src/accessibility/dispatch.scoop

Selected production source · src/accessibility/dispatch.scoop

1package scoop.window.accessibility
3import scoop.window.*
5/** A native action may enter only between ordinary owner callbacks. */
6internal fun ApplicationOwner.performAccessibility(
7 action: () -> SemanticActionResult
8): SemanticActionResult {
9 if (!isCurrentThread())
10 return SemanticActionResult.Busy
11 if (exiting || native == None)
12 return SemanticActionResult.Unavailable
13 if (accessibilityBusy)
14 return SemanticActionResult.Busy
15 dispatchDepth += 1
16 try {
17 return action()
18 } catch (error: Throwable) {
19 failAccessibility(error)
20 return SemanticActionResult.Unavailable
21 } finally {
22 dispatchDepth -= 1
23 if (exiting)
24 mailbox.wake()
25 }