scoop:scoop.window:0.1.0
src/accessibility/dispatch.scoop
Selected production source · src/accessibility/dispatch.scoop
1
package scoop.window.accessibility3
import scoop.window.*5
/** A native action may enter only between ordinary owner callbacks. */6
internal fun ApplicationOwner.performAccessibility(7
action: () -> SemanticActionResult8
): SemanticActionResult {9
if (!isCurrentThread())10
return SemanticActionResult.Busy11
if (exiting || native == None)12
return SemanticActionResult.Unavailable13
if (accessibilityBusy)14
return SemanticActionResult.Busy15
dispatchDepth += 116
try {17
return action()18
} catch (error: Throwable) {19
failAccessibility(error)20
return SemanticActionResult.Unavailable21
} finally {22
dispatchDepth -= 123
if (exiting)24
mailbox.wake()25
}26
}