forked from androidx/androidx
-
Notifications
You must be signed in to change notification settings - Fork 60
/
AwtEvents.kt
29 lines (25 loc) · 984 Bytes
/
AwtEvents.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package androidx.compose.ui.awt
import androidx.compose.ui.input.key.KeyEvent
import androidx.compose.ui.input.pointer.PointerEvent
// TODO(demin): new API, which is not merged to AOSP
/**
* The original raw native event from AWT
*/
val PointerEvent.awtEvent: java.awt.event.MouseEvent get() {
require(nativeEvent is java.awt.event.MouseEvent) {
"nativeEvent was sent not by AWT. Make sure, that you use AWT backed API" +
" (from androidx.compose.ui.awt.* or from androidx.compose.ui.window.*)"
}
return nativeEvent
}
// TODO(demin): new API, which is not merged to AOSP
/**
* The original raw native event from AWT
*/
val KeyEvent.awtEvent: java.awt.event.KeyEvent get() {
require(nativeKeyEvent is java.awt.event.KeyEvent) {
"nativeKeyEvent was sent not by AWT. Make sure, that you use AWT backed API" +
" (from androidx.compose.ui.awt.* or from androidx.compose.ui.window.*)"
}
return nativeKeyEvent
}