// Package gdk was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gdk import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) type MonitorClass struct { _ structs.HostLayout } func (x *MonitorClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // This enumeration describes how the red, green and blue components // of physical pixels on an output device are laid out. type SubpixelLayout int var xSubpixelLayoutGLibType func() types.GType func SubpixelLayoutGLibType() types.GType { return xSubpixelLayoutGLibType() } const ( // The layout is not known SubpixelLayoutUnknownValue SubpixelLayout = 0 // Not organized in this way SubpixelLayoutNoneValue SubpixelLayout = 1 // The layout is horizontal, the order is RGB SubpixelLayoutHorizontalRgbValue SubpixelLayout = 2 // The layout is horizontal, the order is BGR SubpixelLayoutHorizontalBgrValue SubpixelLayout = 3 // The layout is vertical, the order is RGB SubpixelLayoutVerticalRgbValue SubpixelLayout = 4 // The layout is vertical, the order is BGR SubpixelLayoutVerticalBgrValue SubpixelLayout = 5 ) // Represents the individual outputs that are associated with a `GdkDisplay`. // // `GdkDisplay` keeps a `GListModel` to enumerate and monitor // monitors with [method@Gdk.Display.get_monitors]. You can use // [method@Gdk.Display.get_monitor_at_surface] to find a particular // monitor. type Monitor struct { gobject.Object } var xMonitorGLibType func() types.GType func MonitorGLibType() types.GType { return xMonitorGLibType() } func MonitorNewFromInternalPtr(ptr uintptr) *Monitor { cls := &Monitor{} cls.Ptr = ptr return cls } var xMonitorGetConnector func(uintptr) string // Gets the name of the monitor's connector, if available. // // These are strings such as "eDP-1", or "HDMI-2". They depend // on software and hardware configuration, and should not be // relied on as stable identifiers of a specific monitor. func (x *Monitor) GetConnector() string { cret := xMonitorGetConnector(x.GoPointer()) return cret } var xMonitorGetDescription func(uintptr) string // Gets a string describing the monitor, if available. // // This can be used to identify a monitor in the UI. func (x *Monitor) GetDescription() string { cret := xMonitorGetDescription(x.GoPointer()) return cret } var xMonitorGetDisplay func(uintptr) uintptr // Gets the display that this monitor belongs to. func (x *Monitor) GetDisplay() *Display { var cls *Display cret := xMonitorGetDisplay(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Display{} cls.Ptr = cret return cls } var xMonitorGetGeometry func(uintptr, *Rectangle) // Retrieves the size and position of the monitor within the // display coordinate space. // // The returned geometry is in ”application pixels”, not in // ”device pixels” (see [method@Gdk.Monitor.get_scale]). func (x *Monitor) GetGeometry(GeometryVar *Rectangle) { xMonitorGetGeometry(x.GoPointer(), GeometryVar) } var xMonitorGetHeightMm func(uintptr) int // Gets the height in millimeters of the monitor. func (x *Monitor) GetHeightMm() int { cret := xMonitorGetHeightMm(x.GoPointer()) return cret } var xMonitorGetManufacturer func(uintptr) string // Gets the name or PNP ID of the monitor's manufacturer. // // Note that this value might also vary depending on actual // display backend. // // The PNP ID registry is located at // [https://uefi.org/pnp_id_list](https://uefi.org/pnp_id_list). func (x *Monitor) GetManufacturer() string { cret := xMonitorGetManufacturer(x.GoPointer()) return cret } var xMonitorGetModel func(uintptr) string // Gets the string identifying the monitor model, if available. func (x *Monitor) GetModel() string { cret := xMonitorGetModel(x.GoPointer()) return cret } var xMonitorGetRefreshRate func(uintptr) int // Gets the refresh rate of the monitor, if available. // // The value is in milli-Hertz, so a refresh rate of 60Hz // is returned as 60000. func (x *Monitor) GetRefreshRate() int { cret := xMonitorGetRefreshRate(x.GoPointer()) return cret } var xMonitorGetScale func(uintptr) float64 // Gets the internal scale factor that maps from monitor coordinates // to device pixels. // // This can be used if you want to create pixel based data for a // particular monitor, but most of the time you’re drawing to a surface // where it is better to use [method@Gdk.Surface.get_scale] instead. func (x *Monitor) GetScale() float64 { cret := xMonitorGetScale(x.GoPointer()) return cret } var xMonitorGetScaleFactor func(uintptr) int // Gets the internal scale factor that maps from monitor coordinates // to device pixels. // // On traditional systems this is 1, but on very high density outputs // it can be a higher value (often 2). // // This can be used if you want to create pixel based data for a // particular monitor, but most of the time you’re drawing to a surface // where it is better to use [method@Gdk.Surface.get_scale_factor] instead. func (x *Monitor) GetScaleFactor() int { cret := xMonitorGetScaleFactor(x.GoPointer()) return cret } var xMonitorGetSubpixelLayout func(uintptr) SubpixelLayout // Gets information about the layout of red, green and blue // primaries for pixels. func (x *Monitor) GetSubpixelLayout() SubpixelLayout { cret := xMonitorGetSubpixelLayout(x.GoPointer()) return cret } var xMonitorGetWidthMm func(uintptr) int // Gets the width in millimeters of the monitor. func (x *Monitor) GetWidthMm() int { cret := xMonitorGetWidthMm(x.GoPointer()) return cret } var xMonitorIsValid func(uintptr) bool // Returns %TRUE if the @monitor object corresponds to a // physical monitor. // // The @monitor becomes invalid when the physical monitor // is unplugged or removed. func (x *Monitor) IsValid() bool { cret := xMonitorIsValid(x.GoPointer()) return cret } func (c *Monitor) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *Monitor) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // GetPropertyConnector gets the "connector" property. // The connector name. func (x *Monitor) GetPropertyConnector() string { var v gobject.Value x.GetProperty("connector", &v) return v.GetString() } // GetPropertyDescription gets the "description" property. // A short description of the monitor, meant for display to the user. func (x *Monitor) GetPropertyDescription() string { var v gobject.Value x.GetProperty("description", &v) return v.GetString() } // GetPropertyGeometry gets the "geometry" property. // The geometry of the monitor. func (x *Monitor) GetPropertyGeometry() uintptr { var v gobject.Value x.GetProperty("geometry", &v) return v.GetPointer() } // GetPropertyHeightMm gets the "height-mm" property. // The height of the monitor, in millimeters. func (x *Monitor) GetPropertyHeightMm() int { var v gobject.Value x.GetProperty("height-mm", &v) return v.GetInt() } // GetPropertyManufacturer gets the "manufacturer" property. // The manufacturer name. func (x *Monitor) GetPropertyManufacturer() string { var v gobject.Value x.GetProperty("manufacturer", &v) return v.GetString() } // GetPropertyModel gets the "model" property. // The model name. func (x *Monitor) GetPropertyModel() string { var v gobject.Value x.GetProperty("model", &v) return v.GetString() } // GetPropertyRefreshRate gets the "refresh-rate" property. // The refresh rate, in milli-Hertz. func (x *Monitor) GetPropertyRefreshRate() int { var v gobject.Value x.GetProperty("refresh-rate", &v) return v.GetInt() } // GetPropertyScale gets the "scale" property. // The scale of the monitor. func (x *Monitor) GetPropertyScale() float64 { var v gobject.Value x.GetProperty("scale", &v) return v.GetDouble() } // GetPropertyScaleFactor gets the "scale-factor" property. // The scale factor. // // The scale factor is the next larger integer, // compared to [property@Gdk.Surface:scale]. func (x *Monitor) GetPropertyScaleFactor() int { var v gobject.Value x.GetProperty("scale-factor", &v) return v.GetInt() } // GetPropertyValid gets the "valid" property. // Whether the object is still valid. func (x *Monitor) GetPropertyValid() bool { var v gobject.Value x.GetProperty("valid", &v) return v.GetBoolean() } // GetPropertyWidthMm gets the "width-mm" property. // The width of the monitor, in millimeters. func (x *Monitor) GetPropertyWidthMm() int { var v gobject.Value x.GetProperty("width-mm", &v) return v.GetInt() } // Emitted when the output represented by @monitor gets disconnected. func (x *Monitor) ConnectInvalidate(cb *func(Monitor)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "invalidate", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr) { fa := Monitor{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "invalidate", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } func init() { core.SetPackageName("GDK", "gtk4") core.SetSharedLibraries("GDK", []string{"libgtk-4.so.1"}) var libs []uintptr for _, libPath := range core.GetPaths("GDK") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xSubpixelLayoutGLibType, libs, "gdk_subpixel_layout_get_type") core.PuregoSafeRegister(&xMonitorGLibType, libs, "gdk_monitor_get_type") core.PuregoSafeRegister(&xMonitorGetConnector, libs, "gdk_monitor_get_connector") core.PuregoSafeRegister(&xMonitorGetDescription, libs, "gdk_monitor_get_description") core.PuregoSafeRegister(&xMonitorGetDisplay, libs, "gdk_monitor_get_display") core.PuregoSafeRegister(&xMonitorGetGeometry, libs, "gdk_monitor_get_geometry") core.PuregoSafeRegister(&xMonitorGetHeightMm, libs, "gdk_monitor_get_height_mm") core.PuregoSafeRegister(&xMonitorGetManufacturer, libs, "gdk_monitor_get_manufacturer") core.PuregoSafeRegister(&xMonitorGetModel, libs, "gdk_monitor_get_model") core.PuregoSafeRegister(&xMonitorGetRefreshRate, libs, "gdk_monitor_get_refresh_rate") core.PuregoSafeRegister(&xMonitorGetScale, libs, "gdk_monitor_get_scale") core.PuregoSafeRegister(&xMonitorGetScaleFactor, libs, "gdk_monitor_get_scale_factor") core.PuregoSafeRegister(&xMonitorGetSubpixelLayout, libs, "gdk_monitor_get_subpixel_layout") core.PuregoSafeRegister(&xMonitorGetWidthMm, libs, "gdk_monitor_get_width_mm") core.PuregoSafeRegister(&xMonitorIsValid, libs, "gdk_monitor_is_valid") }