v0.2.1 c0399be

gtkgraphicsoffload.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11	"github.com/bnema/puregotk/v4/gobject"
12	"github.com/bnema/puregotk/v4/gobject/types"
13)
14
15type GraphicsOffloadClass struct {
16	_ structs.HostLayout
17
18	ParentClass WidgetClass
19}
20
21func (x *GraphicsOffloadClass) GoPointer() uintptr {
22	return uintptr(unsafe.Pointer(x))
23}
24
25// Represents the state of graphics offloading.
26type GraphicsOffloadEnabled int
27
28var xGraphicsOffloadEnabledGLibType func() types.GType
29
30func GraphicsOffloadEnabledGLibType() types.GType {
31	return xGraphicsOffloadEnabledGLibType()
32}
33
34const (
35
36	// Graphics offloading is enabled.
37	GraphicsOffloadEnabledValue GraphicsOffloadEnabled = 0
38	// Graphics offloading is disabled.
39	GraphicsOffloadDisabledValue GraphicsOffloadEnabled = 1
40)
41
42// Bypasses gsk rendering by passing the content of its child directly to the compositor.
43//
44// Graphics offload is an optimization to reduce overhead and battery use that is
45// most useful for video content. It only works on some platforms and in certain
46// situations. GTK will automatically fall back to normal rendering if it doesn't.
47//
48// Graphics offload is most efficient if there are no controls drawn on top of the
49// video content.
50//
51// You should consider using graphics offload for your main widget if it shows
52// frequently changing content (such as a video, or a VM display) and you provide
53// the content in the form of dmabuf textures (see [class@Gdk.DmabufTextureBuilder]),
54// in particular if it may be fullscreen.
55//
56// Numerous factors can prohibit graphics offload:
57//
58// - Unsupported platforms. Currently, graphics offload only works on Linux with Wayland.
59//
60// - Clipping, such as rounded corners that cause the video content to not be rectangular
61//
62// - Unsupported dmabuf formats (see [method@Gdk.Display.get_dmabuf_formats])
63//
64// - Translucent video content (content with an alpha channel, even if it isn't used)
65//
66// - Transforms that are more complex than translations and scales
67//
68// - Filters such as opacity, grayscale or similar
69//
70// To investigate problems related graphics offload, GTK offers debug flags to print
71// out information about graphics offload and dmabuf use:
72//
73//	GDK_DEBUG=offload
74//	GDK_DEBUG=dmabuf
75//
76// The GTK inspector provides a visual debugging tool for graphics offload.
77type GraphicsOffload struct {
78	Widget
79}
80
81var xGraphicsOffloadGLibType func() types.GType
82
83func GraphicsOffloadGLibType() types.GType {
84	return xGraphicsOffloadGLibType()
85}
86
87func GraphicsOffloadNewFromInternalPtr(ptr uintptr) *GraphicsOffload {
88	cls := &GraphicsOffload{}
89	cls.Ptr = ptr
90	return cls
91}
92
93var xNewGraphicsOffload func(uintptr) uintptr
94
95// Creates a new GtkGraphicsOffload widget.
96func NewGraphicsOffload(ChildVar *Widget) *GraphicsOffload {
97	var cls *GraphicsOffload
98
99	cret := xNewGraphicsOffload(ChildVar.GoPointer())
100
101	if cret == 0 {
102		return nil
103	}
104	gobject.IncreaseRef(cret)
105	cls = &GraphicsOffload{}
106	cls.Ptr = cret
107	return cls
108}
109
110var xGraphicsOffloadGetBlackBackground func(uintptr) bool
111
112// Returns whether the widget draws a black background.
113//
114// See [method@Gtk.GraphicsOffload.set_black_background].
115func (x *GraphicsOffload) GetBlackBackground() bool {
116
117	cret := xGraphicsOffloadGetBlackBackground(x.GoPointer())
118	return cret
119}
120
121var xGraphicsOffloadGetChild func(uintptr) uintptr
122
123// Gets the child of @self.
124func (x *GraphicsOffload) GetChild() *Widget {
125	var cls *Widget
126
127	cret := xGraphicsOffloadGetChild(x.GoPointer())
128
129	if cret == 0 {
130		return nil
131	}
132	gobject.IncreaseRef(cret)
133	cls = &Widget{}
134	cls.Ptr = cret
135	return cls
136}
137
138var xGraphicsOffloadGetEnabled func(uintptr) GraphicsOffloadEnabled
139
140// Returns whether offload is enabled for @self.
141func (x *GraphicsOffload) GetEnabled() GraphicsOffloadEnabled {
142
143	cret := xGraphicsOffloadGetEnabled(x.GoPointer())
144	return cret
145}
146
147var xGraphicsOffloadSetBlackBackground func(uintptr, bool)
148
149// Sets whether this GtkGraphicsOffload widget will draw a black
150// background.
151//
152// A main use case for this is **_letterboxing_** where black bars are
153// visible next to the content if the aspect ratio of the content does
154// not match the dimensions of the monitor.
155//
156// Using this property for letterboxing instead of CSS allows compositors
157// to show content with maximum efficiency, using direct scanout to avoid
158// extra copies in the compositor.
159//
160// On Wayland, this is implemented using the
161// [single-pixel buffer](https://wayland.app/protocols/single-pixel-buffer-v1)
162// protocol.
163func (x *GraphicsOffload) SetBlackBackground(ValueVar bool) {
164
165	xGraphicsOffloadSetBlackBackground(x.GoPointer(), ValueVar)
166
167}
168
169var xGraphicsOffloadSetChild func(uintptr, uintptr)
170
171// Sets the child of @self.
172func (x *GraphicsOffload) SetChild(ChildVar *Widget) {
173
174	xGraphicsOffloadSetChild(x.GoPointer(), ChildVar.GoPointer())
175
176}
177
178var xGraphicsOffloadSetEnabled func(uintptr, GraphicsOffloadEnabled)
179
180// Sets whether this GtkGraphicsOffload widget will attempt
181// to offload the content of its child widget.
182func (x *GraphicsOffload) SetEnabled(EnabledVar GraphicsOffloadEnabled) {
183
184	xGraphicsOffloadSetEnabled(x.GoPointer(), EnabledVar)
185
186}
187
188func (c *GraphicsOffload) GoPointer() uintptr {
189	if c == nil {
190		return 0
191	}
192	return c.Ptr
193}
194
195func (c *GraphicsOffload) SetGoPointer(ptr uintptr) {
196	c.Ptr = ptr
197}
198
199// SetPropertyBlackBackground sets the "black-background" property.
200// Whether to draw a black background.
201func (x *GraphicsOffload) SetPropertyBlackBackground(value bool) {
202	var v gobject.Value
203	v.Init(gobject.TypeBooleanVal)
204	v.SetBoolean(value)
205	x.SetProperty("black-background", &v)
206}
207
208// GetPropertyBlackBackground gets the "black-background" property.
209// Whether to draw a black background.
210func (x *GraphicsOffload) GetPropertyBlackBackground() bool {
211	var v gobject.Value
212	x.GetProperty("black-background", &v)
213	return v.GetBoolean()
214}
215
216// Requests the user's screen reader to announce the given message.
217//
218// This kind of notification is useful for messages that
219// either have only a visual representation or that are not
220// exposed visually at all, e.g. a notification about a
221// successful operation.
222//
223// Also, by using this API, you can ensure that the message
224// does not interrupts the user's current screen reader output.
225func (x *GraphicsOffload) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
226
227	XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
228
229}
230
231// Retrieves the accessible parent for an accessible object.
232//
233// This function returns `NULL` for top level widgets.
234func (x *GraphicsOffload) GetAccessibleParent() *AccessibleBase {
235	var cls *AccessibleBase
236
237	cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
238
239	if cret == 0 {
240		return nil
241	}
242	cls = &AccessibleBase{}
243	cls.Ptr = cret
244	return cls
245}
246
247// Retrieves the accessible role of an accessible object.
248func (x *GraphicsOffload) GetAccessibleRole() AccessibleRole {
249
250	cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
251	return cret
252}
253
254// Retrieves the implementation for the given accessible object.
255func (x *GraphicsOffload) GetAtContext() *ATContext {
256	var cls *ATContext
257
258	cret := XGtkAccessibleGetAtContext(x.GoPointer())
259
260	if cret == 0 {
261		return nil
262	}
263	cls = &ATContext{}
264	cls.Ptr = cret
265	return cls
266}
267
268// Queries the coordinates and dimensions of this accessible
269//
270// This functionality can be overridden by `GtkAccessible`
271// implementations, e.g. to get the bounds from an ignored
272// child widget.
273func (x *GraphicsOffload) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
274
275	cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
276	return cret
277}
278
279// Retrieves the first accessible child of an accessible object.
280func (x *GraphicsOffload) GetFirstAccessibleChild() *AccessibleBase {
281	var cls *AccessibleBase
282
283	cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
284
285	if cret == 0 {
286		return nil
287	}
288	cls = &AccessibleBase{}
289	cls.Ptr = cret
290	return cls
291}
292
293// Retrieves the next accessible sibling of an accessible object
294func (x *GraphicsOffload) GetNextAccessibleSibling() *AccessibleBase {
295	var cls *AccessibleBase
296
297	cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
298
299	if cret == 0 {
300		return nil
301	}
302	cls = &AccessibleBase{}
303	cls.Ptr = cret
304	return cls
305}
306
307// Queries a platform state, such as focus.
308//
309// This functionality can be overridden by `GtkAccessible`
310// implementations, e.g. to get platform state from an ignored
311// child widget, as is the case for `GtkText` wrappers.
312func (x *GraphicsOffload) GetPlatformState(StateVar AccessiblePlatformState) bool {
313
314	cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
315	return cret
316}
317
318// Resets the accessible property to its default value.
319func (x *GraphicsOffload) ResetProperty(PropertyVar AccessibleProperty) {
320
321	XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
322
323}
324
325// Resets the accessible relation to its default value.
326func (x *GraphicsOffload) ResetRelation(RelationVar AccessibleRelation) {
327
328	XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
329
330}
331
332// Resets the accessible state to its default value.
333func (x *GraphicsOffload) ResetState(StateVar AccessibleState) {
334
335	XGtkAccessibleResetState(x.GoPointer(), StateVar)
336
337}
338
339// Sets the parent and sibling of an accessible object.
340//
341// This function is meant to be used by accessible implementations that are
342// not part of the widget hierarchy, and but act as a logical bridge between
343// widgets. For instance, if a widget creates an object that holds metadata
344// for each child, and you want that object to implement the `GtkAccessible`
345// interface, you will use this function to ensure that the parent of each
346// child widget is the metadata object, and the parent of each metadata
347// object is the container widget.
348func (x *GraphicsOffload) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
349
350	XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
351
352}
353
354// Updates the next accessible sibling.
355//
356// That might be useful when a new child of a custom accessible
357// is created, and it needs to be linked to a previous child.
358func (x *GraphicsOffload) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
359
360	XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
361
362}
363
364// Informs ATs that the platform state has changed.
365//
366// This function should be used by `GtkAccessible` implementations that
367// have a platform state but are not widgets. Widgets handle platform
368// states automatically.
369func (x *GraphicsOffload) UpdatePlatformState(StateVar AccessiblePlatformState) {
370
371	XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
372
373}
374
375// Updates a list of accessible properties.
376//
377// See the [enum@Gtk.AccessibleProperty] documentation for the
378// value types of accessible properties.
379//
380// This function should be called by `GtkWidget` types whenever
381// an accessible property change must be communicated to assistive
382// technologies.
383//
384// Example:
385// ```c
386// value = gtk_adjustment_get_value (adjustment);
387// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
388//
389//	GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
390//	-1);
391//
392// ```
393func (x *GraphicsOffload) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
394
395	XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
396
397}
398
399// Updates an array of accessible properties.
400//
401// This function should be called by `GtkWidget` types whenever an accessible
402// property change must be communicated to assistive technologies.
403//
404// This function is meant to be used by language bindings.
405func (x *GraphicsOffload) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
406
407	XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
408
409}
410
411// Updates a list of accessible relations.
412//
413// This function should be called by `GtkWidget` types whenever an accessible
414// relation change must be communicated to assistive technologies.
415//
416// If the [enum@Gtk.AccessibleRelation] requires a list of references,
417// you should pass each reference individually, followed by `NULL`, e.g.
418//
419// ```c
420// gtk_accessible_update_relation (accessible,
421//
422//	GTK_ACCESSIBLE_RELATION_CONTROLS,
423//	  ref1, NULL,
424//	GTK_ACCESSIBLE_RELATION_LABELLED_BY,
425//	  ref1, ref2, ref3, NULL,
426//	-1);
427//
428// ```
429func (x *GraphicsOffload) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
430
431	XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
432
433}
434
435// Updates an array of accessible relations.
436//
437// This function should be called by `GtkWidget` types whenever an accessible
438// relation change must be communicated to assistive technologies.
439//
440// This function is meant to be used by language bindings.
441func (x *GraphicsOffload) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
442
443	XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
444
445}
446
447// Updates a list of accessible states.
448//
449// See the [enum@Gtk.AccessibleState] documentation for the
450// value types of accessible states.
451//
452// This function should be called by `GtkWidget` types whenever
453// an accessible state change must be communicated to assistive
454// technologies.
455//
456// Example:
457//
458// ```c
459// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
460// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
461//
462//	GTK_ACCESSIBLE_STATE_CHECKED, value,
463//	-1);
464//
465// ```
466func (x *GraphicsOffload) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
467
468	XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
469
470}
471
472// Updates an array of accessible states.
473//
474// This function should be called by `GtkWidget` types whenever an accessible
475// state change must be communicated to assistive technologies.
476//
477// This function is meant to be used by language bindings.
478func (x *GraphicsOffload) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
479
480	XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
481
482}
483
484// Gets the ID of the @buildable object.
485//
486// `GtkBuilder` sets the name based on the ID attribute
487// of the `<object>` tag used to construct the @buildable.
488func (x *GraphicsOffload) GetBuildableId() string {
489
490	cret := XGtkBuildableGetBuildableId(x.GoPointer())
491	return cret
492}
493
494func init() {
495	core.SetPackageName("GTK", "gtk4")
496	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
497	var libs []uintptr
498	for _, libPath := range core.GetPaths("GTK") {
499		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
500		if err != nil {
501			panic(err)
502		}
503		libs = append(libs, lib)
504	}
505
506	core.PuregoSafeRegister(&xGraphicsOffloadEnabledGLibType, libs, "gtk_graphics_offload_enabled_get_type")
507
508	core.PuregoSafeRegister(&xGraphicsOffloadGLibType, libs, "gtk_graphics_offload_get_type")
509
510	core.PuregoSafeRegister(&xNewGraphicsOffload, libs, "gtk_graphics_offload_new")
511
512	core.PuregoSafeRegister(&xGraphicsOffloadGetBlackBackground, libs, "gtk_graphics_offload_get_black_background")
513	core.PuregoSafeRegister(&xGraphicsOffloadGetChild, libs, "gtk_graphics_offload_get_child")
514	core.PuregoSafeRegister(&xGraphicsOffloadGetEnabled, libs, "gtk_graphics_offload_get_enabled")
515	core.PuregoSafeRegister(&xGraphicsOffloadSetBlackBackground, libs, "gtk_graphics_offload_set_black_background")
516	core.PuregoSafeRegister(&xGraphicsOffloadSetChild, libs, "gtk_graphics_offload_set_child")
517	core.PuregoSafeRegister(&xGraphicsOffloadSetEnabled, libs, "gtk_graphics_offload_set_enabled")
518
519}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close