Changeset 2920
- Timestamp:
- Mar 27, 2012 2:30:05 AM (14 months ago)
- Files:
-
- 6 edited
-
cpu/x86/pc/olpc/via/mfgtest.fth (modified) (1 diff)
-
ofw/gui/button.fth (modified) (1 diff)
-
ofw/gui/dialog.fth (modified) (1 diff)
-
ofw/gui/iconmenu.fth (modified) (5 diffs)
-
ofw/gui/mouse.fth (modified) (5 diffs)
-
ofw/gui/textfld.fth (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cpu/x86/pc/olpc/via/mfgtest.fth
r2893 r2920 156 156 157 157 : init-menu ( -- ) 158 ?open-screen ?open- mouse ?open-touchscreen158 ?open-screen ?open-pointer 159 159 #mfgrows to rows 160 160 #mfgcols to cols -
ofw/gui/button.fth
r1329 r2920 219 219 ; 220 220 : setup ( -- ) 221 ?open-screen set-menu-colors ?open- mouse221 ?open-screen set-menu-colors ?open-pointer 222 222 clear-menu install-menu cursor-off refresh 223 223 ; -
ofw/gui/dialog.fth
r2893 r2920 300 300 301 301 : controls-mouse ( list -- ?? flag ) 302 mouse-ih0= if drop false exit then302 pointer? 0= if drop false exit then 303 303 >r 304 304 false to dialog-ready? 305 begin mouse-event? while ( x ybuttons )306 remove-mouse-cursor ( x y buttons )307 -rot update-position( buttons )305 begin pointer-event? while ( x y absolute? buttons ) 306 remove-mouse-cursor ( x y absolute? buttons ) 307 >r update-position r> ( buttons ) 308 308 r@ mouse-buttons ( ?? ) 309 309 draw-mouse-cursor ( ?? ) -
ofw/gui/iconmenu.fth
r2893 r2920 413 413 ; 414 414 415 : do-mouse ( -- ) 416 mouse-ih 0= if exit then 417 begin mouse-event? while ( x y buttons ) 418 remove-mouse-cursor ( x y buttons ) 419 -rot update-position ( buttons ) 420 new-sq? 421 draw-mouse-cursor 422 repeat 423 ; 424 : do-touchscreen ( -- ) 425 touchscreen-ih 0= if exit then 426 begin touchscreen-event? while ( x y buttons ) 427 remove-mouse-cursor ( x y buttons ) 428 -rot set-xy ( buttons ) 415 : do-pointer ( -- ) 416 pointer? 0= if exit then 417 begin pointer-event? while ( x y absolute? buttons ) 418 remove-mouse-cursor ( x y absolute? buttons ) 419 >r update-position r> ( buttons ) 429 420 new-sq? 430 421 draw-mouse-cursor … … 465 456 : wait-buttons-up ( -- ) 466 457 begin 467 mouse-event? if ( x y buttons )468 nip nip 0= if exit then458 pointer-event? if ( x y buttons ) 459 nip nip nip 0= if exit then 469 460 then 470 461 again … … 477 468 begin 478 469 key? if key drop refresh exit then 479 mouse-ihif480 mouse-event? if470 pointer? if 471 pointer-event? if ( x y absolute? buttons ) 481 472 \ Ignore movement, act only on a button down event 482 nip nip if wait-buttons-up refresh exit then473 nip nip nip if wait-buttons-up refresh exit then 483 474 then 484 475 then … … 494 485 495 486 false to done? 496 begin do- touchscreen do-mousedo-key done? until487 begin do-pointer do-key done? until 497 488 false to done? 498 489 … … 507 498 save-scroller 508 499 setup-graphics 509 \ ?open- mouse500 \ ?open-pointer 510 501 cursor-off 511 502 gui-alerts 512 503 ; 513 : unsetup-menu ( -- ) ?close- mouserestore-scroller ;504 : unsetup-menu ( -- ) ?close-pointer restore-scroller ; 514 505 515 506 defer current-menu ' clear to current-menu -
ofw/gui/mouse.fth
r2893 r2920 4 4 headerless 5 5 6 0 value mouse-ih 7 8 false value mouse-absolute? \ True if coordinates are absolute 6 defer pointer-cursor? ' false to pointer-cursor? 9 7 10 8 \ Current mouse cursor position … … 137 135 138 136 : remove-mouse-cursor ( -- ) 137 pointer-cursor? 0= if exit then 139 138 hardware-cursor? if " cursor-off" $call-screen exit then 140 mouse-ih 0= if exit then141 mouse-absolute? if exit then142 139 xpos ypos old-rect put-cursor 143 140 ; 144 141 : draw-mouse-cursor ( -- ) 145 mouse-ih 0= if exit then 146 mouse-absolute? if exit then 142 pointer-cursor? 0= if exit then 147 143 hardware-cursor? if 148 144 xpos ypos " cursor-xy!" $call-screen … … 159 155 160 156 : set-xy ( x y -- ) to ypos to xpos ; 161 : update-position ( x y -- )162 mouse-absolute?if set-xy exit then157 : update-position ( x y absolute? -- ) 158 if set-xy exit then 163 159 2dup or 0= if 2drop exit then \ Avoid flicker if there is no movement 164 160 … … 172 168 173 169 headers 170 171 \ XXX this should be structured as a multiplexor node instead of 172 \ having explicit mouse and touchscreen cases. 173 174 0 value mouse-ih 175 176 false value mouse-absolute? \ True if coordinates are absolute 174 177 175 178 0 value close-mouse? … … 228 231 : touchscreen-event? ( -- false | x y buttons true ) 229 232 " stream-poll?" touchscreen-ih $call-method 233 ; 234 235 : (pointer-cursor?) ( -- flag ) 236 mouse-ih if mouse-absolute? 0= else false then 237 ; 238 ' (pointer-cursor?) to pointer-cursor? 239 240 : ?open-pointer ( -- ) ?open-mouse ?open-touchscreen ; 241 : ?close-pointer ( -- ) ?close-touchscreen ?close-mouse ; 242 243 : pointer? ( -- flag ) mouse-ih 0<> touchscreen-ih 0<> or ; 244 : pointer-event? ( -- false | x y absolute? buttons true ) 245 mouse-event? if ( x y buttons ) 246 mouse-absolute? swap true exit 247 then 248 touchscreen-event? if 249 true swap true exit 250 then 251 false 230 252 ; 231 253 -
ofw/gui/textfld.fth
r2893 r2920 115 115 (key remove-mouse-cursor exit 116 116 then 117 mouse-ihif118 begin mouse-event? while119 remove-mouse-cursor 120 -rot update-position121 draw-mouse-cursor 117 pointer? if 118 begin pointer-event? while ( x y absolute? buttons ) 119 remove-mouse-cursor ( x y absolute? buttons ) 120 >r update-position r> ( buttons ) 121 draw-mouse-cursor ( buttons ) 122 122 interact-list edit-mouse-buttons if exit then 123 123 repeat
Note: See TracChangeset
for help on using the changeset viewer.
