Пример #1
0
func (d *Display) NewWindow(delegate ui.WinDelegate) ui.Win {
	w := C.XCreateSimpleWindow(d.dpy, C.XDefaultRootWindow(d.dpy),
		0, 0, 640, 400,
		0, 0, C.XWhitePixel(d.dpy, 0))
	C.XSelectInput(d.dpy, w, C.StructureNotifyMask|C.SubstructureNotifyMask|C.ExposureMask|C.KeyPress|C.KeyRelease|C.ButtonPress)
	C.XMapWindow(d.dpy, w)

	return &Window{
		delegate: delegate,
		dpy:      d,
		xw:       w,
	}
}
Пример #2
0
func init() {
	dpy = C.XOpenDisplay(nil)
	attributes.background_pixel = C.XWhitePixel(dpy, 0)
	root = C.XRootWindow(dpy, 0)
}