summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-12-14 12:09:17 -0500
committerDavid Thompson <dthompson2@worcester.edu>2015-12-14 12:09:17 -0500
commitc63c46573ac88961c4e33556a77dc6fe5dca528c (patch)
tree85b59e2888b92dbc94dd84fce542927fb199d205
parentf5cd0152a22270893655f2a69358d0f68c442370 (diff)
window: Improve call-with-window.
* sdl2/video.scm (call-with-window): Use a pre-existing window object instead of making a new one.
-rw-r--r--sdl2/video.scm16
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."