Exemple #1
0
func (window *XWindow) Create(width uint, height uint, title string) bool {
	dpy := C.XOpenDisplay(nil)
	scr := C.XDefaultScreen(dpy)
	root := C.XDefaultRootWindow(dpy)

	win := C.XCreateSimpleWindow(dpy, root, 0, 0, C.uint(width), C.uint(height), 0, C.XBlackPixel(dpy, scr), C.XBlackPixel(dpy, scr))

	C.XStoreName(dpy, win, C.CString(title))
	C.XMapWindow(dpy, win)

	window.dpy = dpy

	return true
}
Exemple #2
0
func Screen() (C.uint, C.uint, C.uint) {
	//
	d := C.CString(dspl)
	defer C.free(unsafe.Pointer(d))
	display = C.XOpenDisplay(d)
	if display == nil {
		panic("display == nil") /* Terminate (); */ os.Exit(1)
	}
	window0 = C.XDefaultRootWindow(display)
	screen = C.XDefaultScreen(display)
	return C.uint(C.XDisplayWidth(display, screen)),
		C.uint(C.XDisplayHeight(display, screen)),
		C.uint(C.XDefaultDepth(display, screen))
}