func (w *Window) SetShape(r Rect) {
	C.GalliumWindowSetShape(w.c, C.int(r.Width), C.int(r.Height), C.int(r.Left), C.int(r.Bottom))
}
Shape gets the current shape of the window.
package gallium
import "C"
import (
	"errors"
	"fmt"
	"log"
	"os"
	"path/filepath"
	"time"
	"unsafe"
)
var (
	errZeroWidth  = errors.New("window width was zero")
	errZeroHeight = errors.New("window height was zero")
)
type cerr struct {
	c *C.struct_gallium_error
}
func newCerr() cerr {
	return cerr{
		c: (*C.struct_gallium_error)(C.malloc(C.sizeof_struct_gallium_error)),
	}
}
func (e cerr) free() {
	C.free(unsafe.Pointer(e.c))
}
func (e *cerr) err() error {
	return fmt.Errorf("C error")
}
func Loop(args []string, onReady func(*App)) error {
	log.Println("\n\n=== gallium.Loop ===")
	cerr := newCerr()
	defer cerr.free()
	app := App{
		ready: make(chan struct{}),
	}
	go func() {
		select {
		case <-app.ready:
			onReady(&app)
		case <-time.After(3 * time.Second):
			log.Fatal("Waited for 3 seconds without ready signal")
		}
	}()
	appId := apps.add(&app)
	C.helper_GalliumLoop(C.int(appId), C.CString(args[0]), &cerr.c)
	return cerr.err()
}
type appManager []*App
func (m *appManager) add(app *App) int {
	id := len(*m)
	*m = append(*m, app)
	return id
}
func (m *appManager) get(id int) *App {
	return (*m)[id]
}
var apps appManager
type App struct {
	ready chan struct{}
}
type WindowOptions struct {
	Title            string  
	Shape            Rect    
	TitleBar         bool    
	Frame            bool    
	Resizable        bool    
	CloseButton      bool    
	MinButton        bool    
	FullScreenButton bool    
	Menu             []MenuEntry
}
var FramedWindow = WindowOptions{
	Shape: Rect{
		Width:  800,
		Height: 600,
		Left:   100,
		Bottom: 100,
	},
	TitleBar:         true,
	Frame:            true,
	Resizable:        true,
	CloseButton:      true,
	MinButton:        true,
	FullScreenButton: true,
	Title:            defaultWindowTitle(),
}
func defaultWindowTitle() string {
	if name := BundleInfo("CFBundleDisplayName"); name != "" {
		return name
	}
	if name := BundleInfo("CFBundleName"); name != "" {
		return name
	}
	if len(os.Args) > 0 {
		filepath.Base(os.Args[0])
	}
	return ""
}
var FramelessWindow = WindowOptions{
	Shape: Rect{
		Width:  800,
		Height: 600,
		Left:   100,
		Bottom: 100,
	},
	Resizable: true,
}
type Window struct {
	c *C.gallium_window_t
}
func (app *App) OpenWindow(url string, opt WindowOptions) (*Window, error) {
	if opt.Shape.Width == 0 {
		return nil, errZeroWidth
	}
	if opt.Shape.Height == 0 {
		return nil, errZeroHeight
	}
	cwin := C.GalliumOpenWindow(
		C.CString(url),
		C.CString(opt.Title),
		C.int(opt.Shape.Width),
		C.int(opt.Shape.Height),
		C.int(opt.Shape.Left),
		C.int(opt.Shape.Bottom),
		C.bool(opt.TitleBar),
		C.bool(opt.Frame),
		C.bool(opt.Resizable),
		C.bool(opt.CloseButton),
		C.bool(opt.MinButton),
		C.bool(opt.FullScreenButton))
	return &Window{
		c: cwin,
	}, nil
}
func (w *Window) Shape() Rect {
	return rectFromC(C.GalliumWindowGetShape(w.c))
}