From c63c46573ac88961c4e33556a77dc6fe5dca528c Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 14 Dec 2015 12:09:17 -0500 Subject: window: Improve call-with-window. * sdl2/video.scm (call-with-window): Use a pre-existing window object instead of making a new one. --- sdl2/video.scm | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'sdl2/video.scm') 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." -- cgit v1.2.3