Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Better keyboard handling |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c71e1435c8efbdc216e81064cfd0db86 |
User & Date: | bernd 2014-05-14 21:02:08.409 |
Context
2014-06-30
| ||
23:28 | Clipboard words (require Andriod 4.x) check-in: 279f834ea3 user: bernd tags: trunk | |
2014-05-14
| ||
21:02 | Better keyboard handling check-in: c71e1435c8 user: bernd tags: trunk | |
2014-04-29
| ||
13:02 | A bit refactoring, added a very simple example check-in: 4784aecda7 user: bernd tags: trunk | |
Changes
Changes to gl-helper.fs.
︙ | ︙ | |||
635 636 637 638 639 640 641 | : delta-t ( -- r ) *input action @ 0< IF ftime ELSE delta-tc THEN fdup drag-time f!@ f- fdup 1e f> IF fdrop 0e THEN ; FVariable motion-x0 FVariable motion-y0 Variable last-x0 -100 last-x0 ! Variable last-y0 -100 last-y0 ! | > | | | | 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | : delta-t ( -- r ) *input action @ 0< IF ftime ELSE delta-tc THEN fdup drag-time f!@ f- fdup 1e f> IF fdrop 0e THEN ; FVariable motion-x0 FVariable motion-y0 Variable last-x0 -100 last-x0 ! Variable last-y0 -100 last-y0 ! 0.01e FConstant glitch-click# 0.2e FConstant short-click# 0.5e FConstant long-click# : short? ( -- flag ) delta-tc fdup glitch-click# f> short-click# f< and ; : long? ( -- flag ) delta-tc long-click# f> ; : !click ( -- ) 0e motion-x0 f! 0e motion-y0 f! ftime drag-time f! ; [IFUNDEF] togglekb : togglekb ; [THEN] : ?toggle ( -- ) short? motion-y0 f@ 2e f< and IF togglekb need-show off THEN ; : do-motion { rows cur old motion xt -- } old @ -100 = IF cur old ! ELSE cur old @ over old ! swap - s>f dpy-h @ s>f rows fm/ f/ fdup f2/ motion f@ f2/ f+ motion f! |
︙ | ︙ |
Changes to gles2/android.fs.
︙ | ︙ | |||
235 236 237 238 239 240 241 | APP_CMD_START of [: ." app start" cr ;] $err endof APP_CMD_STOP of [: ." app stop" cr ;] $err endof dup [: ." app cmd " . cr ;] $err endcase ; is acmd also jni | > > > | > | | | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | APP_CMD_START of [: ." app start" cr ;] $err endof APP_CMD_STOP of [: ." app stop" cr ;] $err endof dup [: ." app cmd " . cr ;] $err endcase ; is acmd also jni Variable setstring : insstring ( -- ) setstring $@ inskeys setstring $off ; : android-characters ( string -- ) jstring>sstring insstring inskeys jfree ; : android-setstring ( string -- ) jstring>sstring setstring $! jfree ; : android-unicode ( uchar -- ) insstring >xstring inskeys ; : android-keycode ( keycode -- ) insstring keycode>keys inskeys ; JValue key-event JValue touch-event JValue location JValue sensor : android-key ( event -- ) dup to key-event |
︙ | ︙ | |||
286 287 288 289 290 291 292 | Defer android-location ( location -- ) :noname to location ; IS android-location Defer android-sensor ( sensor -- ) :noname to sensor ; IS android-sensor \ stubs, "is recurse" assigns to last defined word | | > | > > > > > > > > > > > > | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | Defer android-location ( location -- ) :noname to location ; IS android-location Defer android-sensor ( sensor -- ) :noname to sensor ; IS android-sensor \ stubs, "is recurse" assigns to last defined word Defer android-surface-changed ' ]gref is android-surface-changed Defer android-surface-redraw ' ]gref is recurse Defer android-video-size ' ]gref is recurse Defer android-touch ' touch>event is recurse : android-surface-created ( surface -- ) app window @ 0= IF >o env o ANativeWindow_fromSurface app window ! gref> window-init ELSE ]gref THEN ; : android-surface-destroyed ( surface -- ) >o app window off gref> ; : android-global-layout ( 0 -- ) drop config-changed ; : android-log# ( n -- ) ." log: " . cr ; : android-log$ ( string -- ) jstring>sstring ." log: " type cr jfree ; Defer android-w! ( n -- ) ' drop is recurse Defer android-h! ( n -- ) ' drop is recurse Create aevents ' android-key , ' android-touch , ' android-location , ' android-sensor , ' android-surface-created , ' android-surface-changed , ' android-surface-redraw , ' android-surface-destroyed , ' android-global-layout , ' android-video-size , ' android-log# , ' android-log$ , ' android-characters , ' android-setstring , ' android-w! , ' android-h! , here aevents - cell/ ' drop , Constant max-event# :noname ( event type -- ) max-event# umin cells aevents + perform ; is akey previous previous set-current |
Changes to gles2/gl-helper.fs.
︙ | ︙ | |||
635 636 637 638 639 640 641 | : delta-t ( -- r ) *input action @ 0< IF ftime ELSE delta-tc THEN fdup drag-time f!@ f- fdup 1e f> IF fdrop 0e THEN ; FVariable motion-x0 FVariable motion-y0 Variable last-x0 -100 last-x0 ! Variable last-y0 -100 last-y0 ! | > | | | | 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | : delta-t ( -- r ) *input action @ 0< IF ftime ELSE delta-tc THEN fdup drag-time f!@ f- fdup 1e f> IF fdrop 0e THEN ; FVariable motion-x0 FVariable motion-y0 Variable last-x0 -100 last-x0 ! Variable last-y0 -100 last-y0 ! 0.01e FConstant glitch-click# 0.2e FConstant short-click# 0.5e FConstant long-click# : short? ( -- flag ) delta-tc fdup glitch-click# f> short-click# f< and ; : long? ( -- flag ) delta-tc long-click# f> ; : !click ( -- ) 0e motion-x0 f! 0e motion-y0 f! ftime drag-time f! ; [IFUNDEF] togglekb : togglekb ; [THEN] : ?toggle ( -- ) short? motion-y0 f@ 2e f< and IF togglekb need-show off THEN ; : do-motion { rows cur old motion xt -- } old @ -100 = IF cur old ! ELSE cur old @ over old ! swap - s>f dpy-h @ s>f rows fm/ f/ fdup f2/ motion f@ f2/ f+ motion f! |
︙ | ︙ |
Changes to gles2/jni-helper.fs.
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 | : POWER_SERVICE js" power" ; : LOCATION_SERVICE js" location" ; : SENSOR_SERVICE js" sensor" ; jni-method: getSystemService getSystemService (Ljava/lang/String;)Ljava/lang/Object; jni-method: getWindow getWindow ()Landroid/view/Window; jni-method: hideProgress hideProgress ()V jni-class: android/app/Activity jni-method: getWindowManager getWindowManager ()Landroid/view/WindowManager; jni-class: android/view/WindowManager jni-method: getDefaultDisplay getDefaultDisplay ()Landroid/view/Display; | > > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | : POWER_SERVICE js" power" ; : LOCATION_SERVICE js" location" ; : SENSOR_SERVICE js" sensor" ; jni-method: getSystemService getSystemService (Ljava/lang/String;)Ljava/lang/Object; jni-method: getWindow getWindow ()Landroid/view/Window; jni-method: hideProgress hideProgress ()V jni-method: showIME showIME ()V jni-method: hideIME hideIME ()V jni-class: android/app/Activity jni-method: getWindowManager getWindowManager ()Landroid/view/WindowManager; jni-class: android/view/WindowManager jni-method: getDefaultDisplay getDefaultDisplay ()Landroid/view/Display; |
︙ | ︙ | |||
71 72 73 74 75 76 77 | : l[] ( n list -- object ) >o l-get o> ; : l# ( list -- n ) >o l-size o> ; : l-map ( xt list -- ) >o { xt } ( -- ) l-size 0 ?DO I l-get >o xt execute ref> LOOP o> ; | | > > > < < | < < | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | : l[] ( n list -- object ) >o l-get o> ; : l# ( list -- n ) >o l-size o> ; : l-map ( xt list -- ) >o { xt } ( -- ) l-size 0 ?DO I l-get >o xt execute ref> LOOP o> ; Variable kbflag kbflag on : hidekb ( -- ) clazz >o hideIME o> kbflag off ; : showkb ( -- ) clazz >o showIME o> kbflag on ; : togglekb ( -- ) kbflag @ IF hidekb ELSE showkb THEN ; 0 [IF] jni-class: android/os/PowerManager jni-method: newWakeLock newWakeLock (ILjava/lang/String;)Landroid/os/PowerManager$WakeLock; jni-class: android/os/PowerManager$WakeLock jni-method: wl-acquire acquire ()V |
︙ | ︙ |