From a4579c38b5ffdefe87a9d8bcf00894ee4996071c Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 30 Apr 2005 18:27:40 +0000 Subject: [PATCH] Unix socket fix, minor UI fixes --- TODO.FACTOR.txt | 1 - library/bootstrap/boot-stage3.factor | 4 ---- library/tools/memory.factor | 4 ++++ library/ui/events.factor | 2 +- library/ui/gadgets.factor | 7 ++++++- library/ui/paint.factor | 1 + library/ui/tool-menus.factor | 2 +- library/ui/world.factor | 6 +----- library/unix/sockets.factor | 2 +- 9 files changed, 15 insertions(+), 14 deletions(-) diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 86223ccd1b..a49b4f940d 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -3,7 +3,6 @@ - faster layout - faster repaint - forgotten words not removed from cross-reference -- freebsd 4 -pthread errno - implement fcopy - win32 updates diff --git a/library/bootstrap/boot-stage3.factor b/library/bootstrap/boot-stage3.factor index dc3fa33d1c..4ad732913a 100644 --- a/library/bootstrap/boot-stage3.factor +++ b/library/bootstrap/boot-stage3.factor @@ -5,10 +5,6 @@ lists namespaces parser sequences stdio unparser words ; "Bootstrap stage 3..." print -os "freebsd" = [ - "libc" "libc.so" "cdecl" add-library -] when - unix? [ "sdl" "libSDL.so" "cdecl" add-library "sdl-gfx" "libSDL_gfx.so" "cdecl" add-library diff --git a/library/tools/memory.factor b/library/tools/memory.factor index 52c9671b19..664796ed62 100644 --- a/library/tools/memory.factor +++ b/library/tools/memory.factor @@ -5,6 +5,10 @@ USING: errors generic hashtables kernel kernel-internals lists math namespaces prettyprint sequences stdio unparser vectors words ; +: save + #! Save the current image. + "image" get save-image ; + ! Printing an overview of heap usage. : kb. 1024 /i unparse write " KB" write ; diff --git a/library/ui/events.factor b/library/ui/events.factor index 8795dd14a2..419a531b95 100644 --- a/library/ui/events.factor +++ b/library/ui/events.factor @@ -5,7 +5,7 @@ USING: alien generic kernel lists math namespaces sdl sequences ; GENERIC: handle-event ( event -- ) -M: alien handle-event ( event -- ) +M: object handle-event ( event -- ) drop ; M: quit-event handle-event ( event -- ) diff --git a/library/ui/gadgets.factor b/library/ui/gadgets.factor index 471fb8d62c..54cfac1f3d 100644 --- a/library/ui/gadgets.factor +++ b/library/ui/gadgets.factor @@ -20,7 +20,12 @@ C: gadget ( shape -- gadget ) : redraw ( gadget -- ) #! Redraw a gadget before the next iteration of the event #! loop. - t over set-gadget-redraw? gadget-parent [ redraw ] when* ; + dup gadget-redraw? [ + t over set-gadget-redraw? + gadget-parent [ redraw ] when* + ] [ + drop + ] ifte ; : relayout ( gadget -- ) #! Relayout a gadget before the next iteration of the event diff --git a/library/ui/paint.factor b/library/ui/paint.factor index afea41b91f..a680cdd0b4 100644 --- a/library/ui/paint.factor +++ b/library/ui/paint.factor @@ -63,6 +63,7 @@ SYMBOL: clip #! All drawing done inside draw-shape is done with the #! gadget's paint. If the gadget does not have any custom #! paint, just call the quotation. + f over set-gadget-redraw? dup gadget-paint [ dup [ [ diff --git a/library/ui/tool-menus.factor b/library/ui/tool-menus.factor index dd3f5ead3a..415437e549 100644 --- a/library/ui/tool-menus.factor +++ b/library/ui/tool-menus.factor @@ -14,7 +14,7 @@ SYMBOL: root-menu [ [[ "Listener" [ "Listener" world get add-gadget ] ]] [[ "Globals" [ global inspect ] ]] - [[ "Save image" [ "image" get save-image ] ]] + [[ "Save image" [ save ] ]] [[ "Exit" [ f world get set-world-running? ] ]] ] root-menu set diff --git a/library/ui/world.factor b/library/ui/world.factor index 27a7be7f46..83f86ffffb 100644 --- a/library/ui/world.factor +++ b/library/ui/world.factor @@ -24,11 +24,7 @@ M: world inside? ( point world -- ? ) 2drop t ; : draw-world ( world -- ) dup gadget-redraw? [ - [ - f over set-gadget-redraw? - dup draw-gadget - dup gadget-paint [ world-hand draw-gadget ] bind - ] with-surface + [ dup draw-gadget ] with-surface ] [ drop ] ifte ; diff --git a/library/unix/sockets.factor b/library/unix/sockets.factor index 2c28d19849..ebd02751e2 100644 --- a/library/unix/sockets.factor +++ b/library/unix/sockets.factor @@ -85,7 +85,7 @@ C: client-stream ( fd host port -- stream ) : ( host port -- stream ) #! Connect to a port number on a TCP/IP host. - 2dup client-socket dup ; + [ client-socket ] 2keep ; : ( port -- server ) #! Starts listening for TCP connections on localhost:port.