func displayFinalizer(d *Display) {
	runtime.SetFinalizer(d, func(d *Display) { gobject.Unref(d) })
}
Clear Display struct when it goes out of reach
package gdk3
import "C"
import "unsafe"
import "runtime"
import "github.com/norisatir/go-gtk3/gobject"
var GdkType gdkTypes
type gdkTypes struct {
	DEVICE        gobject.GType
	RECTANGLE     gobject.GType
	RGBA          gobject.GType
	COLOR         gobject.GType
	EVENT         gobject.GType
	DISPLAY       gobject.GType
	SCREEN        gobject.GType
	WINDOW        gobject.GType
	MODIFIER_TYPE gobject.GType
}
type Rectangle struct {
	X, Y          int
	Width, Height int
}
func newRectangleFromNative(obj unsafe.Pointer) interface{} {
	cr := *((*C.GdkRectangle)(obj))
	r := Rectangle{}
	r.X = int(cr.x)
	r.Y = int(cr.y)
	r.Width = int(cr.width)
	r.Height = int(cr.height)
	return r
}
func nativeFromRectangle(r interface{}) *gobject.GValue {
	if rec, ok := r.(Rectangle); ok {
		gv := gobject.CreateCGValue(GdkType.RECTANGLE, rec.ToNative())
		return gv
	}
	return nil
}
func (self Rectangle) GetBoxType() gobject.GType {
	return GdkType.RECTANGLE
}
func (self Rectangle) ToNative() unsafe.Pointer {
	var cr C.GdkRectangle
	cr.x = C.int(self.X)
	cr.y = C.int(self.Y)
	cr.width = C.int(self.Width)
	cr.height = C.int(self.Height)
	return unsafe.Pointer(&cr)
}
func (self Rectangle) Intersect(r2 Rectangle) (bool, Rectangle) {
	var cr3 C.GdkRectangle
	cr1 := nativeFromRectangle(self)
	defer cr1.Free()
	cr2 := nativeFromRectangle(r2)
	defer cr2.Free()
	b := C.gdk_rectangle_intersect((*C.GdkRectangle)(cr1.GetPtr()), (*C.GdkRectangle)(cr2.GetPtr()), &cr3)
	rec := newRectangleFromNative(unsafe.Pointer(&cr3)).(Rectangle)
	return gobject.GoBool(unsafe.Pointer(&b)), rec
}
func (self Rectangle) Union(r2 Rectangle) Rectangle {
	var cr3 C.GdkRectangle
	cr1 := nativeFromRectangle(self)
	defer cr1.Free()
	cr2 := nativeFromRectangle(r2)
	defer cr2.Free()
	C.gdk_rectangle_union((*C.GdkRectangle)(cr1.GetPtr()), (*C.GdkRectangle)(cr2.GetPtr()), &cr3)
	rec := newRectangleFromNative(unsafe.Pointer(&cr3)).(Rectangle)
	return rec
}
type RGBA struct {
	Red   float64
	Green float64
	Blue  float64
	Alpha float64
}
func newRGBAFromNative(obj unsafe.Pointer) interface{} {
	crgba := *((*C.GdkRGBA)(obj))
	rgba := RGBA{}
	rgba.Red = float64(crgba.red)
	rgba.Green = float64(crgba.green)
	rgba.Blue = float64(crgba.blue)
	rgba.Alpha = float64(crgba.alpha)
	return rgba
}
func nativeFromRGBA(rgba interface{}) *gobject.GValue {
	if r, ok := rgba.(RGBA); ok {
		gv := gobject.CreateCGValue(GdkType.RGBA, r.ToNative())
		return gv
	}
	return nil
}
func (self RGBA) GetBoxType() gobject.GType {
	return GdkType.RGBA
}
func (self RGBA) ToNative() unsafe.Pointer {
	crgba := C._new_rgba()
	crgba.red = C.gdouble(self.Red)
	crgba.green = C.gdouble(self.Green)
	crgba.blue = C.gdouble(self.Blue)
	crgba.alpha = C.gdouble(self.Alpha)
	return unsafe.Pointer(crgba)
}
type Color struct {
	Pixel uint32
	Red   uint16
	Green uint16
	Blue  uint16
}
func newColorFromNative(obj unsafe.Pointer) interface{} {
	cColor := *((*C.GdkColor)(obj))
	color := Color{}
	color.Pixel = uint32(cColor.pixel)
	color.Red = uint16(cColor.red)
	color.Green = uint16(cColor.green)
	color.Blue = uint16(cColor.blue)
	return color
}
func nativeFromColor(c interface{}) *gobject.GValue {
	if col, ok := c.(Color); ok {
		gv := gobject.CreateCGValue(GdkType.COLOR, col.ToNative())
		return gv
	}
	return nil
}
func (self Color) GetBoxType() gobject.GType {
	return GdkType.COLOR
}
func (self Color) ToNative() unsafe.Pointer {
	var cColor *C.GdkColor = C._new_color()
	cColor.pixel = C.guint32(self.Pixel)
	cColor.red = C.guint16(self.Red)
	cColor.green = C.guint16(self.Green)
	cColor.blue = C.guint16(self.Blue)
	return unsafe.Pointer(cColor)
}
type Atom struct {
	object *C.GdkAtom
}
func (self Atom) ToNative() unsafe.Pointer {
	if self.object == nil {
		return nil
	}
	return unsafe.Pointer(self.object)
}
func (self Atom) Name() string {
	if self.object == nil {
		return ""
	}
	s := C.gdk_atom_name(*self.object)
	return gobject.GoString(unsafe.Pointer(s))
}
func NewAtomFromNative(obj unsafe.Pointer) Atom {
	a := Atom{}
	a.object = new(C.GdkAtom)
	*a.object = *((*C.GdkAtom)(obj))
	return a
}
func AtomIntern(atomName string, onlyIfExists bool) Atom {
	s := gobject.GString(atomName)
	defer s.Free()
	b := gobject.GBool(onlyIfExists)
	defer b.Free()
	o := C.gdk_atom_intern((*C.gchar)(s.GetPtr()), *((*C.gboolean)(b.GetPtr())))
	a := Atom{}
	a.object = new(C.GdkAtom)
	*a.object = o
	return a
}
var GdkModifier gdkModifier
type gdkModifier struct {
	SHIFT_MASK    int
	LOCK_MASK     int
	CONTROL_MASK  int
	MOD1_MASK     int
	MOD2_MASK     int
	MOD3_MASK     int
	MOD4_MASK     int
	MOD5_MASK     int
	BUTTON1_MASK  int
	BUTTON2_MASK  int
	BUTTON3_MASK  int
	BUTTON4_MASK  int
	BUTTON5_MASK  int
	SUPER_MASK    int
	HYPER_MASK    int
	META_MASK     int
	RELEASE_MASK  int
	MODIFIER_MASK int
}
func gdkModifierFromNative(m unsafe.Pointer) interface{} {
	return int(*((*C.gint)(m)))
}
type EventLike interface {
	EventType() int
	GdkWindow() *Window
	SentExplicitly() bool
}
type EventAny struct {
	eventType int
	window    *Window
	sendEvent bool
}
func (self EventAny) EventType() int {
	return self.eventType
}
func (self EventAny) Window() *Window {
	return self.window
}
func (self EventAny) SentExplicitly() bool {
	return self.sendEvent
}
type EventKey struct {
	EventAny
	Time            uint32
	State           uint
	KeyVal          uint
	HardwareKeycode uint16
	Group           byte
	IsModifier      uint
}
func createEventKey(obj unsafe.Pointer) EventKey {
	ke := (*C.GdkEventKey)(obj)
	keyEvent := EventKey{}
	keyEvent.Time = uint32(ke.time)
	keyEvent.State = uint(ke.state)
	keyEvent.KeyVal = uint(ke.keyval)
	keyEvent.HardwareKeycode = uint16(ke.hardware_keycode)
	keyEvent.Group = byte(ke.group)
	keyEvent.IsModifier = uint(C.getModifiers(ke))
	return keyEvent
}
type EventButton struct {
	EventAny
	Time   uint32
	X      float64
	Y      float64
	State  uint
	Button uint
	Device *Device
	X_Root float64
	Y_Root float64
}
func createEventButton(obj unsafe.Pointer) EventButton {
	eb := (*C.GdkEventButton)(obj)
	eventButton := EventButton{}
	eventButton.Time = uint32(eb.time)
	eventButton.X = float64(eb.x)
	eventButton.Y = float64(eb.y)
	eventButton.State = uint(eb.state)
	eventButton.Button = uint(eb.button)
	eventButton.Device = nil
	if gd, err := gobject.ConvertToGo(unsafe.Pointer(eb.device), GdkType.DEVICE); err == nil {
		eventButton.Device = gd.(*Device)
	}
	eventButton.X_Root = float64(eb.x_root)
	eventButton.Y_Root = float64(eb.y_root)
	return eventButton
}
func newEventFromNative(obj unsafe.Pointer) interface{} {
	var window *Window = nil
	ceventAny := (*C.GdkEventAny)(obj)
	t := int(ceventAny._type)
	if win, err := gobject.ConvertToGo(unsafe.Pointer(ceventAny.window)); err == nil {
		window = win.(*Window)
	}
	se := ceventAny.send_event
	send := gobject.GoBool(unsafe.Pointer(&se))
	eventAny := EventAny{t, window, send}
	switch t {
	case GdkEventType.KEY_PRESS, GdkEventType.KEY_RELEASE:
		ek := createEventKey(obj)
		ek.EventAny = eventAny
		return ek
	case GdkEventType.BUTTON_PRESS, GdkEventType.BUTTON_PRESS_2, GdkEventType.BUTTON_PRESS_3,
		GdkEventType.BUTTON_RELEASE:
		eb := createEventButton(obj)
		eb.EventAny = eventAny
		return eb
	}
	return eventAny
}
var GdkEventMask gdkEventMask
type gdkEventMask struct {
	EXPOSURE_MASK            int
	POINTER_MOTION_MASK      int
	POINTER_MOTION_HINT_MASK int
	BUTTON_MOTION_MASK       int
	BUTTON1_MOTION_MASK      int
	BUTTON2_MOTION_MASK      int
	BUTTON3_MOTION_MASK      int
	BUTTON_PRESS_MASK        int
	BUTTON_RELEASE_MASK      int
	KEY_PRESS_MASK           int
	KEY_RELEASE_MASK         int
	ENTER_NOTIFY_MASK        int
	LEAVE_NOTIFY_MASK        int
	FOCUS_CHANGE_MASK        int
	STRUCTURE_MASK           int
	PROPERTY_CHANGE_MASK     int
	VISIBILITY_CHANGE_MASK   int
	PROXIMITY_IN_MASK        int
	PROXIMITY_OUT_MASK       int
	SUBSTRUCTURE_MASK        int
	SCROLL_MASK              int
	ALL_EVENTS_MASK          int
}
func init_mask() {
	GdkEventMask.EXPOSURE_MASK = 1 << 1
	GdkEventMask.POINTER_MOTION_MASK = 1 << 2
	GdkEventMask.POINTER_MOTION_HINT_MASK = 1 << 3
	GdkEventMask.BUTTON_MOTION_MASK = 1 << 4
	GdkEventMask.BUTTON1_MOTION_MASK = 1 << 5
	GdkEventMask.BUTTON2_MOTION_MASK = 1 << 6
	GdkEventMask.BUTTON3_MOTION_MASK = 1 << 7
	GdkEventMask.BUTTON_PRESS_MASK = 1 << 8
	GdkEventMask.BUTTON_RELEASE_MASK = 1 << 9
	GdkEventMask.KEY_PRESS_MASK = 1 << 10
	GdkEventMask.KEY_RELEASE_MASK = 1 << 11
	GdkEventMask.ENTER_NOTIFY_MASK = 1 << 12
	GdkEventMask.LEAVE_NOTIFY_MASK = 1 << 13
	GdkEventMask.FOCUS_CHANGE_MASK = 1 << 14
	GdkEventMask.STRUCTURE_MASK = 1 << 15
	GdkEventMask.PROPERTY_CHANGE_MASK = 1 << 16
	GdkEventMask.VISIBILITY_CHANGE_MASK = 1 << 17
	GdkEventMask.PROXIMITY_IN_MASK = 1 << 18
	GdkEventMask.PROXIMITY_OUT_MASK = 1 << 19
	GdkEventMask.SUBSTRUCTURE_MASK = 1 << 20
	GdkEventMask.SCROLL_MASK = 1 << 21
	GdkEventMask.ALL_EVENTS_MASK = 0x3FFFFE
}
var GdkEventType gdkEventType
type gdkEventType struct {
	NOTHING           int
	DELETE            int
	DESTROY           int
	EXPOSE            int
	MOTION_NOTIFY     int
	BUTTON_PRESS      int
	BUTTON_PRESS_2    int
	BUTTON_PRESS_3    int
	BUTTON_RELEASE    int
	KEY_PRESS         int
	KEY_RELEASE       int
	ENTER_NOTIFY      int
	LEAVE_NOTIFY      int
	FOCUS_CHANGE      int
	CONFIGURE         int
	MAP               int
	UNMAP             int
	PROPERTY_NOTIFY   int
	SELECTION_CLEAR   int
	SELECTION_REQUEST int
	SELECTION_NOTIFY  int
	PROXIMITY_IN      int
	PROXIMITY_OUT     int
	DRAG_ENTER        int
	DRAG_LEAVE        int
	DRAG_MOTION       int
	DRAG_STATUS       int
	DRAG_START        int
	DRAG_FINISHED     int
	CLIENT_EVENT      int
	VISIBILITY_NOTIFY int
	SCROLL            int
	WINDOW_STATE      int
	SETTING           int
	OWNER_CHANGE      int
	GRAB_BROKEN       int
	DAMAGE            int
}
func init_events() {
	GdkEventType.NOTHING = -1
	GdkEventType.DELETE = 0
	GdkEventType.DESTROY = 1
	GdkEventType.EXPOSE = 2
	GdkEventType.MOTION_NOTIFY = 3
	GdkEventType.BUTTON_PRESS = 4
	GdkEventType.BUTTON_PRESS_2 = 5
	GdkEventType.BUTTON_PRESS_3 = 6
	GdkEventType.BUTTON_RELEASE = 7
	GdkEventType.KEY_PRESS = 8
	GdkEventType.KEY_RELEASE = 9
	GdkEventType.ENTER_NOTIFY = 10
	GdkEventType.LEAVE_NOTIFY = 11
	GdkEventType.FOCUS_CHANGE = 12
	GdkEventType.CONFIGURE = 13
	GdkEventType.MAP = 14
	GdkEventType.UNMAP = 15
	GdkEventType.PROPERTY_NOTIFY = 16
	GdkEventType.SELECTION_CLEAR = 17
	GdkEventType.SELECTION_REQUEST = 18
	GdkEventType.SELECTION_NOTIFY = 19
	GdkEventType.PROXIMITY_IN = 20
	GdkEventType.PROXIMITY_OUT = 21
	GdkEventType.DRAG_ENTER = 22
	GdkEventType.DRAG_LEAVE = 23
	GdkEventType.DRAG_MOTION = 24
	GdkEventType.DRAG_STATUS = 25
	GdkEventType.DRAG_START = 26
	GdkEventType.DRAG_FINISHED = 27
	GdkEventType.CLIENT_EVENT = 28
	GdkEventType.VISIBILITY_NOTIFY = 29
	GdkEventType.SCROLL = 31
	GdkEventType.WINDOW_STATE = 32
	GdkEventType.SETTING = 33
	GdkEventType.OWNER_CHANGE = 34
	GdkEventType.GRAB_BROKEN = 35
	GdkEventType.DAMAGE = 36
}
func ThreadsInit() {
	C._gdk_threads_init()
}
func ThreadsEnter() {
	C.gdk_threads_enter()
}
func ThreadsLeave() {
	C.gdk_threads_leave()
}
type Display struct {
	object *C.GdkDisplay
}