scoop:scoop.window:0.1.0
src/input/shortcut_compare.scoop
Selected production source · src/input/shortcut_compare.scoop
1
package scoop.window3
internal fun platformShortcutCharactersEqual(left: String, right: String): Boolean {4
@Unsafe5
{6
return left.withUtf8Bytes {7
a,8
aSize -> @Unsafe9
{10
return@withUtf8Bytes right.withUtf8Bytes {11
b,12
bSize -> @Unsafe13
{14
val result = nativeShortcutEqual(a, aSize, b, bSize)15
if (result < 0)16
throw WindowException(17
"compare shortcut keys",18
WindowErrorKind.NativeFailure19
)20
return@withUtf8Bytes result != 021
}22
}23
}24
}25
}26
}28
@Extern(name = "scoop_window_shortcut_equal")29
private fun nativeShortcutEqual(30
left: Ptr<UInt8>,31
leftSize: Long,32
right: Ptr<UInt8>,33
rightSize: Long34
): Int