Add no-window? parameter to gtk-graphics/open.
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Sun, 7 Apr 2013 17:20:30 +0000 (10:20 -0700)
committerMatt Birkholz <matt@birkholz.chandler.az.us>
Sun, 7 Apr 2013 17:20:30 +0000 (10:20 -0700)
src/gtk/gtk-graphics.scm

index a8921ffad6e4269f6f1440b207be1be4821413ef..ff08b1ccfcfaa7d3df832c035721d106f2f49607 100644 (file)
@@ -70,26 +70,29 @@ USA.
 
 (define gtk-graphics/available? gtk-thread-running?)
 
-(define (gtk-graphics/open make-device #!optional width height)
+(define (gtk-graphics/open make-device #!optional width height no-window?)
   (let ((width (if (default-object? width) 512 width))
-       (height (if (default-object? height) 384 height)))
+       (height (if (default-object? height) 384 height))
+       (no-window? (if (default-object? no-window?) #f no-window?)))
     (guarantee-positive-fixnum width 'gtk-graphics/open)
     (guarantee-positive-fixnum height 'gtk-graphics/open)
-    (let ((window (gtk-window-new 'toplevel))
-         (scroller (gtk-scrolled-view-new))
-         (layout (make-fix-layout width height))
-         (drawing (make-fix-drawing))
-         (graphics (make-gtk-graphics width height)))
-      (fix-drawing-add-ink! drawing graphics)
-      (set-fix-drawing-size! drawing width height)
-      (set-fix-layout-drawing! layout drawing 0 0)
-      (gtk-widget-set-hexpand layout #t)
-      (gtk-widget-set-vexpand layout #t)
-      (gtk-container-add scroller layout)
-      (gtk-container-set-border-width window 5)
-      (gtk-container-add window scroller)
-      (gtk-widget-show-all window)
-      (make-device graphics))))
+    (if no-window?
+       (make-device (make-gtk-graphics width height))
+       (let ((window (gtk-window-new 'toplevel))
+             (scroller (gtk-scrolled-view-new))
+             (layout (make-fix-layout width height))
+             (drawing (make-fix-drawing))
+             (graphics (make-gtk-graphics width height)))
+         (fix-drawing-add-ink! drawing graphics)
+         (set-fix-drawing-size! drawing width height)
+         (set-fix-layout-drawing! layout drawing 0 0)
+         (gtk-widget-set-hexpand layout #t)
+         (gtk-widget-set-vexpand layout #t)
+         (gtk-container-add scroller layout)
+         (gtk-container-set-border-width window 5)
+         (gtk-container-add window scroller)
+         (gtk-widget-show-all window)
+         (make-device graphics)))))
 
 (define (toplevel graphics)
   (let ((widgets (fix-drawing-widgets (fix-ink-drawing graphics))))