// Code generated by cmd/cgo; DO NOT EDIT. //line /home/josie/.cache/paru/clone/wiiudownloader/src/pkg/mod/github.com/gotk3/gotk3@v0.6.5-0.20240618185848-ff349ae13f56/gdk/gdk_since_3_16.go:1:1 // +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12,!gtk_3_14 // Supports building with gtk 3.16+ /* * Copyright (c) 2013-2014 Conformal Systems * * This file originated from: http://opensource.conformal.com/ * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package gdk // #include // #include "gdk_since_3_16.go.h" import _ "unsafe" import ( "errors" "unsafe" "github.com/gotk3/gotk3/glib" ) func init() { tm := []glib.TypeMarshaler{ {glib.Type(( /*line :37:14*/_Cfunc_gdk_gl_context_get_type /*line :37:38*/)()), marshalGLContext}, } glib.RegisterGValueMarshalers(tm) } /* * Constants */ const ( GRAB_FAILED GrabStatus = ( /*line :48:27*/_Ciconst_GDK_GRAB_FAILED /*line :48:43*/) ) /* * GdkDevice */ // TODO: // gdk_device_get_vendor_id(). // gdk_device_get_product_id(). /* * GdkGLContext */ // GLContext is a representation of GDK's GdkGLContext. type GLContext struct { *glib.Object } // native returns a pointer to the underlying GdkGLContext. func (v *GLContext) native() * /*line :69:31*/_Ctype_GdkGLContext /*line :69:45*/ { if v == nil || v.GObject == nil { return nil } p := unsafe.Pointer(v.GObject) return func() *_Ctype_struct__GdkGLContext{ _cgo0 := /*line :74:26*/p; _cgoCheckPointer(_cgo0, nil); return /*line :74:28*/_Cfunc_toGdkGLContext(_cgo0); }() } // Native returns a pointer to the underlying GdkGLContext. func (v *GLContext) Native() uintptr { return uintptr(unsafe.Pointer(v.native())) } func marshalGLContext(p uintptr) (interface{}, error) { c := ( /*line :83:7*/_Cfunc_g_value_get_object /*line :83:26*/)((* /*line :83:30*/_Ctype_GValue /*line :83:38*/)(unsafe.Pointer(p))) obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} return &GLContext{obj}, nil } // GetDisplay is a wrapper around gdk_gl_context_get_display(). func (v *GLContext) GetDisplay() (*Display, error) { c := func() *_Ctype_struct__GdkDisplay{ _cgo0 := /*line :90:36*/v.native(); _cgoCheckPointer(_cgo0, nil); return /*line :90:47*/_Cfunc_gdk_gl_context_get_display(_cgo0); }() if c == nil { return nil, nilPtrErr } return &Display{glib.Take(unsafe.Pointer(c))}, nil } // GetWindow is a wrapper around gdk_gl_context_get_window(). func (v *GLContext) GetSurface() (*Window, error) { c := func() *_Ctype_struct__GdkWindow{ _cgo0 := /*line :100:35*/v.native(); _cgoCheckPointer(_cgo0, nil); return /*line :100:46*/_Cfunc_gdk_gl_context_get_window(_cgo0); }() if c == nil { return nil, nilPtrErr } return &Window{glib.Take(unsafe.Pointer(c))}, nil } // GetSharedContext is a wrapper around gdk_gl_context_get_shared_context(). func (v *GLContext) GetSharedContext() (*GLContext, error) { c := func() *_Ctype_struct__GdkGLContext{ _cgo0 := /*line :110:43*/v.native(); _cgoCheckPointer(_cgo0, nil); return /*line :110:54*/_Cfunc_gdk_gl_context_get_shared_context(_cgo0); }() if c == nil { return nil, nilPtrErr } return &GLContext{glib.Take(unsafe.Pointer(c))}, nil } // MajorVersion is a representation of OpenGL major version. type MajorVersion int // MinorVersion is a representation of OpenGL minor version. type MinorVersion int // GetVersion is a wrapper around gdk_gl_context_get_version(). func (v *GLContext) GetVersion() (MajorVersion, MinorVersion) { var major, minor int func() { _cgo0 := /*line :127:31*/v.native(); var _cgo1 *_Ctype_int = /*line :128:3*/(*_Ctype_int /*line :128:10*/)(unsafe.Pointer(&major)); var _cgo2 *_Ctype_int = /*line :128:37*/(*_Ctype_int /*line :128:44*/)(unsafe.Pointer(&minor)); _cgoCheckPointer(_cgo0, nil); /*line :128:70*/_Cfunc_gdk_gl_context_get_version(_cgo0, _cgo1, _cgo2); }() return MajorVersion(major), MinorVersion(minor) } // GetRequiredVersion is a wrapper around gdk_gl_context_get_required_version(). func (v *GLContext) GetRequiredVersion() (MajorVersion, MinorVersion) { var major, minor int func() { _cgo0 := /*line :136:40*/v.native(); var _cgo1 *_Ctype_int = /*line :137:3*/(*_Ctype_int /*line :137:10*/)(unsafe.Pointer(&major)); var _cgo2 *_Ctype_int = /*line :137:37*/(*_Ctype_int /*line :137:44*/)(unsafe.Pointer(&minor)); _cgoCheckPointer(_cgo0, nil); /*line :137:70*/_Cfunc_gdk_gl_context_get_required_version(_cgo0, _cgo1, _cgo2); }() return MajorVersion(major), MinorVersion(minor) } // SetRequiredVersion is a wrapper around gdk_gl_context_set_required_version(). func (v *GLContext) SetRequiredVersion(major, minor int) { func() { _cgo0 := /*line :144:40*/v.native(); var _cgo1 _Ctype_int = /*line :144:52*/(_Ctype_int /*line :144:58*/)(major); var _cgo2 _Ctype_int = /*line :144:68*/(_Ctype_int /*line :144:74*/)(minor); _cgoCheckPointer(_cgo0, nil); /*line :144:83*/_Cfunc_gdk_gl_context_set_required_version(_cgo0, _cgo1, _cgo2); }() } // GetDebugEnabled is a wrapper around gdk_gl_context_get_debug_enabled(). func (v *GLContext) GetDebugEnabled() bool { return gobool(func() _Ctype_gboolean{ _cgo0 := /*line :149:51*/v.native(); _cgoCheckPointer(_cgo0, nil); return /*line :149:62*/_Cfunc_gdk_gl_context_get_debug_enabled(_cgo0); }()) } // SetDebugEnabled is a wrapper around gdk_gl_context_set_debug_enabled(). func (v *GLContext) SetDebugEnabled(enabled bool) { func() { _cgo0 := /*line :154:37*/v.native(); var _cgo1 _Ctype_gboolean = /*line :154:49*/gbool(enabled); _cgoCheckPointer(_cgo0, nil); /*line :154:64*/_Cfunc_gdk_gl_context_set_debug_enabled(_cgo0, _cgo1); }() } // GetForwardCompatible is a wrapper around gdk_gl_context_get_forward_compatible(). func (v *GLContext) GetForwardCompatible() bool { return gobool(func() _Ctype_gboolean{ _cgo0 := /*line :159:56*/v.native(); _cgoCheckPointer(_cgo0, nil); return /*line :159:67*/_Cfunc_gdk_gl_context_get_forward_compatible(_cgo0); }()) } // SetForwardCompatible is a wrapper around gdk_gl_context_set_forward_compatible(). func (v *GLContext) SetForwardCompatible(compatible bool) { func() { _cgo0 := /*line :164:42*/v.native(); var _cgo1 _Ctype_gboolean = /*line :164:54*/gbool(compatible); _cgoCheckPointer(_cgo0, nil); /*line :164:72*/_Cfunc_gdk_gl_context_set_forward_compatible(_cgo0, _cgo1); }() } // Realize is a wrapper around gdk_gl_context_realize(). func (v *GLContext) Realize() (bool, error) { var err * /*line :169:11*/_Ctype_GError /*line :169:19*/ r := gobool(func() _Ctype_gboolean{ _cgo0 := /*line :170:39*/v.native(); _cgoBase1 := /*line :170:51*/&err; _cgo1 := _cgoBase1; _cgoCheckPointer(_cgo0, nil); _cgoCheckPointer(_cgoBase1, 0 == 0); return /*line :170:56*/_Cfunc_gdk_gl_context_realize(_cgo0, _cgo1); }()) if !r { defer func() func() { _cgo0 := /*line :172:24*/err; return func() { _cgoCheckPointer(_cgo0, nil); /*line :172:28*/_Cfunc_g_error_free(_cgo0); }}()() return r, errors.New(( /*line :173:24*/_Cfunc_GoString /*line :173:33*/)((* /*line :173:37*/_Ctype_char /*line :173:43*/)(err.message))) } return r, nil } // MakeCurrent is a wrapper around gdk_gl_context_make_current(). func (v *GLContext) MakeCurrent() { func() { _cgo0 := /*line :181:32*/v.native(); _cgoCheckPointer(_cgo0, nil); /*line :181:43*/_Cfunc_gdk_gl_context_make_current(_cgo0); }() } // GetCurrent is a wrapper around gdk_gl_context_get_current(). func GetCurrent() (*GLContext, error) { c := ( /*line :186:7*/_Cfunc_gdk_gl_context_get_current /*line :186:34*/)() if c == nil { return nil, nilPtrErr } return &GLContext{glib.Take(unsafe.Pointer(c))}, nil } // ClearCurrent is a wrapper around gdk_gl_context_clear_current(). func ClearCurrent() { ( /*line :196:2*/_Cfunc_gdk_gl_context_clear_current /*line :196:31*/)() }