func main() { disp := newDisplay() win := newWindow(disp, 250, 250) redraw(unsafe.Pointer(win), nil, 0) C.wl_display_iterate(disp.display, C.uint32_t(disp.mask)) time.Sleep(5 * time.Second) }
func newDisplay() *display { disp := &display{} disp.display = C.wl_display_connect(nil) fmt.Printf("Type of wl_display value: %T\n", disp.display) if disp.display == nil { panic("Could not connect to Wayland.") } C._wl_display_add_global_listener(disp.display, unsafe.Pointer(disp)) C.wl_display_iterate(disp.display, C.WL_DISPLAY_READABLE) C.wl_display_roundtrip(disp.display) if disp.formats&(1<<C.WL_SHM_FORMAT_XRGB8888) == 0 { panic("WL_SHM_FORMAT_XRGB32 not available") } C._wl_display_get_fd(disp.display, unsafe.Pointer(disp)) return disp }