Scoop API

scoop:scoop.window:0.1.0

src/input/shortcut_compare.scoop

Selected production source · src/input/shortcut_compare.scoop

1package scoop.window
3internal fun platformShortcutCharactersEqual(left: String, right: String): Boolean {
4 @Unsafe
5 {
6 return left.withUtf8Bytes {
7 a,
8 aSize -> @Unsafe
9 {
10 return@withUtf8Bytes right.withUtf8Bytes {
11 b,
12 bSize -> @Unsafe
13 {
14 val result = nativeShortcutEqual(a, aSize, b, bSize)
15 if (result < 0)
16 throw WindowException(
17 "compare shortcut keys",
18 WindowErrorKind.NativeFailure
19 )
20 return@withUtf8Bytes result != 0
21 }
22 }
23 }
24 }
25 }
28@Extern(name = "scoop_window_shortcut_equal")
29private fun nativeShortcutEqual(
30 left: Ptr<UInt8>,
31 leftSize: Long,
32 right: Ptr<UInt8>,
33 rightSize: Long
34): Int