(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))))