keyboard

package
v0.52.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectTextInputDoneMod

func DetectTextInputDoneMod(mods glfw.ModifierKey) bool

DetectTextInputDoneMod returns true if the modifiers pressed indicate the typed text can be committed

Types

type Event

type Event struct {
	// Common
	Keymap    string `json:"keymap"` // Linux/MacOS switch
	Character string `json:"character"`
	KeyCode   int    `json:"keyCode"`
	Modifiers int    `json:"modifiers"`
	Type      string `json:"type"`

	// Linux
	Toolkit             string `json:"toolkit,omitempty"`
	ScanCode            int    `json:"scanCode,omitempty"`
	UnicodeScalarValues uint32 `json:"unicodeScalarValues,omitempty"`

	// MacOS
	CharactersIgnoringModifiers string `json:"charactersIgnoringModifiers,omitempty"`
	Characters                  string `json:"characters,omitempty"`
}

Event corresponds to a Flutter (dart) compatible RawKeyEventData keyevent data. Multi-platform keycode translation is handled within this package.

As input, go-flutter gets GLFW-keyevent who are only compatible with RawKeyEventDataLinux. To fully support keyboard shortcut (like Command+C to copy on darwin), the flutter framework expect the sent keyevent data to be in the form of a RawKeyEventDataMacOs keyevent data. This package maps the GLFW key-codes to the MacOS ones.

On the flutter framework side:

RawKeyEventDataMacOs data is received for darwin
RawKeyEventDataLinux data is received for linux and windows

func Normalize

func Normalize(key glfw.Key, scancode int, mods glfw.ModifierKey, action glfw.Action) (event Event, err error)

Normalize takes a GLFW-based key and normalizes it by converting the input to a keyboard.Event struct compatible with Flutter for the current OS.

RawKeyEventDataMacOs data for darwin
RawKeyEventDataLinux data for linux and windows

Jump to

Keyboard shortcuts

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