ime

package
v1.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ime connects a window system backend to an input method framework over D-Bus (IBus or Fcitx5): the same way for X11, and for Wayland on a compositor without text-input-v3 (SPEC §8.3, §8.6). The calls to the framework block, so they run on a goroutine of their own; what comes back is handed to the UI thread through a Poster.

Flutter: no counterpart

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bridge

type Bridge struct {
	// contains filtered or unexported fields
}

Bridge sends the state of the focused text field and the keys to the input method, and delivers the input method's changes to the handler. Every method but the ones of the worker belongs to the UI thread.

Flutter: no counterpart

func New

func New(poster Poster, open Opener, deliver func(ui.TextInputEvent)) *Bridge

New makes a bridge. open connects to the framework when it is first needed; deliver receives the changes of the input method on the UI thread.

Flutter: no counterpart

func (*Bridge) Active

func (b *Bridge) Active() bool

Active reports whether a text field has the focus and the input method may be there to see the keys. While it is, every key goes through ProcessKey, so that the keys keep their order.

Flutter: no counterpart

func (*Bridge) Close

func (b *Bridge) Close()

Close destroys the input context and stops the worker. Pending keys are answered as not consumed.

Flutter: no counterpart

func (*Bridge) ProcessKey

func (b *Bridge) ProcessKey(key dbus.IMEKey, done func(handled bool))

ProcessKey asks the input method whether it consumes the key. done runs on the UI thread, in the order of the calls, with true when the input method consumed it. It runs with false at once on the UI thread's next turn if there is no input method.

Flutter: no counterpart

func (*Bridge) SetState

func (b *Bridge) SetState(st ui.TextInputState, caret Rect)

SetState tells the input method about the focused text field: the field gets or loses the focus, and the text, the selection and the caret rectangle follow. caret is the rectangle of the caret in the pixels the input method expects.

Flutter: no counterpart

type Opener

type Opener func(ctx context.Context, events func(dbus.IMEEvent)) (dbus.InputMethod, error)

Opener connects to the input method framework. It is called once, on the goroutine of the bridge, when the first text field gets the focus. events receives the changes the input method asks for.

Flutter: no counterpart

type Poster

type Poster interface {
	// Post queues fn to run on the UI thread. It may be called from any
	// goroutine and does not block.
	Post(fn func())
}

Poster runs functions on the UI thread. linux.Loop is one.

Flutter: no counterpart

type Rect

type Rect struct{ X, Y, W, H int }

Rect is a rectangle in the pixels the input method expects: of the screen on X11, of the surface on Wayland.

Flutter: no counterpart

Directories

Path Synopsis
Package imetest has test doubles for the input method of the Linux backends: an input method that records its calls, and a poster that lets the test run what the bridge hands to the UI thread.
Package imetest has test doubles for the input method of the Linux backends: an input method that records its calls, and a poster that lets the test run what the bridge hands to the UI thread.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL