v0.2.1 c0399be

gtkimcontext.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/gdk"
12	"github.com/bnema/puregotk/v4/glib"
13	"github.com/bnema/puregotk/v4/gobject"
14	"github.com/bnema/puregotk/v4/gobject/types"
15	"github.com/bnema/puregotk/v4/pango"
16)
17
18type IMContextClass struct {
19	_ structs.HostLayout
20
21	ParentClass gobject.ObjectClass
22
23	xPreeditStart uintptr
24
25	xPreeditEnd uintptr
26
27	xPreeditChanged uintptr
28
29	xCommit uintptr
30
31	xRetrieveSurrounding uintptr
32
33	xDeleteSurrounding uintptr
34
35	xSetClientWidget uintptr
36
37	xGetPreeditString uintptr
38
39	xFilterKeypress uintptr
40
41	xFocusIn uintptr
42
43	xFocusOut uintptr
44
45	xReset uintptr
46
47	xSetCursorLocation uintptr
48
49	xSetUsePreedit uintptr
50
51	xSetSurrounding uintptr
52
53	xGetSurrounding uintptr
54
55	xSetSurroundingWithSelection uintptr
56
57	xGetSurroundingWithSelection uintptr
58
59	xActivateOsk uintptr
60
61	xActivateOskWithEvent uintptr
62
63	xGtkReserved2 uintptr
64
65	xGtkReserved3 uintptr
66
67	xGtkReserved4 uintptr
68}
69
70func (x *IMContextClass) GoPointer() uintptr {
71	return uintptr(unsafe.Pointer(x))
72}
73
74// OverridePreeditStart sets the "preedit_start" callback function.
75// Default handler of the [signal@Gtk.IMContext::preedit-start] signal.
76func (x *IMContextClass) OverridePreeditStart(cb func(*IMContext)) {
77	if cb == nil {
78		x.xPreeditStart = 0
79	} else {
80		x.xPreeditStart = purego.NewCallback(func(ContextVarp uintptr) {
81			cb(IMContextNewFromInternalPtr(ContextVarp))
82		})
83	}
84}
85
86// GetPreeditStart gets the "preedit_start" callback function.
87// Default handler of the [signal@Gtk.IMContext::preedit-start] signal.
88func (x *IMContextClass) GetPreeditStart() func(*IMContext) {
89	if x.xPreeditStart == 0 {
90		return nil
91	}
92	var rawCallback func(ContextVarp uintptr)
93	purego.RegisterFunc(&rawCallback, x.xPreeditStart)
94	return func(ContextVar *IMContext) {
95		rawCallback(ContextVar.GoPointer())
96	}
97}
98
99// OverridePreeditEnd sets the "preedit_end" callback function.
100// Default handler of the [signal@Gtk.IMContext::preedit-end] signal.
101func (x *IMContextClass) OverridePreeditEnd(cb func(*IMContext)) {
102	if cb == nil {
103		x.xPreeditEnd = 0
104	} else {
105		x.xPreeditEnd = purego.NewCallback(func(ContextVarp uintptr) {
106			cb(IMContextNewFromInternalPtr(ContextVarp))
107		})
108	}
109}
110
111// GetPreeditEnd gets the "preedit_end" callback function.
112// Default handler of the [signal@Gtk.IMContext::preedit-end] signal.
113func (x *IMContextClass) GetPreeditEnd() func(*IMContext) {
114	if x.xPreeditEnd == 0 {
115		return nil
116	}
117	var rawCallback func(ContextVarp uintptr)
118	purego.RegisterFunc(&rawCallback, x.xPreeditEnd)
119	return func(ContextVar *IMContext) {
120		rawCallback(ContextVar.GoPointer())
121	}
122}
123
124// OverridePreeditChanged sets the "preedit_changed" callback function.
125// Default handler of the [signal@Gtk.IMContext::preedit-changed]
126//
127//	signal.
128func (x *IMContextClass) OverridePreeditChanged(cb func(*IMContext)) {
129	if cb == nil {
130		x.xPreeditChanged = 0
131	} else {
132		x.xPreeditChanged = purego.NewCallback(func(ContextVarp uintptr) {
133			cb(IMContextNewFromInternalPtr(ContextVarp))
134		})
135	}
136}
137
138// GetPreeditChanged gets the "preedit_changed" callback function.
139// Default handler of the [signal@Gtk.IMContext::preedit-changed]
140//
141//	signal.
142func (x *IMContextClass) GetPreeditChanged() func(*IMContext) {
143	if x.xPreeditChanged == 0 {
144		return nil
145	}
146	var rawCallback func(ContextVarp uintptr)
147	purego.RegisterFunc(&rawCallback, x.xPreeditChanged)
148	return func(ContextVar *IMContext) {
149		rawCallback(ContextVar.GoPointer())
150	}
151}
152
153// OverrideCommit sets the "commit" callback function.
154// Default handler of the [signal@Gtk.IMContext::commit] signal.
155func (x *IMContextClass) OverrideCommit(cb func(*IMContext, string)) {
156	if cb == nil {
157		x.xCommit = 0
158	} else {
159		x.xCommit = purego.NewCallback(func(ContextVarp uintptr, StrVarp string) {
160			cb(IMContextNewFromInternalPtr(ContextVarp), StrVarp)
161		})
162	}
163}
164
165// GetCommit gets the "commit" callback function.
166// Default handler of the [signal@Gtk.IMContext::commit] signal.
167func (x *IMContextClass) GetCommit() func(*IMContext, string) {
168	if x.xCommit == 0 {
169		return nil
170	}
171	var rawCallback func(ContextVarp uintptr, StrVarp string)
172	purego.RegisterFunc(&rawCallback, x.xCommit)
173	return func(ContextVar *IMContext, StrVar string) {
174		rawCallback(ContextVar.GoPointer(), StrVar)
175	}
176}
177
178// OverrideRetrieveSurrounding sets the "retrieve_surrounding" callback function.
179// Default handler of the
180//
181//	[signal@Gtk.IMContext::retrieve-surrounding] signal.
182func (x *IMContextClass) OverrideRetrieveSurrounding(cb func(*IMContext) bool) {
183	if cb == nil {
184		x.xRetrieveSurrounding = 0
185	} else {
186		x.xRetrieveSurrounding = purego.NewCallback(func(ContextVarp uintptr) bool {
187			return cb(IMContextNewFromInternalPtr(ContextVarp))
188		})
189	}
190}
191
192// GetRetrieveSurrounding gets the "retrieve_surrounding" callback function.
193// Default handler of the
194//
195//	[signal@Gtk.IMContext::retrieve-surrounding] signal.
196func (x *IMContextClass) GetRetrieveSurrounding() func(*IMContext) bool {
197	if x.xRetrieveSurrounding == 0 {
198		return nil
199	}
200	var rawCallback func(ContextVarp uintptr) bool
201	purego.RegisterFunc(&rawCallback, x.xRetrieveSurrounding)
202	return func(ContextVar *IMContext) bool {
203		return rawCallback(ContextVar.GoPointer())
204	}
205}
206
207// OverrideDeleteSurrounding sets the "delete_surrounding" callback function.
208// Default handler of the
209//
210//	[signal@Gtk.IMContext::delete-surrounding] signal.
211func (x *IMContextClass) OverrideDeleteSurrounding(cb func(*IMContext, int, int) bool) {
212	if cb == nil {
213		x.xDeleteSurrounding = 0
214	} else {
215		x.xDeleteSurrounding = purego.NewCallback(func(ContextVarp uintptr, OffsetVarp int, NCharsVarp int) bool {
216			return cb(IMContextNewFromInternalPtr(ContextVarp), OffsetVarp, NCharsVarp)
217		})
218	}
219}
220
221// GetDeleteSurrounding gets the "delete_surrounding" callback function.
222// Default handler of the
223//
224//	[signal@Gtk.IMContext::delete-surrounding] signal.
225func (x *IMContextClass) GetDeleteSurrounding() func(*IMContext, int, int) bool {
226	if x.xDeleteSurrounding == 0 {
227		return nil
228	}
229	var rawCallback func(ContextVarp uintptr, OffsetVarp int, NCharsVarp int) bool
230	purego.RegisterFunc(&rawCallback, x.xDeleteSurrounding)
231	return func(ContextVar *IMContext, OffsetVar int, NCharsVar int) bool {
232		return rawCallback(ContextVar.GoPointer(), OffsetVar, NCharsVar)
233	}
234}
235
236// OverrideSetClientWidget sets the "set_client_widget" callback function.
237// Called via [method@Gtk.IMContext.set_client_widget] when
238//
239//	the input window where the entered text will appear changes. Override this
240//	to keep track of the current input window, for instance for the purpose of
241//	positioning a status display of your input method.
242func (x *IMContextClass) OverrideSetClientWidget(cb func(*IMContext, *Widget)) {
243	if cb == nil {
244		x.xSetClientWidget = 0
245	} else {
246		x.xSetClientWidget = purego.NewCallback(func(ContextVarp uintptr, WidgetVarp uintptr) {
247			cb(IMContextNewFromInternalPtr(ContextVarp), WidgetNewFromInternalPtr(WidgetVarp))
248		})
249	}
250}
251
252// GetSetClientWidget gets the "set_client_widget" callback function.
253// Called via [method@Gtk.IMContext.set_client_widget] when
254//
255//	the input window where the entered text will appear changes. Override this
256//	to keep track of the current input window, for instance for the purpose of
257//	positioning a status display of your input method.
258func (x *IMContextClass) GetSetClientWidget() func(*IMContext, *Widget) {
259	if x.xSetClientWidget == 0 {
260		return nil
261	}
262	var rawCallback func(ContextVarp uintptr, WidgetVarp uintptr)
263	purego.RegisterFunc(&rawCallback, x.xSetClientWidget)
264	return func(ContextVar *IMContext, WidgetVar *Widget) {
265		rawCallback(ContextVar.GoPointer(), WidgetVar.GoPointer())
266	}
267}
268
269// OverrideGetPreeditString sets the "get_preedit_string" callback function.
270// Called via [method@Gtk.IMContext.get_preedit_string]
271//
272//	to retrieve the text currently being preedited for display at the cursor
273//	position. Any input method which composes complex characters or any
274//	other compositions from multiple sequential key presses should override
275//	this method to provide feedback.
276func (x *IMContextClass) OverrideGetPreeditString(cb func(*IMContext, *string, **pango.AttrList, *int)) {
277	if cb == nil {
278		x.xGetPreeditString = 0
279	} else {
280		x.xGetPreeditString = purego.NewCallback(func(ContextVarp uintptr, StrVarp *string, AttrsVarp **pango.AttrList, CursorPosVarp *int) {
281			cb(IMContextNewFromInternalPtr(ContextVarp), StrVarp, AttrsVarp, CursorPosVarp)
282		})
283	}
284}
285
286// GetGetPreeditString gets the "get_preedit_string" callback function.
287// Called via [method@Gtk.IMContext.get_preedit_string]
288//
289//	to retrieve the text currently being preedited for display at the cursor
290//	position. Any input method which composes complex characters or any
291//	other compositions from multiple sequential key presses should override
292//	this method to provide feedback.
293func (x *IMContextClass) GetGetPreeditString() func(*IMContext, *string, **pango.AttrList, *int) {
294	if x.xGetPreeditString == 0 {
295		return nil
296	}
297	var rawCallback func(ContextVarp uintptr, StrVarp *string, AttrsVarp **pango.AttrList, CursorPosVarp *int)
298	purego.RegisterFunc(&rawCallback, x.xGetPreeditString)
299	return func(ContextVar *IMContext, StrVar *string, AttrsVar **pango.AttrList, CursorPosVar *int) {
300		rawCallback(ContextVar.GoPointer(), StrVar, AttrsVar, CursorPosVar)
301	}
302}
303
304// OverrideFilterKeypress sets the "filter_keypress" callback function.
305// Called via [method@Gtk.IMContext.filter_keypress] on every
306//
307//	key press or release event. Every non-trivial input method needs to
308//	override this in order to implement the mapping from key events to text.
309//	A return value of %TRUE indicates to the caller that the event was
310//	consumed by the input method. In that case, the [signal@Gtk.IMContext::commit]
311//	signal should be emitted upon completion of a key sequence to pass the
312//	resulting text back to the input widget. Alternatively, %FALSE may be
313//	returned to indicate that the event wasn’t handled by the input method.
314//	If a builtin mapping exists for the key, it is used to produce a
315//	character.
316func (x *IMContextClass) OverrideFilterKeypress(cb func(*IMContext, *gdk.Event) bool) {
317	if cb == nil {
318		x.xFilterKeypress = 0
319	} else {
320		x.xFilterKeypress = purego.NewCallback(func(ContextVarp uintptr, EventVarp uintptr) bool {
321			return cb(IMContextNewFromInternalPtr(ContextVarp), gdk.EventNewFromInternalPtr(EventVarp))
322		})
323	}
324}
325
326// GetFilterKeypress gets the "filter_keypress" callback function.
327// Called via [method@Gtk.IMContext.filter_keypress] on every
328//
329//	key press or release event. Every non-trivial input method needs to
330//	override this in order to implement the mapping from key events to text.
331//	A return value of %TRUE indicates to the caller that the event was
332//	consumed by the input method. In that case, the [signal@Gtk.IMContext::commit]
333//	signal should be emitted upon completion of a key sequence to pass the
334//	resulting text back to the input widget. Alternatively, %FALSE may be
335//	returned to indicate that the event wasn’t handled by the input method.
336//	If a builtin mapping exists for the key, it is used to produce a
337//	character.
338func (x *IMContextClass) GetFilterKeypress() func(*IMContext, *gdk.Event) bool {
339	if x.xFilterKeypress == 0 {
340		return nil
341	}
342	var rawCallback func(ContextVarp uintptr, EventVarp uintptr) bool
343	purego.RegisterFunc(&rawCallback, x.xFilterKeypress)
344	return func(ContextVar *IMContext, EventVar *gdk.Event) bool {
345		return rawCallback(ContextVar.GoPointer(), EventVar.GoPointer())
346	}
347}
348
349// OverrideFocusIn sets the "focus_in" callback function.
350// Called via [method@Gtk.IMContext.focus_in] when the input widget
351//
352//	has gained focus. May be overridden to keep track of the current focus.
353func (x *IMContextClass) OverrideFocusIn(cb func(*IMContext)) {
354	if cb == nil {
355		x.xFocusIn = 0
356	} else {
357		x.xFocusIn = purego.NewCallback(func(ContextVarp uintptr) {
358			cb(IMContextNewFromInternalPtr(ContextVarp))
359		})
360	}
361}
362
363// GetFocusIn gets the "focus_in" callback function.
364// Called via [method@Gtk.IMContext.focus_in] when the input widget
365//
366//	has gained focus. May be overridden to keep track of the current focus.
367func (x *IMContextClass) GetFocusIn() func(*IMContext) {
368	if x.xFocusIn == 0 {
369		return nil
370	}
371	var rawCallback func(ContextVarp uintptr)
372	purego.RegisterFunc(&rawCallback, x.xFocusIn)
373	return func(ContextVar *IMContext) {
374		rawCallback(ContextVar.GoPointer())
375	}
376}
377
378// OverrideFocusOut sets the "focus_out" callback function.
379// Called via [method@Gtk.IMContext.focus_out] when the input widget
380//
381//	has lost focus. May be overridden to keep track of the current focus.
382func (x *IMContextClass) OverrideFocusOut(cb func(*IMContext)) {
383	if cb == nil {
384		x.xFocusOut = 0
385	} else {
386		x.xFocusOut = purego.NewCallback(func(ContextVarp uintptr) {
387			cb(IMContextNewFromInternalPtr(ContextVarp))
388		})
389	}
390}
391
392// GetFocusOut gets the "focus_out" callback function.
393// Called via [method@Gtk.IMContext.focus_out] when the input widget
394//
395//	has lost focus. May be overridden to keep track of the current focus.
396func (x *IMContextClass) GetFocusOut() func(*IMContext) {
397	if x.xFocusOut == 0 {
398		return nil
399	}
400	var rawCallback func(ContextVarp uintptr)
401	purego.RegisterFunc(&rawCallback, x.xFocusOut)
402	return func(ContextVar *IMContext) {
403		rawCallback(ContextVar.GoPointer())
404	}
405}
406
407// OverrideReset sets the "reset" callback function.
408// Called via [method@Gtk.IMContext.reset] to signal a change such as a
409//
410//	change in cursor position. An input method that implements preediting
411//	should override this method to clear the preedit state on reset.
412func (x *IMContextClass) OverrideReset(cb func(*IMContext)) {
413	if cb == nil {
414		x.xReset = 0
415	} else {
416		x.xReset = purego.NewCallback(func(ContextVarp uintptr) {
417			cb(IMContextNewFromInternalPtr(ContextVarp))
418		})
419	}
420}
421
422// GetReset gets the "reset" callback function.
423// Called via [method@Gtk.IMContext.reset] to signal a change such as a
424//
425//	change in cursor position. An input method that implements preediting
426//	should override this method to clear the preedit state on reset.
427func (x *IMContextClass) GetReset() func(*IMContext) {
428	if x.xReset == 0 {
429		return nil
430	}
431	var rawCallback func(ContextVarp uintptr)
432	purego.RegisterFunc(&rawCallback, x.xReset)
433	return func(ContextVar *IMContext) {
434		rawCallback(ContextVar.GoPointer())
435	}
436}
437
438// OverrideSetCursorLocation sets the "set_cursor_location" callback function.
439// Called via [method@Gtk.IMContext.set_cursor_location]
440//
441//	to inform the input method of the current cursor location relative to
442//	the client window. May be overridden to implement the display of popup
443//	windows at the cursor position.
444func (x *IMContextClass) OverrideSetCursorLocation(cb func(*IMContext, *gdk.Rectangle)) {
445	if cb == nil {
446		x.xSetCursorLocation = 0
447	} else {
448		x.xSetCursorLocation = purego.NewCallback(func(ContextVarp uintptr, AreaVarp *gdk.Rectangle) {
449			cb(IMContextNewFromInternalPtr(ContextVarp), AreaVarp)
450		})
451	}
452}
453
454// GetSetCursorLocation gets the "set_cursor_location" callback function.
455// Called via [method@Gtk.IMContext.set_cursor_location]
456//
457//	to inform the input method of the current cursor location relative to
458//	the client window. May be overridden to implement the display of popup
459//	windows at the cursor position.
460func (x *IMContextClass) GetSetCursorLocation() func(*IMContext, *gdk.Rectangle) {
461	if x.xSetCursorLocation == 0 {
462		return nil
463	}
464	var rawCallback func(ContextVarp uintptr, AreaVarp *gdk.Rectangle)
465	purego.RegisterFunc(&rawCallback, x.xSetCursorLocation)
466	return func(ContextVar *IMContext, AreaVar *gdk.Rectangle) {
467		rawCallback(ContextVar.GoPointer(), AreaVar)
468	}
469}
470
471// OverrideSetUsePreedit sets the "set_use_preedit" callback function.
472// Called via [method@Gtk.IMContext.set_use_preedit] to control
473//
474//	the use of the preedit string. Override this to display feedback by some
475//	other means if turned off.
476func (x *IMContextClass) OverrideSetUsePreedit(cb func(*IMContext, bool)) {
477	if cb == nil {
478		x.xSetUsePreedit = 0
479	} else {
480		x.xSetUsePreedit = purego.NewCallback(func(ContextVarp uintptr, UsePreeditVarp bool) {
481			cb(IMContextNewFromInternalPtr(ContextVarp), UsePreeditVarp)
482		})
483	}
484}
485
486// GetSetUsePreedit gets the "set_use_preedit" callback function.
487// Called via [method@Gtk.IMContext.set_use_preedit] to control
488//
489//	the use of the preedit string. Override this to display feedback by some
490//	other means if turned off.
491func (x *IMContextClass) GetSetUsePreedit() func(*IMContext, bool) {
492	if x.xSetUsePreedit == 0 {
493		return nil
494	}
495	var rawCallback func(ContextVarp uintptr, UsePreeditVarp bool)
496	purego.RegisterFunc(&rawCallback, x.xSetUsePreedit)
497	return func(ContextVar *IMContext, UsePreeditVar bool) {
498		rawCallback(ContextVar.GoPointer(), UsePreeditVar)
499	}
500}
501
502// OverrideSetSurrounding sets the "set_surrounding" callback function.
503// Called via [method@Gtk.IMContext.set_surrounding] in
504//
505//	response to [signal@Gtk.IMContext::retrieve-surrounding] signal to update
506//	the input method’s idea of the context around the cursor. It is not necessary
507//	to override this method even with input methods which implement
508//	context-dependent behavior. The base implementation is sufficient for
509//	[method@Gtk.IMContext.get_surrounding] to work.
510func (x *IMContextClass) OverrideSetSurrounding(cb func(*IMContext, string, int, int)) {
511	if cb == nil {
512		x.xSetSurrounding = 0
513	} else {
514		x.xSetSurrounding = purego.NewCallback(func(ContextVarp uintptr, TextVarp string, LenVarp int, CursorIndexVarp int) {
515			cb(IMContextNewFromInternalPtr(ContextVarp), TextVarp, LenVarp, CursorIndexVarp)
516		})
517	}
518}
519
520// GetSetSurrounding gets the "set_surrounding" callback function.
521// Called via [method@Gtk.IMContext.set_surrounding] in
522//
523//	response to [signal@Gtk.IMContext::retrieve-surrounding] signal to update
524//	the input method’s idea of the context around the cursor. It is not necessary
525//	to override this method even with input methods which implement
526//	context-dependent behavior. The base implementation is sufficient for
527//	[method@Gtk.IMContext.get_surrounding] to work.
528func (x *IMContextClass) GetSetSurrounding() func(*IMContext, string, int, int) {
529	if x.xSetSurrounding == 0 {
530		return nil
531	}
532	var rawCallback func(ContextVarp uintptr, TextVarp string, LenVarp int, CursorIndexVarp int)
533	purego.RegisterFunc(&rawCallback, x.xSetSurrounding)
534	return func(ContextVar *IMContext, TextVar string, LenVar int, CursorIndexVar int) {
535		rawCallback(ContextVar.GoPointer(), TextVar, LenVar, CursorIndexVar)
536	}
537}
538
539// OverrideGetSurrounding sets the "get_surrounding" callback function.
540// Called via [method@Gtk.IMContext.get_surrounding] to update
541//
542//	the context around the cursor location. It is not necessary to override this
543//	method even with input methods which implement context-dependent behavior.
544//	The base implementation emits [signal@Gtk.IMContext::retrieve-surrounding]
545//	and records the context received by the subsequent invocation of
546//	[vfunc@Gtk.IMContext.get_surrounding].
547func (x *IMContextClass) OverrideGetSurrounding(cb func(*IMContext, *string, *int) bool) {
548	if cb == nil {
549		x.xGetSurrounding = 0
550	} else {
551		x.xGetSurrounding = purego.NewCallback(func(ContextVarp uintptr, TextVarp *string, CursorIndexVarp *int) bool {
552			return cb(IMContextNewFromInternalPtr(ContextVarp), TextVarp, CursorIndexVarp)
553		})
554	}
555}
556
557// GetGetSurrounding gets the "get_surrounding" callback function.
558// Called via [method@Gtk.IMContext.get_surrounding] to update
559//
560//	the context around the cursor location. It is not necessary to override this
561//	method even with input methods which implement context-dependent behavior.
562//	The base implementation emits [signal@Gtk.IMContext::retrieve-surrounding]
563//	and records the context received by the subsequent invocation of
564//	[vfunc@Gtk.IMContext.get_surrounding].
565func (x *IMContextClass) GetGetSurrounding() func(*IMContext, *string, *int) bool {
566	if x.xGetSurrounding == 0 {
567		return nil
568	}
569	var rawCallback func(ContextVarp uintptr, TextVarp *string, CursorIndexVarp *int) bool
570	purego.RegisterFunc(&rawCallback, x.xGetSurrounding)
571	return func(ContextVar *IMContext, TextVar *string, CursorIndexVar *int) bool {
572		return rawCallback(ContextVar.GoPointer(), TextVar, CursorIndexVar)
573	}
574}
575
576// OverrideSetSurroundingWithSelection sets the "set_surrounding_with_selection" callback function.
577// Called via
578//
579//	[method@Gtk.IMContext.set_surrounding_with_selection] in response to the
580//	[signal@Gtk.IMContext::retrieve-surrounding] signal to update the input
581//	method’s idea of the context around the cursor. It is not necessary to
582//	override this method even with input methods which implement
583//	context-dependent behavior. The base implementation is sufficient for
584//	[method@Gtk.IMContext.get_surrounding] to work.
585func (x *IMContextClass) OverrideSetSurroundingWithSelection(cb func(*IMContext, string, int, int, int)) {
586	if cb == nil {
587		x.xSetSurroundingWithSelection = 0
588	} else {
589		x.xSetSurroundingWithSelection = purego.NewCallback(func(ContextVarp uintptr, TextVarp string, LenVarp int, CursorIndexVarp int, AnchorIndexVarp int) {
590			cb(IMContextNewFromInternalPtr(ContextVarp), TextVarp, LenVarp, CursorIndexVarp, AnchorIndexVarp)
591		})
592	}
593}
594
595// GetSetSurroundingWithSelection gets the "set_surrounding_with_selection" callback function.
596// Called via
597//
598//	[method@Gtk.IMContext.set_surrounding_with_selection] in response to the
599//	[signal@Gtk.IMContext::retrieve-surrounding] signal to update the input
600//	method’s idea of the context around the cursor. It is not necessary to
601//	override this method even with input methods which implement
602//	context-dependent behavior. The base implementation is sufficient for
603//	[method@Gtk.IMContext.get_surrounding] to work.
604func (x *IMContextClass) GetSetSurroundingWithSelection() func(*IMContext, string, int, int, int) {
605	if x.xSetSurroundingWithSelection == 0 {
606		return nil
607	}
608	var rawCallback func(ContextVarp uintptr, TextVarp string, LenVarp int, CursorIndexVarp int, AnchorIndexVarp int)
609	purego.RegisterFunc(&rawCallback, x.xSetSurroundingWithSelection)
610	return func(ContextVar *IMContext, TextVar string, LenVar int, CursorIndexVar int, AnchorIndexVar int) {
611		rawCallback(ContextVar.GoPointer(), TextVar, LenVar, CursorIndexVar, AnchorIndexVar)
612	}
613}
614
615// OverrideGetSurroundingWithSelection sets the "get_surrounding_with_selection" callback function.
616// Called via
617//
618//	[method@Gtk.IMContext.get_surrounding_with_selection] to update the
619//	context around the cursor location. It is not necessary to override
620//	this method even with input methods which implement context-dependent
621//	behavior. The base implementation emits
622//	[signal@Gtk.IMContext::retrieve-surrounding] and records the context
623//	received by the subsequent invocation of [vfunc@Gtk.IMContext.get_surrounding].
624func (x *IMContextClass) OverrideGetSurroundingWithSelection(cb func(*IMContext, *string, *int, *int) bool) {
625	if cb == nil {
626		x.xGetSurroundingWithSelection = 0
627	} else {
628		x.xGetSurroundingWithSelection = purego.NewCallback(func(ContextVarp uintptr, TextVarp *string, CursorIndexVarp *int, AnchorIndexVarp *int) bool {
629			return cb(IMContextNewFromInternalPtr(ContextVarp), TextVarp, CursorIndexVarp, AnchorIndexVarp)
630		})
631	}
632}
633
634// GetGetSurroundingWithSelection gets the "get_surrounding_with_selection" callback function.
635// Called via
636//
637//	[method@Gtk.IMContext.get_surrounding_with_selection] to update the
638//	context around the cursor location. It is not necessary to override
639//	this method even with input methods which implement context-dependent
640//	behavior. The base implementation emits
641//	[signal@Gtk.IMContext::retrieve-surrounding] and records the context
642//	received by the subsequent invocation of [vfunc@Gtk.IMContext.get_surrounding].
643func (x *IMContextClass) GetGetSurroundingWithSelection() func(*IMContext, *string, *int, *int) bool {
644	if x.xGetSurroundingWithSelection == 0 {
645		return nil
646	}
647	var rawCallback func(ContextVarp uintptr, TextVarp *string, CursorIndexVarp *int, AnchorIndexVarp *int) bool
648	purego.RegisterFunc(&rawCallback, x.xGetSurroundingWithSelection)
649	return func(ContextVar *IMContext, TextVar *string, CursorIndexVar *int, AnchorIndexVar *int) bool {
650		return rawCallback(ContextVar.GoPointer(), TextVar, CursorIndexVar, AnchorIndexVar)
651	}
652}
653
654// OverrideActivateOsk sets the "activate_osk" callback function.
655func (x *IMContextClass) OverrideActivateOsk(cb func(*IMContext)) {
656	if cb == nil {
657		x.xActivateOsk = 0
658	} else {
659		x.xActivateOsk = purego.NewCallback(func(ContextVarp uintptr) {
660			cb(IMContextNewFromInternalPtr(ContextVarp))
661		})
662	}
663}
664
665// GetActivateOsk gets the "activate_osk" callback function.
666func (x *IMContextClass) GetActivateOsk() func(*IMContext) {
667	if x.xActivateOsk == 0 {
668		return nil
669	}
670	var rawCallback func(ContextVarp uintptr)
671	purego.RegisterFunc(&rawCallback, x.xActivateOsk)
672	return func(ContextVar *IMContext) {
673		rawCallback(ContextVar.GoPointer())
674	}
675}
676
677// OverrideActivateOskWithEvent sets the "activate_osk_with_event" callback function.
678func (x *IMContextClass) OverrideActivateOskWithEvent(cb func(*IMContext, *gdk.Event) bool) {
679	if cb == nil {
680		x.xActivateOskWithEvent = 0
681	} else {
682		x.xActivateOskWithEvent = purego.NewCallback(func(ContextVarp uintptr, EventVarp uintptr) bool {
683			return cb(IMContextNewFromInternalPtr(ContextVarp), gdk.EventNewFromInternalPtr(EventVarp))
684		})
685	}
686}
687
688// GetActivateOskWithEvent gets the "activate_osk_with_event" callback function.
689func (x *IMContextClass) GetActivateOskWithEvent() func(*IMContext, *gdk.Event) bool {
690	if x.xActivateOskWithEvent == 0 {
691		return nil
692	}
693	var rawCallback func(ContextVarp uintptr, EventVarp uintptr) bool
694	purego.RegisterFunc(&rawCallback, x.xActivateOskWithEvent)
695	return func(ContextVar *IMContext, EventVar *gdk.Event) bool {
696		return rawCallback(ContextVar.GoPointer(), EventVar.GoPointer())
697	}
698}
699
700// OverrideGtkReserved2 sets the "_gtk_reserved2" callback function.
701func (x *IMContextClass) OverrideGtkReserved2(cb func()) {
702	if cb == nil {
703		x.xGtkReserved2 = 0
704	} else {
705		x.xGtkReserved2 = purego.NewCallback(func() {
706			cb()
707		})
708	}
709}
710
711// GetGtkReserved2 gets the "_gtk_reserved2" callback function.
712func (x *IMContextClass) GetGtkReserved2() func() {
713	if x.xGtkReserved2 == 0 {
714		return nil
715	}
716	var rawCallback func()
717	purego.RegisterFunc(&rawCallback, x.xGtkReserved2)
718	return func() {
719		rawCallback()
720	}
721}
722
723// OverrideGtkReserved3 sets the "_gtk_reserved3" callback function.
724func (x *IMContextClass) OverrideGtkReserved3(cb func()) {
725	if cb == nil {
726		x.xGtkReserved3 = 0
727	} else {
728		x.xGtkReserved3 = purego.NewCallback(func() {
729			cb()
730		})
731	}
732}
733
734// GetGtkReserved3 gets the "_gtk_reserved3" callback function.
735func (x *IMContextClass) GetGtkReserved3() func() {
736	if x.xGtkReserved3 == 0 {
737		return nil
738	}
739	var rawCallback func()
740	purego.RegisterFunc(&rawCallback, x.xGtkReserved3)
741	return func() {
742		rawCallback()
743	}
744}
745
746// OverrideGtkReserved4 sets the "_gtk_reserved4" callback function.
747func (x *IMContextClass) OverrideGtkReserved4(cb func()) {
748	if cb == nil {
749		x.xGtkReserved4 = 0
750	} else {
751		x.xGtkReserved4 = purego.NewCallback(func() {
752			cb()
753		})
754	}
755}
756
757// GetGtkReserved4 gets the "_gtk_reserved4" callback function.
758func (x *IMContextClass) GetGtkReserved4() func() {
759	if x.xGtkReserved4 == 0 {
760		return nil
761	}
762	var rawCallback func()
763	purego.RegisterFunc(&rawCallback, x.xGtkReserved4)
764	return func() {
765		rawCallback()
766	}
767}
768
769// The interface for GTK input methods.
770//
771// `GtkIMContext` is used by GTK text input widgets like `GtkText`
772// to map from key events to Unicode character strings.
773//
774// An input method may consume multiple key events in sequence before finally
775// outputting the composed result. This is called *preediting*, and an input
776// method may provide feedback about this process by displaying the intermediate
777// composition states as preedit text. To do so, the `GtkIMContext` will emit
778// [signal@Gtk.IMContext::preedit-start], [signal@Gtk.IMContext::preedit-changed]
779// and [signal@Gtk.IMContext::preedit-end] signals.
780//
781// For instance, the built-in GTK input method [class@Gtk.IMContextSimple]
782// implements the input of arbitrary Unicode code points by holding down the
783// <kbd>Control</kbd> and <kbd>Shift</kbd> keys and then typing <kbd>u</kbd>
784// followed by the hexadecimal digits of the code point. When releasing the
785// <kbd>Control</kbd> and <kbd>Shift</kbd> keys, preediting ends and the
786// character is inserted as text. For example,
787//
788//	Ctrl+Shift+u 2 0 A C
789//
790// results in the € sign.
791//
792// Additional input methods can be made available for use by GTK widgets as
793// loadable modules. An input method module is a small shared library which
794// provides a `GIOExtension` for the extension point named "gtk-im-module".
795//
796// To connect a widget to the users preferred input method, you should use
797// [class@Gtk.IMMulticontext].
798type IMContext struct {
799	gobject.Object
800}
801
802var xIMContextGLibType func() types.GType
803
804func IMContextGLibType() types.GType {
805	return xIMContextGLibType()
806}
807
808func IMContextNewFromInternalPtr(ptr uintptr) *IMContext {
809	cls := &IMContext{}
810	cls.Ptr = ptr
811	return cls
812}
813
814var xIMContextActivateOsk func(uintptr, uintptr) bool
815
816// Requests the platform to show an on-screen keyboard for user input.
817//
818// This method will return %TRUE if this request was actually performed
819// to the platform, other environmental factors may result in an on-screen
820// keyboard effectively not showing up.
821func (x *IMContext) ActivateOsk(EventVar *gdk.Event) bool {
822
823	cret := xIMContextActivateOsk(x.GoPointer(), EventVar.GoPointer())
824	return cret
825}
826
827var xIMContextDeleteSurrounding func(uintptr, int, int) bool
828
829// Asks the widget that the input context is attached to delete
830// characters around the cursor position by emitting the
831// `::delete_surrounding` signal.
832//
833// Note that @offset and @n_chars are in characters not in bytes
834// which differs from the usage other places in `GtkIMContext`.
835//
836// In order to use this function, you should first call
837// [method@Gtk.IMContext.get_surrounding] to get the current context,
838// and call this function immediately afterwards to make sure that you
839// know what you are deleting. You should also account for the fact
840// that even if the signal was handled, the input context might not
841// have deleted all the characters that were requested to be deleted.
842//
843// This function is used by an input method that wants to make
844// substitutions in the existing text in response to new input.
845// It is not useful for applications.
846func (x *IMContext) DeleteSurrounding(OffsetVar int, NCharsVar int) bool {
847
848	cret := xIMContextDeleteSurrounding(x.GoPointer(), OffsetVar, NCharsVar)
849	return cret
850}
851
852var xIMContextFilterKey func(uintptr, bool, uintptr, uintptr, uint32, uint, gdk.ModifierType, int) bool
853
854// Allow an input method to forward key press and release events
855// to another input method without necessarily having a `GdkEvent`
856// available.
857func (x *IMContext) FilterKey(PressVar bool, SurfaceVar *gdk.Surface, DeviceVar *gdk.Device, TimeVar uint32, KeycodeVar uint, StateVar gdk.ModifierType, GroupVar int) bool {
858
859	cret := xIMContextFilterKey(x.GoPointer(), PressVar, SurfaceVar.GoPointer(), DeviceVar.GoPointer(), TimeVar, KeycodeVar, StateVar, GroupVar)
860	return cret
861}
862
863var xIMContextFilterKeypress func(uintptr, uintptr) bool
864
865// Allow an input method to internally handle key press and release
866// events.
867//
868// If this function returns %TRUE, then no further processing
869// should be done for this key event.
870func (x *IMContext) FilterKeypress(EventVar *gdk.Event) bool {
871
872	cret := xIMContextFilterKeypress(x.GoPointer(), EventVar.GoPointer())
873	return cret
874}
875
876var xIMContextFocusIn func(uintptr)
877
878// Notify the input method that the widget to which this
879// input context corresponds has gained focus.
880//
881// The input method may, for example, change the displayed
882// feedback to reflect this change.
883func (x *IMContext) FocusIn() {
884
885	xIMContextFocusIn(x.GoPointer())
886
887}
888
889var xIMContextFocusOut func(uintptr)
890
891// Notify the input method that the widget to which this
892// input context corresponds has lost focus.
893//
894// The input method may, for example, change the displayed
895// feedback or reset the contexts state to reflect this change.
896func (x *IMContext) FocusOut() {
897
898	xIMContextFocusOut(x.GoPointer())
899
900}
901
902var xIMContextGetPreeditString func(uintptr, *string, **pango.AttrList, *int)
903
904// Retrieve the current preedit string for the input context,
905// and a list of attributes to apply to the string.
906//
907// This string should be displayed inserted at the insertion point.
908func (x *IMContext) GetPreeditString(StrVar *string, AttrsVar **pango.AttrList, CursorPosVar *int) {
909
910	xIMContextGetPreeditString(x.GoPointer(), StrVar, AttrsVar, CursorPosVar)
911
912}
913
914var xIMContextGetSurrounding func(uintptr, *string, *int) bool
915
916// Retrieves context around the insertion point.
917//
918// Input methods typically want context in order to constrain input text
919// based on existing text; this is important for languages such as Thai
920// where only some sequences of characters are allowed.
921//
922// This function is implemented by emitting the
923// [signal@Gtk.IMContext::retrieve-surrounding] signal on the input method;
924// in response to this signal, a widget should provide as much context as
925// is available, up to an entire paragraph, by calling
926// [method@Gtk.IMContext.set_surrounding].
927//
928// Note that there is no obligation for a widget to respond to the
929// `::retrieve-surrounding` signal, so input methods must be prepared to
930// function without context.
931func (x *IMContext) GetSurrounding(TextVar *string, CursorIndexVar *int) bool {
932
933	cret := xIMContextGetSurrounding(x.GoPointer(), TextVar, CursorIndexVar)
934	return cret
935}
936
937var xIMContextGetSurroundingWithSelection func(uintptr, *string, *int, *int) bool
938
939// Retrieves context around the insertion point.
940//
941// Input methods typically want context in order to constrain input
942// text based on existing text; this is important for languages such
943// as Thai where only some sequences of characters are allowed.
944//
945// This function is implemented by emitting the
946// [signal@Gtk.IMContext::retrieve-surrounding] signal on the input method;
947// in response to this signal, a widget should provide as much context as
948// is available, up to an entire paragraph, by calling
949// [method@Gtk.IMContext.set_surrounding_with_selection].
950//
951// Note that there is no obligation for a widget to respond to the
952// `::retrieve-surrounding` signal, so input methods must be prepared to
953// function without context.
954func (x *IMContext) GetSurroundingWithSelection(TextVar *string, CursorIndexVar *int, AnchorIndexVar *int) bool {
955
956	cret := xIMContextGetSurroundingWithSelection(x.GoPointer(), TextVar, CursorIndexVar, AnchorIndexVar)
957	return cret
958}
959
960var xIMContextReset func(uintptr)
961
962// Notify the input method that a change such as a change in cursor
963// position has been made.
964//
965// This will typically cause the input method to clear the preedit state.
966func (x *IMContext) Reset() {
967
968	xIMContextReset(x.GoPointer())
969
970}
971
972var xIMContextSetClientWidget func(uintptr, uintptr)
973
974// Set the client widget for the input context.
975//
976// This is the `GtkWidget` holding the input focus. This widget is
977// used in order to correctly position status windows, and may
978// also be used for purposes internal to the input method.
979func (x *IMContext) SetClientWidget(WidgetVar *Widget) {
980
981	xIMContextSetClientWidget(x.GoPointer(), WidgetVar.GoPointer())
982
983}
984
985var xIMContextSetCursorLocation func(uintptr, *gdk.Rectangle)
986
987// Notify the input method that a change in cursor
988// position has been made.
989//
990// The location is relative to the client widget.
991func (x *IMContext) SetCursorLocation(AreaVar *gdk.Rectangle) {
992
993	xIMContextSetCursorLocation(x.GoPointer(), AreaVar)
994
995}
996
997var xIMContextSetSurrounding func(uintptr, string, int, int)
998
999// Sets surrounding context around the insertion point and preedit
1000// string.
1001//
1002// This function is expected to be called in response to the
1003// [signal@Gtk.IMContext::retrieve-surrounding] signal, and will
1004// likely have no effect if called at other times.
1005func (x *IMContext) SetSurrounding(TextVar string, LenVar int, CursorIndexVar int) {
1006
1007	xIMContextSetSurrounding(x.GoPointer(), TextVar, LenVar, CursorIndexVar)
1008
1009}
1010
1011var xIMContextSetSurroundingWithSelection func(uintptr, string, int, int, int)
1012
1013// Sets surrounding context around the insertion point and preedit
1014// string. This function is expected to be called in response to the
1015// [signal@Gtk.IMContext::retrieve_surrounding] signal, and will likely
1016// have no effect if called at other times.
1017func (x *IMContext) SetSurroundingWithSelection(TextVar string, LenVar int, CursorIndexVar int, AnchorIndexVar int) {
1018
1019	xIMContextSetSurroundingWithSelection(x.GoPointer(), TextVar, LenVar, CursorIndexVar, AnchorIndexVar)
1020
1021}
1022
1023var xIMContextSetUsePreedit func(uintptr, bool)
1024
1025// Sets whether the IM context should use the preedit string
1026// to display feedback.
1027//
1028// If @use_preedit is %FALSE (default is %TRUE), then the IM context
1029// may use some other method to display feedback, such as displaying
1030// it in a child of the root window.
1031func (x *IMContext) SetUsePreedit(UsePreeditVar bool) {
1032
1033	xIMContextSetUsePreedit(x.GoPointer(), UsePreeditVar)
1034
1035}
1036
1037func (c *IMContext) GoPointer() uintptr {
1038	if c == nil {
1039		return 0
1040	}
1041	return c.Ptr
1042}
1043
1044func (c *IMContext) SetGoPointer(ptr uintptr) {
1045	c.Ptr = ptr
1046}
1047
1048// The ::commit signal is emitted when a complete input sequence
1049// has been entered by the user.
1050//
1051// If the commit comes after a preediting sequence, the
1052// ::commit signal is emitted after ::preedit-end.
1053//
1054// This can be a single character immediately after a key press or
1055// the final result of preediting.
1056func (x *IMContext) ConnectCommit(cb *func(IMContext, string)) uint {
1057	cbPtr := uintptr(unsafe.Pointer(cb))
1058	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1059		handlerID := gobject.SignalConnect(x.GoPointer(), "commit", cbRefPtr)
1060		glib.SaveHandlerMapping(handlerID, cbPtr)
1061		return handlerID
1062	}
1063
1064	fcb := func(clsPtr uintptr, StrVarp uintptr) {
1065		fa := IMContext{}
1066		fa.Ptr = clsPtr
1067		cbFn := *cb
1068
1069		cbFn(fa, core.GoString(StrVarp))
1070
1071	}
1072	cbRefPtr := purego.NewCallback(fcb)
1073	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1074	handlerID := gobject.SignalConnect(x.GoPointer(), "commit", cbRefPtr)
1075	glib.SaveHandlerMapping(handlerID, cbPtr)
1076	return handlerID
1077}
1078
1079// The ::delete-surrounding signal is emitted when the input method
1080// needs to delete all or part of the context surrounding the cursor.
1081func (x *IMContext) ConnectDeleteSurrounding(cb *func(IMContext, int, int) bool) uint {
1082	cbPtr := uintptr(unsafe.Pointer(cb))
1083	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1084		handlerID := gobject.SignalConnect(x.GoPointer(), "delete-surrounding", cbRefPtr)
1085		glib.SaveHandlerMapping(handlerID, cbPtr)
1086		return handlerID
1087	}
1088
1089	fcb := func(clsPtr uintptr, OffsetVarp int, NCharsVarp int) bool {
1090		fa := IMContext{}
1091		fa.Ptr = clsPtr
1092		cbFn := *cb
1093
1094		return cbFn(fa, OffsetVarp, NCharsVarp)
1095
1096	}
1097	cbRefPtr := purego.NewCallback(fcb)
1098	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1099	handlerID := gobject.SignalConnect(x.GoPointer(), "delete-surrounding", cbRefPtr)
1100	glib.SaveHandlerMapping(handlerID, cbPtr)
1101	return handlerID
1102}
1103
1104// The ::preedit-changed signal is emitted whenever the preedit sequence
1105// currently being entered has changed.
1106//
1107// It is also emitted at the end of a preedit sequence, in which case
1108// [method@Gtk.IMContext.get_preedit_string] returns the empty string.
1109func (x *IMContext) ConnectPreeditChanged(cb *func(IMContext)) uint {
1110	cbPtr := uintptr(unsafe.Pointer(cb))
1111	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1112		handlerID := gobject.SignalConnect(x.GoPointer(), "preedit-changed", cbRefPtr)
1113		glib.SaveHandlerMapping(handlerID, cbPtr)
1114		return handlerID
1115	}
1116
1117	fcb := func(clsPtr uintptr) {
1118		fa := IMContext{}
1119		fa.Ptr = clsPtr
1120		cbFn := *cb
1121
1122		cbFn(fa)
1123
1124	}
1125	cbRefPtr := purego.NewCallback(fcb)
1126	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1127	handlerID := gobject.SignalConnect(x.GoPointer(), "preedit-changed", cbRefPtr)
1128	glib.SaveHandlerMapping(handlerID, cbPtr)
1129	return handlerID
1130}
1131
1132// The ::preedit-end signal is emitted when a preediting sequence
1133// has been completed or canceled.
1134func (x *IMContext) ConnectPreeditEnd(cb *func(IMContext)) uint {
1135	cbPtr := uintptr(unsafe.Pointer(cb))
1136	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1137		handlerID := gobject.SignalConnect(x.GoPointer(), "preedit-end", cbRefPtr)
1138		glib.SaveHandlerMapping(handlerID, cbPtr)
1139		return handlerID
1140	}
1141
1142	fcb := func(clsPtr uintptr) {
1143		fa := IMContext{}
1144		fa.Ptr = clsPtr
1145		cbFn := *cb
1146
1147		cbFn(fa)
1148
1149	}
1150	cbRefPtr := purego.NewCallback(fcb)
1151	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1152	handlerID := gobject.SignalConnect(x.GoPointer(), "preedit-end", cbRefPtr)
1153	glib.SaveHandlerMapping(handlerID, cbPtr)
1154	return handlerID
1155}
1156
1157// The ::preedit-start signal is emitted when a new preediting sequence
1158// starts.
1159func (x *IMContext) ConnectPreeditStart(cb *func(IMContext)) uint {
1160	cbPtr := uintptr(unsafe.Pointer(cb))
1161	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1162		handlerID := gobject.SignalConnect(x.GoPointer(), "preedit-start", cbRefPtr)
1163		glib.SaveHandlerMapping(handlerID, cbPtr)
1164		return handlerID
1165	}
1166
1167	fcb := func(clsPtr uintptr) {
1168		fa := IMContext{}
1169		fa.Ptr = clsPtr
1170		cbFn := *cb
1171
1172		cbFn(fa)
1173
1174	}
1175	cbRefPtr := purego.NewCallback(fcb)
1176	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1177	handlerID := gobject.SignalConnect(x.GoPointer(), "preedit-start", cbRefPtr)
1178	glib.SaveHandlerMapping(handlerID, cbPtr)
1179	return handlerID
1180}
1181
1182// The ::retrieve-surrounding signal is emitted when the input method
1183// requires the context surrounding the cursor.
1184//
1185// The callback should set the input method surrounding context by
1186// calling the [method@Gtk.IMContext.set_surrounding] method.
1187func (x *IMContext) ConnectRetrieveSurrounding(cb *func(IMContext) bool) uint {
1188	cbPtr := uintptr(unsafe.Pointer(cb))
1189	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1190		handlerID := gobject.SignalConnect(x.GoPointer(), "retrieve-surrounding", cbRefPtr)
1191		glib.SaveHandlerMapping(handlerID, cbPtr)
1192		return handlerID
1193	}
1194
1195	fcb := func(clsPtr uintptr) bool {
1196		fa := IMContext{}
1197		fa.Ptr = clsPtr
1198		cbFn := *cb
1199
1200		return cbFn(fa)
1201
1202	}
1203	cbRefPtr := purego.NewCallback(fcb)
1204	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1205	handlerID := gobject.SignalConnect(x.GoPointer(), "retrieve-surrounding", cbRefPtr)
1206	glib.SaveHandlerMapping(handlerID, cbPtr)
1207	return handlerID
1208}
1209
1210func init() {
1211	core.SetPackageName("GTK", "gtk4")
1212	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
1213	var libs []uintptr
1214	for _, libPath := range core.GetPaths("GTK") {
1215		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
1216		if err != nil {
1217			panic(err)
1218		}
1219		libs = append(libs, lib)
1220	}
1221
1222	core.PuregoSafeRegister(&xIMContextGLibType, libs, "gtk_im_context_get_type")
1223
1224	core.PuregoSafeRegister(&xIMContextActivateOsk, libs, "gtk_im_context_activate_osk")
1225	core.PuregoSafeRegister(&xIMContextDeleteSurrounding, libs, "gtk_im_context_delete_surrounding")
1226	core.PuregoSafeRegister(&xIMContextFilterKey, libs, "gtk_im_context_filter_key")
1227	core.PuregoSafeRegister(&xIMContextFilterKeypress, libs, "gtk_im_context_filter_keypress")
1228	core.PuregoSafeRegister(&xIMContextFocusIn, libs, "gtk_im_context_focus_in")
1229	core.PuregoSafeRegister(&xIMContextFocusOut, libs, "gtk_im_context_focus_out")
1230	core.PuregoSafeRegister(&xIMContextGetPreeditString, libs, "gtk_im_context_get_preedit_string")
1231	core.PuregoSafeRegister(&xIMContextGetSurrounding, libs, "gtk_im_context_get_surrounding")
1232	core.PuregoSafeRegister(&xIMContextGetSurroundingWithSelection, libs, "gtk_im_context_get_surrounding_with_selection")
1233	core.PuregoSafeRegister(&xIMContextReset, libs, "gtk_im_context_reset")
1234	core.PuregoSafeRegister(&xIMContextSetClientWidget, libs, "gtk_im_context_set_client_widget")
1235	core.PuregoSafeRegister(&xIMContextSetCursorLocation, libs, "gtk_im_context_set_cursor_location")
1236	core.PuregoSafeRegister(&xIMContextSetSurrounding, libs, "gtk_im_context_set_surrounding")
1237	core.PuregoSafeRegister(&xIMContextSetSurroundingWithSelection, libs, "gtk_im_context_set_surrounding_with_selection")
1238	core.PuregoSafeRegister(&xIMContextSetUsePreedit, libs, "gtk_im_context_set_use_preedit")
1239
1240}

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