diff options
author | David Thompson <dthompson2@worcester.edu> | 2015-12-14 12:09:17 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2015-12-14 12:09:17 -0500 |
commit | c63c46573ac88961c4e33556a77dc6fe5dca528c (patch) | |
tree | 85b59e2888b92dbc94dd84fce542927fb199d205 /sdl2 | |
parent | f5cd0152a22270893655f2a69358d0f68c442370 (diff) |
window: Improve call-with-window.
* sdl2/video.scm (call-with-window): Use a pre-existing window object
instead of making a new one.
Diffstat (limited to 'sdl2')
-rw-r--r-- | sdl2/video.scm | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sdl2/video.scm b/sdl2/video.scm index e4d6d6c..ab2ec0f 100644 --- a/sdl2/video.scm +++ b/sdl2/video.scm @@ -127,16 +127,14 @@ the form '(x y)', where each coordinate is measured in pixels." "Close WINDOW." (ffi:sdl-destroy-window (unwrap-window window))) -(define (call-with-window args proc) - "Call PROC with a new window defined by ARGS, a list of keyword -arguments accepted by 'make-window', and close it when PROC +(define (call-with-window window proc) + "Call PROC with WINDOW, an SDL window object, and close it when PROC returns or otherwise exits." - (let ((window (apply make-window args))) - (dynamic-wind - (const #t) - (lambda () (proc window)) - (lambda () - (close-window! window))))) + (dynamic-wind + (const #t) + (lambda () (proc window)) + (lambda () + (close-window! window)))) (define (window-title window) "Return the title for WINDOW." |