v0.2.1 c0399be

gdkdisplaymanager.go RawHistoryFolder

1// Package gdk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gdk
3
4import (
5	"unsafe"
6
7	"github.com/ebitengine/purego"
8
9	"github.com/bnema/puregotk/pkg/core"
10	"github.com/bnema/puregotk/v4/glib"
11	"github.com/bnema/puregotk/v4/gobject"
12	"github.com/bnema/puregotk/v4/gobject/types"
13)
14
15var xSetAllowedBackends func(string)
16
17// Sets a list of backends that GDK should try to use.
18//
19// This can be useful if your application does not
20// work with certain GDK backends.
21//
22// By default, GDK tries all included backends.
23//
24// For example:
25//
26// ```c
27// gdk_set_allowed_backends ("wayland,macos,*");
28// ```
29//
30// instructs GDK to try the Wayland backend first, followed by the
31// MacOs backend, and then all others.
32//
33// If the `GDK_BACKEND` environment variable is set, it determines
34// what backends are tried in what order, while still respecting the
35// set of allowed backends that are specified by this function.
36//
37// The possible backend names are:
38//
39//   - `broadway`
40//   - `macos`
41//   - `wayland`.
42//   - `win32`
43//   - `x11`
44//
45// You can also include a `*` in the list to try all remaining backends.
46//
47// This call must happen prior to functions that open a display, such
48// as [func@Gdk.Display.open], `gtk_init()`, or `gtk_init_check()`
49// in order to take effect.
50func SetAllowedBackends(BackendsVar string) {
51
52	xSetAllowedBackends(BackendsVar)
53
54}
55
56// Offers notification when displays appear or disappear.
57//
58// `GdkDisplayManager` is a singleton object.
59//
60// You can use [func@Gdk.DisplayManager.get] to obtain the `GdkDisplayManager`
61// singleton, but that should be rarely necessary. Typically, initializing
62// GTK opens a display that you can work with without ever accessing the
63// `GdkDisplayManager`.
64//
65// The GDK library can be built with support for multiple backends.
66// The `GdkDisplayManager` object determines which backend is used
67// at runtime.
68//
69// In the rare case that you need to influence which of the backends
70// is being used, you can use [func@Gdk.set_allowed_backends]. Note
71// that you need to call this function before initializing GTK.
72//
73// ## Backend-specific code
74//
75// When writing backend-specific code that is supposed to work with
76// multiple GDK backends, you have to consider both compile time and
77// runtime. At compile time, use the `GDK_WINDOWING_X11`, `GDK_WINDOWING_WIN32`
78// macros, etc. to find out which backends are present in the GDK library
79// you are building your application against. At runtime, use type-check
80// macros like GDK_IS_X11_DISPLAY() to find out which backend is in use:
81//
82// ```c
83// #ifdef GDK_WINDOWING_X11
84//
85//	if (GDK_IS_X11_DISPLAY (display))
86//	  {
87//	    // make X11-specific calls here
88//	  }
89//	else
90//
91// #endif
92// #ifdef GDK_WINDOWING_MACOS
93//
94//	if (GDK_IS_MACOS_DISPLAY (display))
95//	  {
96//	    // make Quartz-specific calls here
97//	  }
98//	else
99//
100// #endif
101//
102//	g_error ("Unsupported GDK backend");
103//
104// ```
105type DisplayManager struct {
106	gobject.Object
107}
108
109var xDisplayManagerGLibType func() types.GType
110
111func DisplayManagerGLibType() types.GType {
112	return xDisplayManagerGLibType()
113}
114
115func DisplayManagerNewFromInternalPtr(ptr uintptr) *DisplayManager {
116	cls := &DisplayManager{}
117	cls.Ptr = ptr
118	return cls
119}
120
121var xDisplayManagerGetDefaultDisplay func(uintptr) uintptr
122
123// Gets the default `GdkDisplay`.
124func (x *DisplayManager) GetDefaultDisplay() *Display {
125	var cls *Display
126
127	cret := xDisplayManagerGetDefaultDisplay(x.GoPointer())
128
129	if cret == 0 {
130		return nil
131	}
132	gobject.IncreaseRef(cret)
133	cls = &Display{}
134	cls.Ptr = cret
135	return cls
136}
137
138var xDisplayManagerListDisplays func(uintptr) *glib.SList
139
140// List all currently open displays.
141func (x *DisplayManager) ListDisplays() *glib.SList {
142
143	cret := xDisplayManagerListDisplays(x.GoPointer())
144	return cret
145}
146
147var xDisplayManagerOpenDisplay func(uintptr, uintptr) uintptr
148
149// Opens a display.
150func (x *DisplayManager) OpenDisplay(NameVar *string) *Display {
151	var cls *Display
152
153	NameVarPtr := core.GStrdupNullable(NameVar)
154	defer core.GFreeNullable(NameVarPtr)
155
156	cret := xDisplayManagerOpenDisplay(x.GoPointer(), NameVarPtr)
157
158	if cret == 0 {
159		return nil
160	}
161	gobject.IncreaseRef(cret)
162	cls = &Display{}
163	cls.Ptr = cret
164	return cls
165}
166
167var xDisplayManagerSetDefaultDisplay func(uintptr, uintptr)
168
169// Sets @display as the default display.
170func (x *DisplayManager) SetDefaultDisplay(DisplayVar *Display) {
171
172	xDisplayManagerSetDefaultDisplay(x.GoPointer(), DisplayVar.GoPointer())
173
174}
175
176func (c *DisplayManager) GoPointer() uintptr {
177	if c == nil {
178		return 0
179	}
180	return c.Ptr
181}
182
183func (c *DisplayManager) SetGoPointer(ptr uintptr) {
184	c.Ptr = ptr
185}
186
187// Emitted when a display is opened.
188func (x *DisplayManager) ConnectDisplayOpened(cb *func(DisplayManager, uintptr)) uint {
189	cbPtr := uintptr(unsafe.Pointer(cb))
190	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
191		handlerID := gobject.SignalConnect(x.GoPointer(), "display-opened", cbRefPtr)
192		glib.SaveHandlerMapping(handlerID, cbPtr)
193		return handlerID
194	}
195
196	fcb := func(clsPtr uintptr, DisplayVarp uintptr) {
197		fa := DisplayManager{}
198		fa.Ptr = clsPtr
199		cbFn := *cb
200
201		cbFn(fa, DisplayVarp)
202
203	}
204	cbRefPtr := purego.NewCallback(fcb)
205	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
206	handlerID := gobject.SignalConnect(x.GoPointer(), "display-opened", cbRefPtr)
207	glib.SaveHandlerMapping(handlerID, cbPtr)
208	return handlerID
209}
210
211var xDisplayManagerGet func() uintptr
212
213// Gets the singleton `GdkDisplayManager` object.
214//
215// When called for the first time, this function consults the
216// `GDK_BACKEND` environment variable to find out which of the
217// supported GDK backends to use (in case GDK has been compiled
218// with multiple backends).
219//
220// Applications can use [func@set_allowed_backends] to limit what
221// backends will be used.
222func DisplayManagerGet() *DisplayManager {
223	var cls *DisplayManager
224
225	cret := xDisplayManagerGet()
226
227	if cret == 0 {
228		return nil
229	}
230	gobject.IncreaseRef(cret)
231	cls = &DisplayManager{}
232	cls.Ptr = cret
233	return cls
234}
235
236func init() {
237	core.SetPackageName("GDK", "gtk4")
238	core.SetSharedLibraries("GDK", []string{"libgtk-4.so.1"})
239	var libs []uintptr
240	for _, libPath := range core.GetPaths("GDK") {
241		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
242		if err != nil {
243			panic(err)
244		}
245		libs = append(libs, lib)
246	}
247
248	core.PuregoSafeRegister(&xSetAllowedBackends, libs, "gdk_set_allowed_backends")
249
250	core.PuregoSafeRegister(&xDisplayManagerGLibType, libs, "gdk_display_manager_get_type")
251
252	core.PuregoSafeRegister(&xDisplayManagerGetDefaultDisplay, libs, "gdk_display_manager_get_default_display")
253	core.PuregoSafeRegister(&xDisplayManagerListDisplays, libs, "gdk_display_manager_list_displays")
254	core.PuregoSafeRegister(&xDisplayManagerOpenDisplay, libs, "gdk_display_manager_open_display")
255	core.PuregoSafeRegister(&xDisplayManagerSetDefaultDisplay, libs, "gdk_display_manager_set_default_display")
256
257	core.PuregoSafeRegister(&xDisplayManagerGet, libs, "gdk_display_manager_get")
258
259}

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