v0.2.1 c0399be

gsignal.go RawHistoryFolder

1// Package gobject was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gobject
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/glib"
12	"github.com/bnema/puregotk/v4/gobject/types"
13)
14
15// The signal accumulator is a special callback function that can be used
16// to collect return values of the various callbacks that are called
17// during a signal emission.
18//
19// The signal accumulator is specified at signal creation time, if it is
20// left %NULL, no accumulation of callback return values is performed.
21// The return value of signal emissions is then the value returned by the
22// last callback.
23type SignalAccumulator func(*SignalInvocationHint, *Value, *Value, uintptr) bool
24
25// A simple function pointer to get invoked when the signal is emitted.
26//
27// Emission hooks allow you to tie a hook to the signal type, so that it will
28// trap all emissions of that signal, from any object.
29//
30// You may not attach these to signals created with the %G_SIGNAL_NO_HOOKS flag.
31type SignalEmissionHook func(*SignalInvocationHint, uint, []Value, uintptr) bool
32
33// The #GSignalInvocationHint structure is used to pass on additional information
34// to callbacks during a signal emission.
35type SignalInvocationHint struct {
36	_ structs.HostLayout
37
38	SignalId uint
39
40	Detail glib.Quark
41
42	RunType SignalFlags
43}
44
45func (x *SignalInvocationHint) GoPointer() uintptr {
46	return uintptr(unsafe.Pointer(x))
47}
48
49// A structure holding in-depth information for a specific signal.
50//
51// See also: g_signal_query()
52type SignalQuery struct {
53	_ structs.HostLayout
54
55	SignalId uint
56
57	SignalName uintptr
58
59	Itype types.GType
60
61	SignalFlags SignalFlags
62
63	ReturnType types.GType
64
65	NParams uint
66
67	ParamTypes []types.GType
68}
69
70func (x *SignalQuery) GoPointer() uintptr {
71	return uintptr(unsafe.Pointer(x))
72}
73
74// This is the signature of marshaller functions, required to marshall
75// arrays of parameter values to signal emissions into C language callback
76// invocations.
77//
78// It is merely an alias to #GClosureMarshal since the #GClosure mechanism
79// takes over responsibility of actual function invocation for the signal
80// system.
81type SignalCMarshaller = ClosureMarshal
82
83// This is the signature of va_list marshaller functions, an optional
84// marshaller that can be used in some situations to avoid
85// marshalling the signal argument into GValues.
86type SignalCVaMarshaller = VaClosureMarshal
87
88const (
89	// A mask for all #GSignalFlags bits.
90	SIGNAL_FLAGS_MASK int = 511
91	// A mask for all #GSignalMatchType bits.
92	SIGNAL_MATCH_MASK int = 63
93)
94
95// The connection flags are used to specify the behaviour of a signal's
96// connection.
97type ConnectFlags int
98
99const (
100
101	// Default behaviour (no special flags). Since: 2.74
102	GConnectDefaultValue ConnectFlags = 0
103	// If set, the handler should be called after the
104	//  default handler of the signal. Normally, the handler is called before
105	//  the default handler.
106	GConnectAfterValue ConnectFlags = 1
107	// If set, the instance and data should be swapped when
108	//  calling the handler; see g_signal_connect_swapped() for an example.
109	GConnectSwappedValue ConnectFlags = 2
110)
111
112// The signal flags are used to specify a signal's behaviour.
113type SignalFlags int
114
115const (
116
117	// Invoke the object method handler in the first emission stage.
118	GSignalRunFirstValue SignalFlags = 1
119	// Invoke the object method handler in the third emission stage.
120	GSignalRunLastValue SignalFlags = 2
121	// Invoke the object method handler in the last emission stage.
122	GSignalRunCleanupValue SignalFlags = 4
123	// Signals being emitted for an object while currently being in
124	//  emission for this very object will not be emitted recursively,
125	//  but instead cause the first emission to be restarted.
126	GSignalNoRecurseValue SignalFlags = 8
127	// This signal supports "::detail" appendices to the signal name
128	//  upon handler connections and emissions.
129	GSignalDetailedValue SignalFlags = 16
130	// Action signals are signals that may freely be emitted on alive
131	//  objects from user code via g_signal_emit() and friends, without
132	//  the need of being embedded into extra code that performs pre or
133	//  post emission adjustments on the object. They can also be thought
134	//  of as object methods which can be called generically by
135	//  third-party code.
136	GSignalActionValue SignalFlags = 32
137	// No emissions hooks are supported for this signal.
138	GSignalNoHooksValue SignalFlags = 64
139	// Varargs signal emission will always collect the arguments, even if there
140	// are no signal handlers connected.
141	GSignalMustCollectValue SignalFlags = 128
142	// The signal is deprecated and will be removed in a future version.
143	//
144	// A warning will be generated if it is connected while running with
145	// `G_ENABLE_DIAGNOSTIC=1`.
146	GSignalDeprecatedValue SignalFlags = 256
147	// The signal accumulator was invoked for the first time.
148	//
149	// This flag is only used in [callback@GObject.SignalAccumulator][accumulator functions]
150	// for the `run_type` field of the [struct@GObject.SignalInvocationHint], to
151	// mark the first call to the accumulator function for a signal emission.
152	GSignalAccumulatorFirstRunValue SignalFlags = 131072
153)
154
155// The match types specify what g_signal_handlers_block_matched(),
156// g_signal_handlers_unblock_matched() and g_signal_handlers_disconnect_matched()
157// match signals by.
158type SignalMatchType int
159
160const (
161
162	// The signal id must be equal.
163	GSignalMatchIdValue SignalMatchType = 1
164	// The signal detail must be equal.
165	GSignalMatchDetailValue SignalMatchType = 2
166	// The closure must be the same.
167	GSignalMatchClosureValue SignalMatchType = 4
168	// The C closure callback must be the same.
169	GSignalMatchFuncValue SignalMatchType = 8
170	// The closure data must be the same.
171	GSignalMatchDataValue SignalMatchType = 16
172	// Only unblocked signals may be matched.
173	GSignalMatchUnblockedValue SignalMatchType = 32
174)
175
176var xClearSignalHandler func(uint, uintptr)
177
178// Disconnects a handler from @instance so it will not be called during
179// any future or currently ongoing emissions of the signal it has been
180// connected to. The @handler_id_ptr is then set to zero, which is never a valid handler ID value (see g_signal_connect()).
181//
182// If the handler ID is 0 then this function does nothing.
183//
184// There is also a macro version of this function so that the code
185// will be inlined.
186func ClearSignalHandler(HandlerIdPtrVar uint, InstanceVar *Object) {
187
188	xClearSignalHandler(HandlerIdPtrVar, InstanceVar.GoPointer())
189
190}
191
192var xSignalAccumulatorFirstWins func(*SignalInvocationHint, *Value, *Value, uintptr) bool
193
194// A predefined #GSignalAccumulator for signals intended to be used as a
195// hook for application code to provide a particular value.  Usually
196// only one such value is desired and multiple handlers for the same
197// signal don't make much sense (except for the case of the default
198// handler defined in the class structure, in which case you will
199// usually want the signal connection to override the class handler).
200//
201// This accumulator will use the return value from the first signal
202// handler that is run as the return value for the signal and not run
203// any further handlers (ie: the first handler "wins").
204func SignalAccumulatorFirstWins(IhintVar *SignalInvocationHint, ReturnAccuVar *Value, HandlerReturnVar *Value, DummyVar uintptr) bool {
205
206	cret := xSignalAccumulatorFirstWins(IhintVar, ReturnAccuVar, HandlerReturnVar, DummyVar)
207	return cret
208}
209
210var xSignalAccumulatorTrueHandled func(*SignalInvocationHint, *Value, *Value, uintptr) bool
211
212// A predefined #GSignalAccumulator for signals that return a
213// boolean values. The behavior that this accumulator gives is
214// that a return of %TRUE stops the signal emission: no further
215// callbacks will be invoked, while a return of %FALSE allows
216// the emission to continue. The idea here is that a %TRUE return
217// indicates that the callback handled the signal, and no further
218// handling is needed.
219func SignalAccumulatorTrueHandled(IhintVar *SignalInvocationHint, ReturnAccuVar *Value, HandlerReturnVar *Value, DummyVar uintptr) bool {
220
221	cret := xSignalAccumulatorTrueHandled(IhintVar, ReturnAccuVar, HandlerReturnVar, DummyVar)
222	return cret
223}
224
225var xSignalAddEmissionHook func(uint, glib.Quark, uintptr, uintptr, uintptr) uint
226
227// Adds an emission hook for a signal, which will get called for any emission
228// of that signal, independent of the instance. This is possible only
229// for signals which don't have %G_SIGNAL_NO_HOOKS flag set.
230func SignalAddEmissionHook(SignalIdVar uint, DetailVar glib.Quark, HookFuncVar *SignalEmissionHook, HookDataVar uintptr, DataDestroyVar *glib.DestroyNotify) uint {
231
232	var HookFuncVarRef uintptr
233	if HookFuncVar != nil {
234		HookFuncVarPtr := uintptr(unsafe.Pointer(HookFuncVar))
235		if cbRefPtr, ok := glib.GetCallback(HookFuncVarPtr); ok {
236			HookFuncVarRef = cbRefPtr
237		} else {
238			fcb := func(arg0 *SignalInvocationHint, arg1 uint, arg2 []Value, arg3 uintptr) bool {
239				cbFn := *HookFuncVar
240				return cbFn(arg0, arg1, arg2, arg3)
241			}
242			HookFuncVarRef = purego.NewCallback(fcb)
243			glib.SaveCallbackWithClosure(HookFuncVarPtr, HookFuncVarRef, HookFuncVar)
244		}
245	}
246
247	var DataDestroyVarRef uintptr
248	if DataDestroyVar != nil {
249		DataDestroyVarPtr := uintptr(unsafe.Pointer(DataDestroyVar))
250		if cbRefPtr, ok := glib.GetCallback(DataDestroyVarPtr); ok {
251			DataDestroyVarRef = cbRefPtr
252		} else {
253			fcb := func(arg0 uintptr) {
254				cbFn := *DataDestroyVar
255				cbFn(arg0)
256			}
257			DataDestroyVarRef = purego.NewCallback(fcb)
258			glib.SaveCallbackWithClosure(DataDestroyVarPtr, DataDestroyVarRef, DataDestroyVar)
259		}
260	}
261
262	cret := xSignalAddEmissionHook(SignalIdVar, DetailVar, HookFuncVarRef, HookDataVar, DataDestroyVarRef)
263	return cret
264}
265
266var xSignalChainFromOverridden func([]Value, *Value)
267
268// Calls the original class closure of a signal. This function should only
269// be called from an overridden class closure; see
270// g_signal_override_class_closure() and
271// g_signal_override_class_handler().
272func SignalChainFromOverridden(InstanceAndParamsVar []Value, ReturnValueVar *Value) {
273
274	xSignalChainFromOverridden(InstanceAndParamsVar, ReturnValueVar)
275
276}
277
278var xSignalChainFromOverriddenHandler func(*TypeInstance, ...interface{})
279
280// Calls the original class closure of a signal. This function should
281// only be called from an overridden class closure; see
282// g_signal_override_class_closure() and
283// g_signal_override_class_handler().
284func SignalChainFromOverriddenHandler(InstanceVar *TypeInstance, varArgs ...interface{}) {
285
286	xSignalChainFromOverriddenHandler(InstanceVar, varArgs...)
287
288}
289
290var xSignalConnectClosure func(uintptr, string, *Closure, bool) uint
291
292// Connects a closure to a signal for a particular object.
293//
294// If @closure is a floating reference (see g_closure_sink()), this function
295// takes ownership of @closure.
296//
297// This function cannot fail. If the given signal name doesn’t exist,
298// a critical warning is emitted. No validation is performed on the
299// ‘detail’ string when specified in @detailed_signal, other than a
300// non-empty check.
301//
302// Refer to the [signals documentation](signals.html) for more
303// details.
304func SignalConnectClosure(InstanceVar *Object, DetailedSignalVar string, ClosureVar *Closure, AfterVar bool) uint {
305
306	cret := xSignalConnectClosure(InstanceVar.GoPointer(), DetailedSignalVar, ClosureVar, AfterVar)
307	return cret
308}
309
310var xSignalConnectClosureById func(uintptr, uint, glib.Quark, *Closure, bool) uint
311
312// Connects a closure to a signal for a particular object.
313//
314// If @closure is a floating reference (see g_closure_sink()), this function
315// takes ownership of @closure.
316//
317// This function cannot fail. If the given signal name doesn’t exist,
318// a critical warning is emitted. No validation is performed on the
319// ‘detail’ string when specified in @detailed_signal, other than a
320// non-empty check.
321//
322// Refer to the [signals documentation](signals.html) for more
323// details.
324func SignalConnectClosureById(InstanceVar *Object, SignalIdVar uint, DetailVar glib.Quark, ClosureVar *Closure, AfterVar bool) uint {
325
326	cret := xSignalConnectClosureById(InstanceVar.GoPointer(), SignalIdVar, DetailVar, ClosureVar, AfterVar)
327	return cret
328}
329
330var xSignalConnectData func(uintptr, string, uintptr, uintptr, uintptr, ConnectFlags) uint
331
332// Connects a #GCallback function to a signal for a particular object. Similar
333// to g_signal_connect(), but allows to provide a #GClosureNotify for the data
334// which will be called when the signal handler is disconnected and no longer
335// used. Specify @connect_flags if you need `..._after()` or
336// `..._swapped()` variants of this function.
337//
338// This function cannot fail. If the given signal name doesn’t exist,
339// a critical warning is emitted. No validation is performed on the
340// ‘detail’ string when specified in @detailed_signal, other than a
341// non-empty check.
342//
343// Refer to the [signals documentation](signals.html) for more
344// details.
345func SignalConnectData(InstanceVar *Object, DetailedSignalVar string, CHandlerVar *Callback, DataVar uintptr, DestroyDataVar *ClosureNotify, ConnectFlagsVar ConnectFlags) uint {
346
347	var CHandlerVarRef uintptr
348	if CHandlerVar != nil {
349		CHandlerVarPtr := uintptr(unsafe.Pointer(CHandlerVar))
350		if cbRefPtr, ok := glib.GetCallback(CHandlerVarPtr); ok {
351			CHandlerVarRef = cbRefPtr
352		} else {
353			fcb := func() {
354				cbFn := *CHandlerVar
355				cbFn()
356			}
357			CHandlerVarRef = purego.NewCallback(fcb)
358			glib.SaveCallbackWithClosure(CHandlerVarPtr, CHandlerVarRef, CHandlerVar)
359		}
360	}
361
362	var DestroyDataVarRef uintptr
363	if DestroyDataVar != nil {
364		DestroyDataVarPtr := uintptr(unsafe.Pointer(DestroyDataVar))
365		if cbRefPtr, ok := glib.GetCallback(DestroyDataVarPtr); ok {
366			DestroyDataVarRef = cbRefPtr
367		} else {
368			fcb := func(arg0 uintptr, arg1 *Closure) {
369				cbFn := *DestroyDataVar
370				cbFn(arg0, arg1)
371			}
372			DestroyDataVarRef = purego.NewCallback(fcb)
373			glib.SaveCallbackWithClosure(DestroyDataVarPtr, DestroyDataVarRef, DestroyDataVar)
374		}
375	}
376
377	cret := xSignalConnectData(InstanceVar.GoPointer(), DetailedSignalVar, CHandlerVarRef, DataVar, DestroyDataVarRef, ConnectFlagsVar)
378	return cret
379}
380
381var xSignalEmit func(uintptr, uint, glib.Quark, ...interface{})
382
383// Emits a signal. Signal emission is done synchronously.
384// The method will only return control after all handlers are called or signal emission was stopped.
385//
386// Note that g_signal_emit() resets the return value to the default
387// if no handlers are connected, in contrast to g_signal_emitv().
388func SignalEmit(InstanceVar *Object, SignalIdVar uint, DetailVar glib.Quark, varArgs ...interface{}) {
389
390	xSignalEmit(InstanceVar.GoPointer(), SignalIdVar, DetailVar, varArgs...)
391
392}
393
394var xSignalEmitByName func(uintptr, string, ...interface{})
395
396// Emits a signal. Signal emission is done synchronously.
397// The method will only return control after all handlers are called or signal emission was stopped.
398//
399// Note that g_signal_emit_by_name() resets the return value to the default
400// if no handlers are connected, in contrast to g_signal_emitv().
401func SignalEmitByName(InstanceVar *Object, DetailedSignalVar string, varArgs ...interface{}) {
402
403	xSignalEmitByName(InstanceVar.GoPointer(), DetailedSignalVar, varArgs...)
404
405}
406
407var xSignalEmitValist func(*TypeInstance, uint, glib.Quark, []interface{})
408
409// Emits a signal. Signal emission is done synchronously.
410// The method will only return control after all handlers are called or signal emission was stopped.
411//
412// Note that g_signal_emit_valist() resets the return value to the default
413// if no handlers are connected, in contrast to g_signal_emitv().
414func SignalEmitValist(InstanceVar *TypeInstance, SignalIdVar uint, DetailVar glib.Quark, VarArgsVar []interface{}) {
415
416	xSignalEmitValist(InstanceVar, SignalIdVar, DetailVar, VarArgsVar)
417
418}
419
420var xSignalEmitv func([]Value, uint, glib.Quark, *Value)
421
422// Emits a signal. Signal emission is done synchronously.
423// The method will only return control after all handlers are called or signal emission was stopped.
424//
425// Note that g_signal_emitv() doesn't change @return_value if no handlers are
426// connected, in contrast to g_signal_emit() and g_signal_emit_valist().
427func SignalEmitv(InstanceAndParamsVar []Value, SignalIdVar uint, DetailVar glib.Quark, ReturnValueVar *Value) {
428
429	xSignalEmitv(InstanceAndParamsVar, SignalIdVar, DetailVar, ReturnValueVar)
430
431}
432
433var xSignalGetInvocationHint func(uintptr) *SignalInvocationHint
434
435// Returns the invocation hint of the innermost signal emission of instance.
436func SignalGetInvocationHint(InstanceVar *Object) *SignalInvocationHint {
437
438	cret := xSignalGetInvocationHint(InstanceVar.GoPointer())
439	return cret
440}
441
442var xSignalHandlerBlock func(uintptr, uint)
443
444// Blocks a handler of an instance so it will not be called during any
445// signal emissions unless it is unblocked again. Thus "blocking" a
446// signal handler means to temporarily deactivate it, a signal handler
447// has to be unblocked exactly the same amount of times it has been
448// blocked before to become active again.
449//
450// The @handler_id has to be a valid signal handler id, connected to a
451// signal of @instance.
452func SignalHandlerBlock(InstanceVar *Object, HandlerIdVar uint) {
453
454	xSignalHandlerBlock(InstanceVar.GoPointer(), HandlerIdVar)
455
456}
457
458var xSignalHandlerDisconnect func(uintptr, uint)
459
460// Disconnects a handler from an instance so it will not be called during
461// any future or currently ongoing emissions of the signal it has been
462// connected to. The @handler_id becomes invalid and may be reused.
463//
464// The @handler_id has to be a valid signal handler id, connected to a
465// signal of @instance.
466func SignalHandlerDisconnect(InstanceVar *Object, HandlerIdVar uint) {
467
468	xSignalHandlerDisconnect(InstanceVar.GoPointer(), HandlerIdVar)
469
470}
471
472var xSignalHandlerFind func(uintptr, SignalMatchType, uint, glib.Quark, *Closure, uintptr, uintptr) uint
473
474// Finds the first signal handler that matches certain selection criteria.
475// The criteria mask is passed as an OR-ed combination of #GSignalMatchType
476// flags, and the criteria values are passed as arguments.
477// The match @mask has to be non-0 for successful matches.
478// If no handler was found, 0 is returned.
479func SignalHandlerFind(InstanceVar *Object, MaskVar SignalMatchType, SignalIdVar uint, DetailVar glib.Quark, ClosureVar *Closure, FuncVar uintptr, DataVar uintptr) uint {
480
481	cret := xSignalHandlerFind(InstanceVar.GoPointer(), MaskVar, SignalIdVar, DetailVar, ClosureVar, FuncVar, DataVar)
482	return cret
483}
484
485var xSignalHandlerIsConnected func(uintptr, uint) bool
486
487// Returns whether @handler_id is the ID of a handler connected to @instance.
488func SignalHandlerIsConnected(InstanceVar *Object, HandlerIdVar uint) bool {
489
490	cret := xSignalHandlerIsConnected(InstanceVar.GoPointer(), HandlerIdVar)
491	return cret
492}
493
494var xSignalHandlerUnblock func(uintptr, uint)
495
496// Undoes the effect of a previous g_signal_handler_block() call.  A
497// blocked handler is skipped during signal emissions and will not be
498// invoked, unblocking it (for exactly the amount of times it has been
499// blocked before) reverts its "blocked" state, so the handler will be
500// recognized by the signal system and is called upon future or
501// currently ongoing signal emissions (since the order in which
502// handlers are called during signal emissions is deterministic,
503// whether the unblocked handler in question is called as part of a
504// currently ongoing emission depends on how far that emission has
505// proceeded yet).
506//
507// The @handler_id has to be a valid id of a signal handler that is
508// connected to a signal of @instance and is currently blocked.
509func SignalHandlerUnblock(InstanceVar *Object, HandlerIdVar uint) {
510
511	xSignalHandlerUnblock(InstanceVar.GoPointer(), HandlerIdVar)
512
513}
514
515var xSignalHandlersBlockMatched func(uintptr, SignalMatchType, uint, glib.Quark, *Closure, uintptr, uintptr) uint
516
517// Blocks all handlers on an instance that match a certain selection criteria.
518//
519// The criteria mask is passed as a combination of #GSignalMatchType flags, and
520// the criteria values are passed as arguments. A handler must match on all
521// flags set in @mask to be blocked (i.e. the match is conjunctive).
522//
523// Passing at least one of the %G_SIGNAL_MATCH_ID, %G_SIGNAL_MATCH_CLOSURE,
524// %G_SIGNAL_MATCH_FUNC
525// or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
526// If no handlers were found, 0 is returned, the number of blocked handlers
527// otherwise.
528//
529// Support for %G_SIGNAL_MATCH_ID was added in GLib 2.78.
530func SignalHandlersBlockMatched(InstanceVar *Object, MaskVar SignalMatchType, SignalIdVar uint, DetailVar glib.Quark, ClosureVar *Closure, FuncVar uintptr, DataVar uintptr) uint {
531
532	cret := xSignalHandlersBlockMatched(InstanceVar.GoPointer(), MaskVar, SignalIdVar, DetailVar, ClosureVar, FuncVar, DataVar)
533	return cret
534}
535
536var xSignalHandlersDestroy func(uintptr)
537
538// Destroy all signal handlers of a type instance. This function is
539// an implementation detail of the #GObject dispose implementation,
540// and should not be used outside of the type system.
541func SignalHandlersDestroy(InstanceVar *Object) {
542
543	xSignalHandlersDestroy(InstanceVar.GoPointer())
544
545}
546
547var xSignalHandlersDisconnectMatched func(uintptr, SignalMatchType, uint, glib.Quark, *Closure, uintptr, uintptr) uint
548
549// Disconnects all handlers on an instance that match a certain
550// selection criteria.
551//
552// The criteria mask is passed as a combination of #GSignalMatchType flags, and
553// the criteria values are passed as arguments. A handler must match on all
554// flags set in @mask to be disconnected (i.e. the match is conjunctive).
555//
556// Passing at least one of the %G_SIGNAL_MATCH_ID, %G_SIGNAL_MATCH_CLOSURE,
557// %G_SIGNAL_MATCH_FUNC or
558// %G_SIGNAL_MATCH_DATA match flags is required for successful
559// matches.  If no handlers were found, 0 is returned, the number of
560// disconnected handlers otherwise.
561//
562// Support for %G_SIGNAL_MATCH_ID was added in GLib 2.78.
563func SignalHandlersDisconnectMatched(InstanceVar *Object, MaskVar SignalMatchType, SignalIdVar uint, DetailVar glib.Quark, ClosureVar *Closure, FuncVar uintptr, DataVar uintptr) uint {
564
565	cret := xSignalHandlersDisconnectMatched(InstanceVar.GoPointer(), MaskVar, SignalIdVar, DetailVar, ClosureVar, FuncVar, DataVar)
566	return cret
567}
568
569var xSignalHandlersUnblockMatched func(uintptr, SignalMatchType, uint, glib.Quark, *Closure, uintptr, uintptr) uint
570
571// Unblocks all handlers on an instance that match a certain selection
572// criteria.
573//
574// The criteria mask is passed as a combination of #GSignalMatchType flags, and
575// the criteria values are passed as arguments. A handler must match on all
576// flags set in @mask to be unblocked (i.e. the match is conjunctive).
577//
578// Passing at least one of the %G_SIGNAL_MATCH_ID, %G_SIGNAL_MATCH_CLOSURE,
579// %G_SIGNAL_MATCH_FUNC
580// or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
581// If no handlers were found, 0 is returned, the number of unblocked handlers
582// otherwise. The match criteria should not apply to any handlers that are
583// not currently blocked.
584//
585// Support for %G_SIGNAL_MATCH_ID was added in GLib 2.78.
586func SignalHandlersUnblockMatched(InstanceVar *Object, MaskVar SignalMatchType, SignalIdVar uint, DetailVar glib.Quark, ClosureVar *Closure, FuncVar uintptr, DataVar uintptr) uint {
587
588	cret := xSignalHandlersUnblockMatched(InstanceVar.GoPointer(), MaskVar, SignalIdVar, DetailVar, ClosureVar, FuncVar, DataVar)
589	return cret
590}
591
592var xSignalHasHandlerPending func(uintptr, uint, glib.Quark, bool) bool
593
594// Returns whether there are any handlers connected to @instance for the
595// given signal id and detail.
596//
597// If @detail is 0 then it will only match handlers that were connected
598// without detail.  If @detail is non-zero then it will match handlers
599// connected both without detail and with the given detail.  This is
600// consistent with how a signal emitted with @detail would be delivered
601// to those handlers.
602//
603// Since 2.46 this also checks for a non-default class closure being
604// installed, as this is basically always what you want.
605//
606// One example of when you might use this is when the arguments to the
607// signal are difficult to compute. A class implementor may opt to not
608// emit the signal if no one is attached anyway, thus saving the cost
609// of building the arguments.
610func SignalHasHandlerPending(InstanceVar *Object, SignalIdVar uint, DetailVar glib.Quark, MayBeBlockedVar bool) bool {
611
612	cret := xSignalHasHandlerPending(InstanceVar.GoPointer(), SignalIdVar, DetailVar, MayBeBlockedVar)
613	return cret
614}
615
616var xSignalIsValidName func(string) bool
617
618// Validate a signal name. This can be useful for dynamically-generated signals
619// which need to be validated at run-time before actually trying to create them.
620//
621// See [func@GObject.signal_new] for details of the rules for valid names.
622// The rules for signal names are the same as those for property names.
623func SignalIsValidName(NameVar string) bool {
624
625	cret := xSignalIsValidName(NameVar)
626	return cret
627}
628
629var xSignalListIds func(types.GType, *uint) uintptr
630
631// Lists the signals by id that a certain instance or interface type
632// created. Further information about the signals can be acquired through
633// g_signal_query().
634func SignalListIds(ItypeVar types.GType, NIdsVar *uint) uintptr {
635
636	cret := xSignalListIds(ItypeVar, NIdsVar)
637	return cret
638}
639
640var xSignalLookup func(string, types.GType) uint
641
642// Given the name of the signal and the type of object it connects to, gets
643// the signal's identifying integer. Emitting the signal by number is
644// somewhat faster than using the name each time.
645//
646// Also tries the ancestors of the given type.
647//
648// The type class passed as @itype must already have been instantiated (for
649// example, using g_type_class_ref()) for this function to work, as signals are
650// always installed during class initialization.
651//
652// See g_signal_new() for details on allowed signal names.
653func SignalLookup(NameVar string, ItypeVar types.GType) uint {
654
655	cret := xSignalLookup(NameVar, ItypeVar)
656	return cret
657}
658
659var xSignalName func(uint) string
660
661// Given the signal's identifier, finds its name.
662//
663// Two different signals may have the same name, if they have differing types.
664func SignalName(SignalIdVar uint) string {
665
666	cret := xSignalName(SignalIdVar)
667	return cret
668}
669
670var xSignalNew func(string, types.GType, SignalFlags, uint, uintptr, uintptr, uintptr, types.GType, uint, ...interface{}) uint
671
672// Creates a new signal. (This is usually done in the class initializer.)
673//
674// A signal name consists of segments consisting of ASCII letters and
675// digits, separated by either the `-` or `_` character. The first
676// character of a signal name must be a letter. Names which violate these
677// rules lead to undefined behaviour. These are the same rules as for property
678// naming (see g_param_spec_internal()).
679//
680// When registering a signal and looking up a signal, either separator can
681// be used, but they cannot be mixed. Using `-` is considerably more efficient.
682// Using `_` is discouraged.
683//
684// If 0 is used for @class_offset subclasses cannot override the class handler
685// in their class_init method by doing super_class->signal_handler = my_signal_handler.
686// Instead they will have to use g_signal_override_class_handler().
687//
688// If @c_marshaller is %NULL, g_cclosure_marshal_generic() will be used as
689// the marshaller for this signal. In some simple cases, g_signal_new()
690// will use a more optimized c_marshaller and va_marshaller for the signal
691// instead of g_cclosure_marshal_generic().
692//
693// If @c_marshaller is non-%NULL, you need to also specify a va_marshaller
694// using g_signal_set_va_marshaller() or the generic va_marshaller will
695// be used.
696func SignalNew(SignalNameVar string, ItypeVar types.GType, SignalFlagsVar SignalFlags, ClassOffsetVar uint, AccumulatorVar *SignalAccumulator, AccuDataVar uintptr, CMarshallerVar *SignalCMarshaller, ReturnTypeVar types.GType, NParamsVar uint, varArgs ...interface{}) uint {
697
698	var AccumulatorVarRef uintptr
699	if AccumulatorVar != nil {
700		AccumulatorVarPtr := uintptr(unsafe.Pointer(AccumulatorVar))
701		if cbRefPtr, ok := glib.GetCallback(AccumulatorVarPtr); ok {
702			AccumulatorVarRef = cbRefPtr
703		} else {
704			fcb := func(arg0 *SignalInvocationHint, arg1 *Value, arg2 *Value, arg3 uintptr) bool {
705				cbFn := *AccumulatorVar
706				return cbFn(arg0, arg1, arg2, arg3)
707			}
708			AccumulatorVarRef = purego.NewCallback(fcb)
709			glib.SaveCallbackWithClosure(AccumulatorVarPtr, AccumulatorVarRef, AccumulatorVar)
710		}
711	}
712
713	cret := xSignalNew(SignalNameVar, ItypeVar, SignalFlagsVar, ClassOffsetVar, AccumulatorVarRef, AccuDataVar, glib.NewCallbackNullable(CMarshallerVar), ReturnTypeVar, NParamsVar, varArgs...)
714	return cret
715}
716
717var xSignalNewClassHandler func(string, types.GType, SignalFlags, uintptr, uintptr, uintptr, uintptr, types.GType, uint, ...interface{}) uint
718
719// Creates a new signal. (This is usually done in the class initializer.)
720//
721// This is a variant of g_signal_new() that takes a C callback instead
722// of a class offset for the signal's class handler. This function
723// doesn't need a function pointer exposed in the class structure of
724// an object definition, instead the function pointer is passed
725// directly and can be overridden by derived classes with
726// g_signal_override_class_closure() or
727// g_signal_override_class_handler() and chained to with
728// g_signal_chain_from_overridden() or
729// g_signal_chain_from_overridden_handler().
730//
731// See g_signal_new() for information about signal names.
732//
733// If c_marshaller is %NULL, g_cclosure_marshal_generic() will be used as
734// the marshaller for this signal.
735func SignalNewClassHandler(SignalNameVar string, ItypeVar types.GType, SignalFlagsVar SignalFlags, ClassHandlerVar *Callback, AccumulatorVar *SignalAccumulator, AccuDataVar uintptr, CMarshallerVar *SignalCMarshaller, ReturnTypeVar types.GType, NParamsVar uint, varArgs ...interface{}) uint {
736
737	var ClassHandlerVarRef uintptr
738	if ClassHandlerVar != nil {
739		ClassHandlerVarPtr := uintptr(unsafe.Pointer(ClassHandlerVar))
740		if cbRefPtr, ok := glib.GetCallback(ClassHandlerVarPtr); ok {
741			ClassHandlerVarRef = cbRefPtr
742		} else {
743			fcb := func() {
744				cbFn := *ClassHandlerVar
745				cbFn()
746			}
747			ClassHandlerVarRef = purego.NewCallback(fcb)
748			glib.SaveCallbackWithClosure(ClassHandlerVarPtr, ClassHandlerVarRef, ClassHandlerVar)
749		}
750	}
751
752	var AccumulatorVarRef uintptr
753	if AccumulatorVar != nil {
754		AccumulatorVarPtr := uintptr(unsafe.Pointer(AccumulatorVar))
755		if cbRefPtr, ok := glib.GetCallback(AccumulatorVarPtr); ok {
756			AccumulatorVarRef = cbRefPtr
757		} else {
758			fcb := func(arg0 *SignalInvocationHint, arg1 *Value, arg2 *Value, arg3 uintptr) bool {
759				cbFn := *AccumulatorVar
760				return cbFn(arg0, arg1, arg2, arg3)
761			}
762			AccumulatorVarRef = purego.NewCallback(fcb)
763			glib.SaveCallbackWithClosure(AccumulatorVarPtr, AccumulatorVarRef, AccumulatorVar)
764		}
765	}
766
767	cret := xSignalNewClassHandler(SignalNameVar, ItypeVar, SignalFlagsVar, ClassHandlerVarRef, AccumulatorVarRef, AccuDataVar, glib.NewCallbackNullable(CMarshallerVar), ReturnTypeVar, NParamsVar, varArgs...)
768	return cret
769}
770
771var xSignalNewValist func(string, types.GType, SignalFlags, *Closure, uintptr, uintptr, uintptr, types.GType, uint, []interface{}) uint
772
773// Creates a new signal. (This is usually done in the class initializer.)
774//
775// See g_signal_new() for details on allowed signal names.
776//
777// If c_marshaller is %NULL, g_cclosure_marshal_generic() will be used as
778// the marshaller for this signal.
779func SignalNewValist(SignalNameVar string, ItypeVar types.GType, SignalFlagsVar SignalFlags, ClassClosureVar *Closure, AccumulatorVar *SignalAccumulator, AccuDataVar uintptr, CMarshallerVar *SignalCMarshaller, ReturnTypeVar types.GType, NParamsVar uint, ArgsVar []interface{}) uint {
780
781	var AccumulatorVarRef uintptr
782	if AccumulatorVar != nil {
783		AccumulatorVarPtr := uintptr(unsafe.Pointer(AccumulatorVar))
784		if cbRefPtr, ok := glib.GetCallback(AccumulatorVarPtr); ok {
785			AccumulatorVarRef = cbRefPtr
786		} else {
787			fcb := func(arg0 *SignalInvocationHint, arg1 *Value, arg2 *Value, arg3 uintptr) bool {
788				cbFn := *AccumulatorVar
789				return cbFn(arg0, arg1, arg2, arg3)
790			}
791			AccumulatorVarRef = purego.NewCallback(fcb)
792			glib.SaveCallbackWithClosure(AccumulatorVarPtr, AccumulatorVarRef, AccumulatorVar)
793		}
794	}
795
796	cret := xSignalNewValist(SignalNameVar, ItypeVar, SignalFlagsVar, ClassClosureVar, AccumulatorVarRef, AccuDataVar, glib.NewCallbackNullable(CMarshallerVar), ReturnTypeVar, NParamsVar, ArgsVar)
797	return cret
798}
799
800var xSignalNewv func(string, types.GType, SignalFlags, *Closure, uintptr, uintptr, uintptr, types.GType, uint, []types.GType) uint
801
802// Creates a new signal. (This is usually done in the class initializer.)
803//
804// See g_signal_new() for details on allowed signal names.
805//
806// If c_marshaller is %NULL, g_cclosure_marshal_generic() will be used as
807// the marshaller for this signal.
808func SignalNewv(SignalNameVar string, ItypeVar types.GType, SignalFlagsVar SignalFlags, ClassClosureVar *Closure, AccumulatorVar *SignalAccumulator, AccuDataVar uintptr, CMarshallerVar *SignalCMarshaller, ReturnTypeVar types.GType, NParamsVar uint, ParamTypesVar []types.GType) uint {
809
810	var AccumulatorVarRef uintptr
811	if AccumulatorVar != nil {
812		AccumulatorVarPtr := uintptr(unsafe.Pointer(AccumulatorVar))
813		if cbRefPtr, ok := glib.GetCallback(AccumulatorVarPtr); ok {
814			AccumulatorVarRef = cbRefPtr
815		} else {
816			fcb := func(arg0 *SignalInvocationHint, arg1 *Value, arg2 *Value, arg3 uintptr) bool {
817				cbFn := *AccumulatorVar
818				return cbFn(arg0, arg1, arg2, arg3)
819			}
820			AccumulatorVarRef = purego.NewCallback(fcb)
821			glib.SaveCallbackWithClosure(AccumulatorVarPtr, AccumulatorVarRef, AccumulatorVar)
822		}
823	}
824
825	cret := xSignalNewv(SignalNameVar, ItypeVar, SignalFlagsVar, ClassClosureVar, AccumulatorVarRef, AccuDataVar, glib.NewCallbackNullable(CMarshallerVar), ReturnTypeVar, NParamsVar, ParamTypesVar)
826	return cret
827}
828
829var xSignalOverrideClassClosure func(uint, types.GType, *Closure)
830
831// Overrides the class closure (i.e. the default handler) for the given signal
832// for emissions on instances of @instance_type. @instance_type must be derived
833// from the type to which the signal belongs.
834//
835// See g_signal_chain_from_overridden() and
836// g_signal_chain_from_overridden_handler() for how to chain up to the
837// parent class closure from inside the overridden one.
838func SignalOverrideClassClosure(SignalIdVar uint, InstanceTypeVar types.GType, ClassClosureVar *Closure) {
839
840	xSignalOverrideClassClosure(SignalIdVar, InstanceTypeVar, ClassClosureVar)
841
842}
843
844var xSignalOverrideClassHandler func(string, types.GType, uintptr)
845
846// Overrides the class closure (i.e. the default handler) for the
847// given signal for emissions on instances of @instance_type with
848// callback @class_handler. @instance_type must be derived from the
849// type to which the signal belongs.
850//
851// See g_signal_chain_from_overridden() and
852// g_signal_chain_from_overridden_handler() for how to chain up to the
853// parent class closure from inside the overridden one.
854func SignalOverrideClassHandler(SignalNameVar string, InstanceTypeVar types.GType, ClassHandlerVar *Callback) {
855
856	var ClassHandlerVarRef uintptr
857	if ClassHandlerVar != nil {
858		ClassHandlerVarPtr := uintptr(unsafe.Pointer(ClassHandlerVar))
859		if cbRefPtr, ok := glib.GetCallback(ClassHandlerVarPtr); ok {
860			ClassHandlerVarRef = cbRefPtr
861		} else {
862			fcb := func() {
863				cbFn := *ClassHandlerVar
864				cbFn()
865			}
866			ClassHandlerVarRef = purego.NewCallback(fcb)
867			glib.SaveCallbackWithClosure(ClassHandlerVarPtr, ClassHandlerVarRef, ClassHandlerVar)
868		}
869	}
870
871	xSignalOverrideClassHandler(SignalNameVar, InstanceTypeVar, ClassHandlerVarRef)
872
873}
874
875var xSignalParseName func(string, types.GType, *uint, *glib.Quark, bool) bool
876
877// Internal function to parse a signal name into its @signal_id
878// and @detail quark.
879func SignalParseName(DetailedSignalVar string, ItypeVar types.GType, SignalIdPVar *uint, DetailPVar *glib.Quark, ForceDetailQuarkVar bool) bool {
880
881	cret := xSignalParseName(DetailedSignalVar, ItypeVar, SignalIdPVar, DetailPVar, ForceDetailQuarkVar)
882	return cret
883}
884
885var xNewSignalQuery func(uint, *SignalQuery)
886
887// Queries the signal system for in-depth information about a
888// specific signal. This function will fill in a user-provided
889// structure to hold signal-specific information. If an invalid
890// signal id is passed in, the @signal_id member of the #GSignalQuery
891// is 0. All members filled into the #GSignalQuery structure should
892// be considered constant and have to be left untouched.
893func NewSignalQuery(SignalIdVar uint, QueryVar *SignalQuery) {
894
895	xNewSignalQuery(SignalIdVar, QueryVar)
896
897}
898
899var xSignalRemoveEmissionHook func(uint, uint)
900
901// Deletes an emission hook.
902func SignalRemoveEmissionHook(SignalIdVar uint, HookIdVar uint) {
903
904	xSignalRemoveEmissionHook(SignalIdVar, HookIdVar)
905
906}
907
908var xSignalSetVaMarshaller func(uint, types.GType, uintptr)
909
910// Change the #GSignalCVaMarshaller used for a given signal.  This is a
911// specialised form of the marshaller that can often be used for the
912// common case of a single connected signal handler and avoids the
913// overhead of #GValue.  Its use is optional.
914func SignalSetVaMarshaller(SignalIdVar uint, InstanceTypeVar types.GType, VaMarshallerVar *SignalCVaMarshaller) {
915
916	xSignalSetVaMarshaller(SignalIdVar, InstanceTypeVar, glib.NewCallback(VaMarshallerVar))
917
918}
919
920var xSignalStopEmission func(uintptr, uint, glib.Quark)
921
922// Stops a signal's current emission.
923//
924// This will prevent the default method from running, if the signal was
925// %G_SIGNAL_RUN_LAST and you connected normally (i.e. without the "after"
926// flag).
927//
928// Prints a warning if used on a signal which isn't being emitted.
929func SignalStopEmission(InstanceVar *Object, SignalIdVar uint, DetailVar glib.Quark) {
930
931	xSignalStopEmission(InstanceVar.GoPointer(), SignalIdVar, DetailVar)
932
933}
934
935var xSignalStopEmissionByName func(uintptr, string)
936
937// Stops a signal's current emission.
938//
939// This is just like g_signal_stop_emission() except it will look up the
940// signal id for you.
941func SignalStopEmissionByName(InstanceVar *Object, DetailedSignalVar string) {
942
943	xSignalStopEmissionByName(InstanceVar.GoPointer(), DetailedSignalVar)
944
945}
946
947func init() {
948	core.SetPackageName("GOBJECT", "gobject-2.0")
949	core.SetSharedLibraries("GOBJECT", []string{"libgobject-2.0.so.0"})
950	var libs []uintptr
951	for _, libPath := range core.GetPaths("GOBJECT") {
952		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
953		if err != nil {
954			panic(err)
955		}
956		libs = append(libs, lib)
957	}
958
959	core.PuregoSafeRegister(&xClearSignalHandler, libs, "g_clear_signal_handler")
960	core.PuregoSafeRegister(&xSignalAccumulatorFirstWins, libs, "g_signal_accumulator_first_wins")
961	core.PuregoSafeRegister(&xSignalAccumulatorTrueHandled, libs, "g_signal_accumulator_true_handled")
962	core.PuregoSafeRegister(&xSignalAddEmissionHook, libs, "g_signal_add_emission_hook")
963	core.PuregoSafeRegister(&xSignalChainFromOverridden, libs, "g_signal_chain_from_overridden")
964	core.PuregoSafeRegister(&xSignalChainFromOverriddenHandler, libs, "g_signal_chain_from_overridden_handler")
965	core.PuregoSafeRegister(&xSignalConnectClosure, libs, "g_signal_connect_closure")
966	core.PuregoSafeRegister(&xSignalConnectClosureById, libs, "g_signal_connect_closure_by_id")
967	core.PuregoSafeRegister(&xSignalConnectData, libs, "g_signal_connect_data")
968	core.PuregoSafeRegister(&xSignalEmit, libs, "g_signal_emit")
969	core.PuregoSafeRegister(&xSignalEmitByName, libs, "g_signal_emit_by_name")
970	core.PuregoSafeRegister(&xSignalEmitValist, libs, "g_signal_emit_valist")
971	core.PuregoSafeRegister(&xSignalEmitv, libs, "g_signal_emitv")
972	core.PuregoSafeRegister(&xSignalGetInvocationHint, libs, "g_signal_get_invocation_hint")
973	core.PuregoSafeRegister(&xSignalHandlerBlock, libs, "g_signal_handler_block")
974	core.PuregoSafeRegister(&xSignalHandlerDisconnect, libs, "g_signal_handler_disconnect")
975	core.PuregoSafeRegister(&xSignalHandlerFind, libs, "g_signal_handler_find")
976	core.PuregoSafeRegister(&xSignalHandlerIsConnected, libs, "g_signal_handler_is_connected")
977	core.PuregoSafeRegister(&xSignalHandlerUnblock, libs, "g_signal_handler_unblock")
978	core.PuregoSafeRegister(&xSignalHandlersBlockMatched, libs, "g_signal_handlers_block_matched")
979	core.PuregoSafeRegister(&xSignalHandlersDestroy, libs, "g_signal_handlers_destroy")
980	core.PuregoSafeRegister(&xSignalHandlersDisconnectMatched, libs, "g_signal_handlers_disconnect_matched")
981	core.PuregoSafeRegister(&xSignalHandlersUnblockMatched, libs, "g_signal_handlers_unblock_matched")
982	core.PuregoSafeRegister(&xSignalHasHandlerPending, libs, "g_signal_has_handler_pending")
983	core.PuregoSafeRegister(&xSignalIsValidName, libs, "g_signal_is_valid_name")
984	core.PuregoSafeRegister(&xSignalListIds, libs, "g_signal_list_ids")
985	core.PuregoSafeRegister(&xSignalLookup, libs, "g_signal_lookup")
986	core.PuregoSafeRegister(&xSignalName, libs, "g_signal_name")
987	core.PuregoSafeRegister(&xSignalNew, libs, "g_signal_new")
988	core.PuregoSafeRegister(&xSignalNewClassHandler, libs, "g_signal_new_class_handler")
989	core.PuregoSafeRegister(&xSignalNewValist, libs, "g_signal_new_valist")
990	core.PuregoSafeRegister(&xSignalNewv, libs, "g_signal_newv")
991	core.PuregoSafeRegister(&xSignalOverrideClassClosure, libs, "g_signal_override_class_closure")
992	core.PuregoSafeRegister(&xSignalOverrideClassHandler, libs, "g_signal_override_class_handler")
993	core.PuregoSafeRegister(&xSignalParseName, libs, "g_signal_parse_name")
994	core.PuregoSafeRegister(&xNewSignalQuery, libs, "g_signal_query")
995	core.PuregoSafeRegister(&xSignalRemoveEmissionHook, libs, "g_signal_remove_emission_hook")
996	core.PuregoSafeRegister(&xSignalSetVaMarshaller, libs, "g_signal_set_va_marshaller")
997	core.PuregoSafeRegister(&xSignalStopEmission, libs, "g_signal_stop_emission")
998	core.PuregoSafeRegister(&xSignalStopEmissionByName, libs, "g_signal_stop_emission_by_name")
999
1000}

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