scoop:scoop.desktop:0.1.0
src/notification/native.scoop
Selected production source · src/notification/native.scoop
1
package scoop.desktop.notification3
import scoop.desktop.DesktopNativeResult5
@CLayout6
internal struct NotificationNativeData(7
val kind: Int,8
val detail: Int,9
val request: Long,10
val status: Int,11
val capabilities: Int,12
val code: Long13
)15
@CLayout16
internal struct NotificationNativeText(val bytes: Ptr<UInt8>?, val length: Long)18
internal struct NotificationReply(19
val data: NotificationNativeData,20
val id: String,21
val action: String,22
val payload: String,23
val message: String24
)26
@Extern(name = "scoop_notification_create")27
internal fun notificationCreate(id: Ptr<UInt8>, length: Long): DesktopNativeResult29
@Extern(name = "scoop_notification_attach")30
internal fun notificationAttach(31
pointer: Ptr<Unit>,32
callback: FunPtr<(Ptr<Unit>, Int) -> Int>,33
context: Ptr<Unit>34
): Long36
@Extern(name = "scoop_notification_destroy")37
internal fun notificationDestroy(pointer: Ptr<Unit>)39
@Extern(name = "scoop_notification_settings")40
internal fun notificationSettings(pointer: Ptr<Unit>, request: Long, permission: Int): Long42
@Extern(name = "scoop_notification_post")43
internal fun notificationPost(pointer: Ptr<Unit>, request: Long, content: Ptr<Unit>): Long45
@Extern(name = "scoop_notification_withdraw")46
internal fun notificationWithdraw(47
pointer: Ptr<Unit>,48
request: Long,49
id: Ptr<UInt8>,50
length: Long51
): Long53
@Extern(name = "scoop_notification_next_event")54
internal fun notificationNextEvent(pointer: Ptr<Unit>): Ptr<Unit>?56
@Extern(name = "scoop_notification_event_data")57
internal fun notificationEventData(event: Ptr<Unit>): NotificationNativeData59
@Extern(name = "scoop_notification_event_text")60
internal fun notificationEventText(event: Ptr<Unit>, field: Int): NotificationNativeText62
@Extern(name = "scoop_notification_event_destroy")63
internal fun notificationEventDestroy(event: Ptr<Unit>)65
@Extern(name = "scoop_notification_content_create")66
internal fun notificationContentCreate(silent: Int): DesktopNativeResult68
@Extern(name = "scoop_notification_content_text")69
internal fun notificationContentText(70
content: Ptr<Unit>,71
field: Int,72
text: Ptr<UInt8>,73
length: Long74
): Long76
@Extern(name = "scoop_notification_content_action")77
internal fun notificationContentAction(78
content: Ptr<Unit>,79
id: Ptr<UInt8>,80
idLength: Long,81
title: Ptr<UInt8>,82
titleLength: Long83
): Long85
@Extern(name = "scoop_notification_content_destroy")86
internal fun notificationContentDestroy(content: Ptr<Unit>)88
internal fun notificationText(event: Ptr<Unit>, field: Int): String {89
@Unsafe90
{91
val value = notificationEventText(event, field)92
return when (value.bytes) {93
case Some(val bytes) -> String.fromUtf8(bytes, value.length)94
case None -> ""95
}96
}97
}