1.97 <GtkIMContext>

Class: <GtkIMContext>

It derives from <GObject>.

The interface for GTK input methods.

<GtkIMContext> is used by GTK text input widgets like <GtkText> to map from key events to Unicode character strings.

An input method may consume multiple key events in sequence before finally outputting the composed result. This is called preediting, and an input method may provide feedback about this process by displaying the intermediate composition states as preedit text. To do so, the <GtkIMContext> will emit imcontext:preedit-start, imcontext:preedit-changed and imcontext:preedit-end signals.

For instance, the built-in GTK input method <GtkIMContextSimple> implements the input of arbitrary Unicode code points by holding down the Control and Shift keys and then typing u followed by the hexadecimal digits of the code point. When releasing the Control and Shift keys, preediting ends and the character is inserted as text. For example,

Ctrl+Shift+u 2 0 A C

results in the € sign.

Additional input methods can be made available for use by GTK widgets as loadable modules. An input method module is a small shared library which provides a GIOExtension for the extension point named "gtk-im-module".

To connect a widget to the users preferred input method, you should use <GtkIMMulticontext>.

Fields

parent-instance

Properties

Property: imcontext:input-hints self

Additional hints that allow input methods to fine-tune their behaviour.

Its value is a <GtkInputHints> (or, to set it, a list of its symbols, or one of them).

Set it with (set! (imcontext:input-hints self) value).

Property: imcontext:input-purpose self

The purpose of the text field that the ‘GtkIMContext is connected to.

This property can be used by on-screen keyboards and other input methods to adjust their behaviour.

Its value is a <GtkInputPurpose> (or, to set it, one of its symbols).

Set it with (set! (imcontext:input-purpose self) value).

Procedures

Method: imcontext:activate-osk? self [event] ⇒ %return
Method: activate-osk? self [event] ⇒ %return

Requests the platform to show an on-screen keyboard for user input.

This method will return #t if this request was actually performed to the platform, other environmental factors may result in an on-screen keyboard effectively not showing up.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

event

Passed, or left out: a <GdkEvent>, or #f.

a <GdkEvent>

%return

Returned: a boolean.

#t if an on-screen keyboard could be requested to the platform.

Method: imcontext:delete-surrounding? self offset n-chars ⇒ %return
Method: delete-surrounding? self offset n-chars ⇒ %return

Asks the widget that the input context is attached to delete characters around the cursor position by emitting the ::delete_surrounding signal.

Note that offset and n-chars are in characters not in bytes which differs from the usage other places in <GtkIMContext>.

In order to use this function, you should first call imcontext:get-surrounding to get the current context, and call this function immediately afterwards to make sure that you know what you are deleting. You should also account for the fact that even if the signal was handled, the input context might not have deleted all the characters that were requested to be deleted.

This function is used by an input method that wants to make substitutions in the existing text in response to new input. It is not useful for applications.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

offset

Passed: a 32-bit integer.

offset from cursor position in chars; a negative value means start before the cursor.

n-chars

Passed: a 32-bit integer.

number of characters to delete.

%return

Returned: a boolean.

#t if the signal was handled.

Method: imcontext:filter-key? self press surface device time keycode state group ⇒ %return
Method: filter-key? self press surface device time keycode state group ⇒ %return

Allow an input method to forward key press and release events to another input method without necessarily having a <GdkEvent> available.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

press

Passed: a boolean.

whether to forward a key press or release event

surface

Passed: a <GdkSurface>.

the surface the event is for

device

Passed: a <GdkDevice>.

the device that the event is for

time

Passed: an unsigned 32-bit integer.

the timestamp for the event

keycode

Passed: an unsigned 32-bit integer.

the keycode for the event

state

Passed: a <GdkModifierType>, or a list of its symbols, or one of them.

modifier state for the event

group

Passed: a 32-bit integer.

the active keyboard group for the event

%return

Returned: a boolean.

#t if the input method handled the key event.

Method: imcontext:filter-keypress? self event ⇒ %return
Method: filter-keypress? self event ⇒ %return

Allow an input method to internally handle key press and release events.

If this function returns #t, then no further processing should be done for this key event.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

event

Passed: a <GdkEvent>.

the key event

%return

Returned: a boolean.

#t if the input method handled the key event.

Method: imcontext:focus-in self
Method: focus-in self

Notify the input method that the widget to which this input context corresponds has gained focus.

The input method may, for example, change the displayed feedback to reflect this change.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

Method: imcontext:focus-out self
Method: focus-out self

Notify the input method that the widget to which this input context corresponds has lost focus.

The input method may, for example, change the displayed feedback or reset the contexts state to reflect this change.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

Method: imcontext:get-preedit-string self ⇒ str attrs cursor-pos
Method: get-preedit-string self ⇒ str attrs cursor-pos

Retrieve the current preedit string for the input context, and a list of attributes to apply to the string.

This string should be displayed inserted at the insertion point.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

str

Returned: a string.

location to store the retrieved string. The string retrieved must be freed with byte-array:free.

attrs

Returned: a <PangoAttrList>.

location to store the retrieved attribute list. When you are done with this list, you must unreference it with attr-list:unref.

cursor-pos

Returned: a 32-bit integer.

location to store position of cursor (in characters) within the preedit string.

Method: imcontext:get-surrounding self ⇒ %return text cursor-index
Method: get-surrounding self ⇒ %return text cursor-index

Retrieves context around the insertion point.

Input methods typically want context in order to constrain input text based on existing text; this is important for languages such as Thai where only some sequences of characters are allowed.

This function is implemented by emitting the imcontext:retrieve-surrounding signal on the input method; in response to this signal, a widget should provide as much context as is available, up to an entire paragraph, by calling imcontext:set-surrounding.

Note that there is no obligation for a widget to respond to the ::retrieve-surrounding signal, so input methods must be prepared to function without context.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

%return

Returned: a boolean.

TRUE if surrounding text was provided; in this case you must free the result stored in text.

text

Returned: a string.

location to store a UTF-8 encoded string of text holding context around the insertion point. If the function returns #t, then you must free the result stored in this location with byte-array:free.

cursor-index

Returned: a 32-bit integer.

location to store byte index of the insertion cursor within text.

Method: imcontext:get-surrounding-with-selection self ⇒ %return text cursor-index anchor-index
Method: get-surrounding-with-selection self ⇒ %return text cursor-index anchor-index

Retrieves context around the insertion point.

Input methods typically want context in order to constrain input text based on existing text; this is important for languages such as Thai where only some sequences of characters are allowed.

This function is implemented by emitting the imcontext:retrieve-surrounding signal on the input method; in response to this signal, a widget should provide as much context as is available, up to an entire paragraph, by calling imcontext:set-surrounding-with-selection.

Note that there is no obligation for a widget to respond to the ::retrieve-surrounding signal, so input methods must be prepared to function without context.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

%return

Returned: a boolean.

TRUE if surrounding text was provided; in this case you must free the result stored in text.

text

Returned: a string.

location to store a UTF-8 encoded string of text holding context around the insertion point. If the function returns #t, then you must free the result stored in this location with byte-array:free.

cursor-index

Returned: a 32-bit integer.

location to store byte index of the insertion cursor within text.

anchor-index

Returned: a 32-bit integer.

location to store byte index of the selection bound within text

Method: imcontext:reset self
Method: reset self

Notify the input method that a change such as a change in cursor position has been made.

This will typically cause the input method to clear the preedit state.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

Method: imcontext:set-client-widget self [widget]
Method: set-client-widget self [widget]

Set the client widget for the input context.

This is the <GtkWidget> holding the input focus. This widget is used in order to correctly position status windows, and may also be used for purposes internal to the input method.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

widget

Passed, or left out: a <GtkWidget>, or #f.

the client widget. This may be #f to indicate that the previous client widget no longer exists.

Method: imcontext:set-cursor-location self area
Method: set-cursor-location self area

Notify the input method that a change in cursor position has been made.

The location is relative to the client widget.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

area

Passed: a <GdkRectangle>.

new location

Method: imcontext:set-surrounding self text len cursor-index
Method: set-surrounding self text len cursor-index

Sets surrounding context around the insertion point and preedit string.

This function is expected to be called in response to the imcontext:retrieve-surrounding signal, and will likely have no effect if called at other times.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

text

Passed: a string.

text surrounding the insertion point, as UTF-8. the preedit string should not be included within text

len

Passed: a 32-bit integer.

the length of text, or -1 if text is nul-terminated

cursor-index

Passed: a 32-bit integer.

the byte index of the insertion cursor within text.

Method: imcontext:set-surrounding-with-selection self text len cursor-index anchor-index
Method: set-surrounding-with-selection self text len cursor-index anchor-index

Sets surrounding context around the insertion point and preedit string. This function is expected to be called in response to the "retrieve_surrounding" signal, and will likely have no effect if called at other times.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

text

Passed: a string.

text surrounding the insertion point, as UTF-8. the preedit string should not be included within text

len

Passed: a 32-bit integer.

the length of text, or -1 if text is nul-terminated

cursor-index

Passed: a 32-bit integer.

the byte index of the insertion cursor within text

anchor-index

Passed: a 32-bit integer.

the byte index of the selection bound within text

Method: imcontext:set-use-preedit self use-preedit
Method: set-use-preedit self use-preedit

Sets whether the IM context should use the preedit string to display feedback.

If use-preedit is #f (default is #t), then the IM context may use some other method to display feedback, such as displaying it in a child of the root window.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

use-preedit

Passed: a boolean.

whether the IM context should use the preedit string.

Signals

Signal: imcontext:commit

Connect a handler with (connect object imcontext:commit handler). It is called as (handler self str).

The ::commit signal is emitted when a complete input sequence has been entered by the user.

If the commit comes after a preediting sequence, the ::commit signal is emitted after ::preedit-end.

This can be a single character immediately after a key press or the final result of preediting.

self

Passed: a <GtkIMContext>.

str

Passed: a string.

the completed character(s) entered by the user

Signal: imcontext:delete-surrounding

Connect a handler with (connect object imcontext:delete-surrounding handler). It is called as (handler self offset n-chars) ⇒ %return.

The ::delete-surrounding signal is emitted when the input method needs to delete all or part of the context surrounding the cursor.

self

Passed: a <GtkIMContext>.

offset

Passed: a 32-bit integer.

the character offset from the cursor position of the text to be deleted. A negative value indicates a position before the cursor.

n-chars

Passed: a 32-bit integer.

the number of characters to be deleted

%return

Returned: a boolean.

#t if the signal was handled.

Signal: imcontext:invalid-composition

Connect a handler with (connect object imcontext:invalid-composition handler). It is called as (handler self str) ⇒ %return.

Emitted when the filtered keys do not compose to a single valid character.

self

Passed: a <GtkIMContext>.

str

Passed: a string.

the completed character(s) entered by the user

%return

Returned: a boolean.

true if the IM context avoid beeping on invalid composition

Signal: imcontext:preedit-changed

Connect a handler with (connect object imcontext:preedit-changed handler). It is called as (handler self).

The ::preedit-changed signal is emitted whenever the preedit sequence currently being entered has changed.

It is also emitted at the end of a preedit sequence, in which case imcontext:get-preedit-string returns the empty string.

self

Passed: a <GtkIMContext>.

Signal: imcontext:preedit-end

Connect a handler with (connect object imcontext:preedit-end handler). It is called as (handler self).

The ::preedit-end signal is emitted when a preediting sequence has been completed or canceled.

self

Passed: a <GtkIMContext>.

Signal: imcontext:preedit-start

Connect a handler with (connect object imcontext:preedit-start handler). It is called as (handler self).

The ::preedit-start signal is emitted when a new preediting sequence starts.

self

Passed: a <GtkIMContext>.

Signal: imcontext:retrieve-surrounding

Connect a handler with (connect object imcontext:retrieve-surrounding handler). It is called as (handler self) ⇒ %return.

The ::retrieve-surrounding signal is emitted when the input method requires the context surrounding the cursor.

The callback should set the input method surrounding context by calling the imcontext:set-surrounding method.

self

Passed: a <GtkIMContext>.

%return

Returned: a boolean.

#t if the signal was handled.

Virtual methods

Virtual method: imcontext:do-activate-osk implementor self

To override it in a new class, give register-type #:vfuncs `((activate-osk . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

Virtual method: imcontext:do-activate-osk-with-event implementor self event ⇒ %return

To override it in a new class, give register-type #:vfuncs `((activate-osk-with-event . ,procedure)). The procedure is called as (procedure self event) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

event

Passed: a <GdkEvent>.

%return

Returned: a boolean.

Virtual method: imcontext:do-commit implementor self str

Default handler of the imcontext:commit signal.

To override it in a new class, give register-type #:vfuncs `((commit . ,procedure)). The procedure is called as (procedure self str).

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

str

Passed: a string.

Virtual method: imcontext:do-delete-surrounding implementor self offset n-chars ⇒ %return

Asks the widget that the input context is attached to delete characters around the cursor position by emitting the ::delete_surrounding signal.

Note that offset and n-chars are in characters not in bytes which differs from the usage other places in <GtkIMContext>.

In order to use this function, you should first call imcontext:get-surrounding to get the current context, and call this function immediately afterwards to make sure that you know what you are deleting. You should also account for the fact that even if the signal was handled, the input context might not have deleted all the characters that were requested to be deleted.

This function is used by an input method that wants to make substitutions in the existing text in response to new input. It is not useful for applications.

To override it in a new class, give register-type #:vfuncs `((delete-surrounding . ,procedure)). The procedure is called as (procedure self offset n-chars) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

offset

Passed: a 32-bit integer.

offset from cursor position in chars; a negative value means start before the cursor.

n-chars

Passed: a 32-bit integer.

number of characters to delete.

%return

Returned: a boolean.

#t if the signal was handled.

Virtual method: imcontext:do-filter-keypress implementor self event ⇒ %return

Allow an input method to internally handle key press and release events.

If this function returns #t, then no further processing should be done for this key event.

To override it in a new class, give register-type #:vfuncs `((filter-keypress . ,procedure)). The procedure is called as (procedure self event) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

event

Passed: a <GdkEvent>.

the key event

%return

Returned: a boolean.

#t if the input method handled the key event.

Virtual method: imcontext:do-focus-in implementor self

Notify the input method that the widget to which this input context corresponds has gained focus.

The input method may, for example, change the displayed feedback to reflect this change.

To override it in a new class, give register-type #:vfuncs `((focus-in . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

Virtual method: imcontext:do-focus-out implementor self

Notify the input method that the widget to which this input context corresponds has lost focus.

The input method may, for example, change the displayed feedback or reset the contexts state to reflect this change.

To override it in a new class, give register-type #:vfuncs `((focus-out . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

Virtual method: imcontext:do-get-preedit-string implementor self ⇒ str attrs cursor-pos

Retrieve the current preedit string for the input context, and a list of attributes to apply to the string.

This string should be displayed inserted at the insertion point.

To override it in a new class, give register-type #:vfuncs `((get-preedit-string . ,procedure)). The procedure is called as (procedure self) ⇒ str attrs cursor-pos.

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

str

Returned: a string.

location to store the retrieved string. The string retrieved must be freed with byte-array:free.

attrs

Returned: a <PangoAttrList>.

location to store the retrieved attribute list. When you are done with this list, you must unreference it with attr-list:unref.

cursor-pos

Returned: a 32-bit integer.

location to store position of cursor (in characters) within the preedit string.

Virtual method: imcontext:do-get-surrounding implementor self ⇒ %return text cursor-index

Retrieves context around the insertion point.

Input methods typically want context in order to constrain input text based on existing text; this is important for languages such as Thai where only some sequences of characters are allowed.

This function is implemented by emitting the imcontext:retrieve-surrounding signal on the input method; in response to this signal, a widget should provide as much context as is available, up to an entire paragraph, by calling imcontext:set-surrounding.

Note that there is no obligation for a widget to respond to the ::retrieve-surrounding signal, so input methods must be prepared to function without context.

To override it in a new class, give register-type #:vfuncs `((get-surrounding . ,procedure)). The procedure is called as (procedure self) ⇒ %return text cursor-index.

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

%return

Returned: a boolean.

TRUE if surrounding text was provided; in this case you must free the result stored in text.

text

Returned: a string.

location to store a UTF-8 encoded string of text holding context around the insertion point. If the function returns #t, then you must free the result stored in this location with byte-array:free.

cursor-index

Returned: a 32-bit integer.

location to store byte index of the insertion cursor within text.

Virtual method: imcontext:do-get-surrounding-with-selection implementor self ⇒ %return text cursor-index anchor-index

Retrieves context around the insertion point.

Input methods typically want context in order to constrain input text based on existing text; this is important for languages such as Thai where only some sequences of characters are allowed.

This function is implemented by emitting the imcontext:retrieve-surrounding signal on the input method; in response to this signal, a widget should provide as much context as is available, up to an entire paragraph, by calling imcontext:set-surrounding-with-selection.

Note that there is no obligation for a widget to respond to the ::retrieve-surrounding signal, so input methods must be prepared to function without context.

To override it in a new class, give register-type #:vfuncs `((get-surrounding-with-selection . ,procedure)). The procedure is called as (procedure self) ⇒ %return text cursor-index anchor-index.

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

%return

Returned: a boolean.

TRUE if surrounding text was provided; in this case you must free the result stored in text.

text

Returned: a string.

location to store a UTF-8 encoded string of text holding context around the insertion point. If the function returns #t, then you must free the result stored in this location with byte-array:free.

cursor-index

Returned: a 32-bit integer.

location to store byte index of the insertion cursor within text.

anchor-index

Returned: a 32-bit integer.

location to store byte index of the selection bound within text

Virtual method: imcontext:do-invalid-composition implementor self str ⇒ %return

Default handler of the imcontext:invalid-composition signal. Since: 4.22

To override it in a new class, give register-type #:vfuncs `((invalid-composition . ,procedure)). The procedure is called as (procedure self str) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

str

Passed: a string.

%return

Returned: a boolean.

Virtual method: imcontext:do-preedit-changed implementor self

Default handler of the imcontext:preedit-changed signal.

To override it in a new class, give register-type #:vfuncs `((preedit-changed . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

Virtual method: imcontext:do-preedit-end implementor self

Default handler of the imcontext:preedit-end signal.

To override it in a new class, give register-type #:vfuncs `((preedit-end . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

Virtual method: imcontext:do-preedit-start implementor self

Default handler of the imcontext:preedit-start signal.

To override it in a new class, give register-type #:vfuncs `((preedit-start . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

Virtual method: imcontext:do-reset implementor self

Notify the input method that a change such as a change in cursor position has been made.

This will typically cause the input method to clear the preedit state.

To override it in a new class, give register-type #:vfuncs `((reset . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

Virtual method: imcontext:do-retrieve-surrounding implementor self ⇒ %return

Default handler of the imcontext:retrieve-surrounding signal.

To override it in a new class, give register-type #:vfuncs `((retrieve-surrounding . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

%return

Returned: a boolean.

Virtual method: imcontext:do-set-client-widget implementor self [widget]

Set the client widget for the input context.

This is the <GtkWidget> holding the input focus. This widget is used in order to correctly position status windows, and may also be used for purposes internal to the input method.

To override it in a new class, give register-type #:vfuncs `((set-client-widget . ,procedure)). The procedure is called as (procedure self widget).

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

widget

Passed, or left out: a <GtkWidget>, or #f.

the client widget. This may be #f to indicate that the previous client widget no longer exists.

Virtual method: imcontext:do-set-cursor-location implementor self area

Notify the input method that a change in cursor position has been made.

The location is relative to the client widget.

To override it in a new class, give register-type #:vfuncs `((set-cursor-location . ,procedure)). The procedure is called as (procedure self area).

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

area

Passed: a <GdkRectangle>.

new location

Virtual method: imcontext:do-set-surrounding implementor self text len cursor-index

Sets surrounding context around the insertion point and preedit string.

This function is expected to be called in response to the imcontext:retrieve-surrounding signal, and will likely have no effect if called at other times.

To override it in a new class, give register-type #:vfuncs `((set-surrounding . ,procedure)). The procedure is called as (procedure self text len cursor-index).

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

text

Passed: a string.

text surrounding the insertion point, as UTF-8. the preedit string should not be included within text

len

Passed: a 32-bit integer.

the length of text, or -1 if text is nul-terminated

cursor-index

Passed: a 32-bit integer.

the byte index of the insertion cursor within text.

Virtual method: imcontext:do-set-surrounding-with-selection implementor self text len cursor-index anchor-index

Sets surrounding context around the insertion point and preedit string. This function is expected to be called in response to the "retrieve_surrounding" signal, and will likely have no effect if called at other times.

To override it in a new class, give register-type #:vfuncs `((set-surrounding-with-selection . ,procedure)). The procedure is called as (procedure self text len cursor-index anchor-index).

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

text

Passed: a string.

text surrounding the insertion point, as UTF-8. the preedit string should not be included within text

len

Passed: a 32-bit integer.

the length of text, or -1 if text is nul-terminated

cursor-index

Passed: a 32-bit integer.

the byte index of the insertion cursor within text

anchor-index

Passed: a 32-bit integer.

the byte index of the selection bound within text

Virtual method: imcontext:do-set-use-preedit implementor self use-preedit

Sets whether the IM context should use the preedit string to display feedback.

If use-preedit is #f (default is #t), then the IM context may use some other method to display feedback, such as displaying it in a child of the root window.

To override it in a new class, give register-type #:vfuncs `((set-use-preedit . ,procedure)). The procedure is called as (procedure self use-preedit).

implementor

Passed: the class whose implementation to call: <GtkIMContext>, or a class that derives from it, or its GType number.

self

Passed: a <GtkIMContext>.

a <GtkIMContext>

use-preedit

Passed: a boolean.

whether the IM context should use the preedit string.