Skip to content

Commit f167fff

Browse files
committed
Fix android-key
1 parent d33b03d commit f167fff

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

minos2/widgets.fs

+15-3
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ style-tex 1024 dup rgba-newtex
9090

9191
\ glues
9292

93+
begin-structure glue-s
94+
cell +field glue-t \ typical size
95+
cell +field glue-s \ shrink by
96+
cell +field glue-a \ add by
97+
end-structure
98+
9399
widget class
94100
3 cells +field hglue-c
95101
3 cells +field dglue-c
@@ -174,19 +180,20 @@ widget class
174180
field: text-string
175181
field: text-font
176182
field: text-color
183+
field: text-border
177184
end-class text
178185

179186
Variable glyphs$
180187

181188
: text-init ( -- )
182189
text-font @ to font text-string $@ glyphs$ $+! ;
183190
: text-text ( -- )
184-
x @ s>f penxy sf! y @ s>f penxy sfloat+ sf!
191+
x @ text-border @ + s>f penxy sf! y @ s>f penxy sfloat+ sf!
185192
text-font @ to font text-color @ color !
186193
text-string $@ render-string ;
187194
: text-!size ( -- )
188195
text-string $@ layout-string
189-
f>s d ! f>s h ! f>s w ! ;
196+
f>s text-border @ + d ! f>s text-border @ + h ! f>s text-border @ 2* + w ! ;
190197
' text-init text to draw-init
191198
' text-text text to draw-text
192199
' text-!size text to !size
@@ -268,7 +275,12 @@ end-class vbox \ vertical alignment
268275
box class end-class zbox \ overlay alignment
269276

270277
: 0glue ( -- t s a ) 0 0 0 ;
271-
: 1glue ( -- t s a ) 0 0 [ -1 1 rshift ]L ;
278+
: 1glue ( -- t s a ) 0 0 [ -1 8 rshift ]L ; \ can have 128 1glues in a row
279+
280+
glue new Constant glue*1
281+
glue new Constant glue*2
282+
glue*1 >o 1glue hglue-c glue! 1glue dglue-c glue! 1glue vglue-c glue! o>
283+
glue*2 >o 1glue 2* hglue-c glue! 1glue 2* dglue-c glue! 1glue 2* vglue-c glue! o>
272284

273285
: g3>2 ( t s a -- min a ) over + >r - r> ;
274286

unix/android.fs

+7-6
Original file line numberDiff line numberDiff line change
@@ -355,14 +355,15 @@ JValue cmanager
355355
dup to key-event >o
356356
ke_getMetaState meta-key# !
357357
getAction dup 2 = IF drop
358-
getKeyCode dup 0=
359-
IF drop getCharacters android-characters
360-
ELSE android-keycode
358+
getKeyCode
359+
?dup-IF android-keycode
360+
ELSE getCharacters android-characters
361361
THEN
362362
ELSE
363-
0= IF getKeyCode dup 0=
364-
IF drop getUnicodeChar android-unicode
365-
ELSE android-keycode
363+
0= IF
364+
getUnicodeChar
365+
?dup-IF android-unicode
366+
ELSE getKeyCode android-keycode
366367
THEN
367368
THEN
368369
THEN o> ;

0 commit comments

Comments
 (0)