[openfirmware] [commit] r2331 - cpu/arm/olpc/1.75 ofw/gui

repository service svn at openfirmware.info
Wed Jul 6 04:22:55 CEST 2011


Author: wmb
Date: Wed Jul  6 04:22:55 2011
New Revision: 2331
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2331

Log:
GUI - interact with mouse in stream mode instead of remote-polling mode to decrease command traffic over the PS/2 bus.

Modified:
   cpu/arm/olpc/1.75/mfgtest.fth
   ofw/gui/dialog.fth
   ofw/gui/iconmenu.fth
   ofw/gui/mouse.fth

Modified: cpu/arm/olpc/1.75/mfgtest.fth
==============================================================================
--- cpu/arm/olpc/1.75/mfgtest.fth	Wed Jul  6 04:20:34 2011	(r2330)
+++ cpu/arm/olpc/1.75/mfgtest.fth	Wed Jul  6 04:22:55 2011	(r2331)
@@ -24,7 +24,7 @@
    begin
       key?  if  key drop  refresh exit  then
       mouse-ih  if
-         10 get-event  if
+         mouse-event?  if
             \ Ignore movement, act only on a button down event
             nip nip  if  wait-buttons-up  refresh exit  then
          then

Modified: ofw/gui/dialog.fth
==============================================================================
--- ofw/gui/dialog.fth	Wed Jul  6 04:20:34 2011	(r2330)
+++ ofw/gui/dialog.fth	Wed Jul  6 04:22:55 2011	(r2331)
@@ -287,7 +287,7 @@
    mouse-ih 0=  if  drop false exit  then
    >r
    false to dialog-ready?
-   begin  10 get-event  while         ( x y buttons )
+   begin  mouse-event?  while         ( x y buttons )
       remove-mouse-cursor             ( x y buttons )
       -rot  update-position           ( buttons )
       r@ mouse-buttons                ( ?? )

Modified: ofw/gui/iconmenu.fth
==============================================================================
--- ofw/gui/iconmenu.fth	Wed Jul  6 04:20:34 2011	(r2330)
+++ ofw/gui/iconmenu.fth	Wed Jul  6 04:22:55 2011	(r2331)
@@ -424,7 +424,7 @@
 
 : do-mouse  ( - )
    mouse-ih 0=  if  exit  then
-   begin  10 get-event  while         ( x y buttons )
+   begin  mouse-event?  while         ( x y buttons )
       remove-mouse-cursor
       -rot  update-position           ( buttons )
       new-sq?
@@ -452,15 +452,6 @@
       " screen" open-dev is screen-ih
    then
 ;
-: ?open-mouse  ( -- )
-   mouse-ih  0=  if
-      " mouse" open-dev is mouse-ih
-      mouse-ih  0=  if
-         " /mouse" open-dev to mouse-ih
-      then
-      mouse-ih  if  alloc-mouse-cursor  then
-   then
-;
  
 true config-flag menu?
 0 value default-selection
@@ -472,7 +463,13 @@
 
 : .menu  ( -- )  ." Type 'menu' to return to the menu" cr  ;
 
-: wait-buttons-up  ( -- )  begin  0 get-event drop nip nip  0= until  ;
+: wait-buttons-up  ( -- )
+   begin
+      mouse-event?  if   ( x y buttons )
+	 nip nip  0=  if  exit  then
+      then
+   again
+;
 headers
 : wait-return  ( -- )
    ." ... Press any key to return to the menu ... "
@@ -481,7 +478,7 @@
    begin
       key?  if  key drop  refresh exit  then
       mouse-ih  if
-         10 get-event  if
+         mouse-event?  if
             \ Ignore movement, act only on a button down event
             nip nip  if  wait-buttons-up  refresh exit  then
          then
@@ -505,13 +502,15 @@
 ' menu-interact to run-menu
 
 : setup-graphics  ( -- )
-   ?open-screen  set-menu-colors  ?open-mouse
+   ?open-screen  set-menu-colors
 ;
 : setup-menu  ( -- )
    setup-graphics
+   ?open-mouse
    cursor-off
    gui-alerts
 ;
+: unsetup-menu  ( -- )  ?close-mouse  restore-scroller  ;
 
 defer current-menu  ' clear to current-menu
 : set-menu  ( xt -- )  to current-menu  current-menu  ;
@@ -538,7 +537,7 @@
    screen-wh		( color x y w y )
    fill-rectangle-noff	( )
 
-   restore-scroller
+   unsetup-menu
 ;
 
 \ Note that menu establishes a new return stack state. Be sure to

Modified: ofw/gui/mouse.fth
==============================================================================
--- ofw/gui/mouse.fth	Wed Jul  6 04:20:34 2011	(r2330)
+++ ofw/gui/mouse.fth	Wed Jul  6 04:22:55 2011	(r2331)
@@ -172,6 +172,27 @@
    endcase
 ;
 headers
+
+0 value close-mouse?
+: ?close-mouse  ( -- )
+   close-mouse?  if
+      mouse-ih close-dev
+      0 to mouse-ih
+   then
+;
+: ?open-mouse  ( -- )
+   mouse-ih  0=  dup to close-mouse?  if
+      " mouse" open-dev is mouse-ih
+      mouse-ih  0=  if
+         " /mouse" open-dev to mouse-ih
+      then
+      mouse-ih  if  alloc-mouse-cursor  then
+   then
+;
+: mouse-event?  ( -- false | x y buttons true )
+   " stream-poll?" mouse-ih $call-method
+;
+
 \ LICENSE_BEGIN
 \ Copyright (c) 2006 FirmWorks
 \ 



More information about the openfirmware mailing list