From b9f0452d886e4e9a20ab3cb50bda400fa13d8c97 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Sun, 7 Apr 2013 10:20:30 -0700 Subject: [PATCH] Add no-window? parameter to gtk-graphics/open. --- src/gtk/gtk-graphics.scm | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/gtk/gtk-graphics.scm b/src/gtk/gtk-graphics.scm index a8921ffad..ff08b1ccf 100644 --- a/src/gtk/gtk-graphics.scm +++ b/src/gtk/gtk-graphics.scm @@ -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)))) -- 2.25.1