nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bf2b2ca
)
lib/android: fix `AndroidKeyEvent::to_c` to return a `nullable Char`
author
Alexis Laferrière
<alexis.laf@xymus.net>
Sat, 12 Dec 2015 16:28:03 +0000
(11:28 -0500)
committer
Alexis Laferrière
<alexis.laf@xymus.net>
Mon, 14 Dec 2015 16:00:01 +0000
(11:00 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/android/input_events.nit
patch
|
blob
|
history
diff --git
a/lib/android/input_events.nit
b/lib/android/input_events.nit
index
45cc8a1
..
9597eea
100644
(file)
--- a/
lib/android/input_events.nit
+++ b/
lib/android/input_events.nit
@@
-213,7
+213,14
@@
extern class AndroidKeyEvent `{AInputEvent *`}
# Hardware code of the key raising this event
fun key_code: Int `{ return AKeyEvent_getKeyCode(self); `}
- redef fun to_c `{
+ redef fun to_c
+ do
+ var i = native_to_c
+ if i == 0 then return null
+ return i.code_point
+ end
+
+ private fun native_to_c: Int `{
int code = AKeyEvent_getKeyCode(self);
if (code >= AKEYCODE_0 && code <= AKEYCODE_9)
return '0'+code-AKEYCODE_0;