KWin::InputMethod Class
Provides integration for input methods. More...
| Header: | #include <inputmethod.h> |
| CMake: | find_package(KWin REQUIRED)target_link_libraries(mytarget PRIVATE KWin::kwin) |
Public Types
| enum class | VirtualKeyboardVisibility { Never, NonMouseInput, AnyInput } |
Public Functions
| bool | activeClientSupportsTextInput() const |
| KWin::Window * | activeWindow() const |
| void | commitPendingText() |
| KWin::RectF | cursorRectangle() const |
| void | forceActivate() |
| void | forwardModifiers(KWin::InputMethod::ForwardModifiersForce force) |
| void | hide() |
| bool | isActive() const |
| bool | isAvailable() const |
| bool | isEnabled() const |
| bool | isVisible() const |
| KWin::InputMethodGrabV1 * | keyboardGrab() |
| KWin::InputPanelV1Window * | panel() const |
| void | setActive(bool active) |
| void | setInputMethodCommand(const QString &path) |
| void | setPanel(KWin::InputPanelV1Window *panel) |
| bool | shouldShowOnActive() const |
| void | show() |
Signals
| void | activeChanged(bool active) |
| void | activeClientSupportsTextInputChanged() |
| void | activeWindowChanged() |
| void | availableChanged() |
| void | cursorRectangleChanged() |
| void | modeChanged(KWin::InputMethod::VirtualKeyboardVisibility mode) |
| void | panelChanged() |
| void | visibleChanged() |
Detailed Description
Manages the compositor-side integration for zwp_input_method_unstable_v1, enabling an input method to be used for text input in KWin, as well as the ability to display an on-screen keyboard and overlay panels.
Member Type Documentation
enum class InputMethod::VirtualKeyboardVisibility
The visibility mode of the on-screen keyboard.
| Constant | Value | Description |
|---|---|---|
KWin::InputMethod::VirtualKeyboardVisibility::Never | 0 | The on-screen keyboard is never shown automatically. |
KWin::InputMethod::VirtualKeyboardVisibility::NonMouseInput | 1 | The on-screen keyboard is shown automatically for non-mouse input devices (e.g., touch, stylus) when a text input field is focused. |
KWin::InputMethod::VirtualKeyboardVisibility::AnyInput | 2 | The on-screen keyboard is shown automatically when any input device (e.g., mouse, touch, stylus) focuses a text input field. |
Member Function Documentation
[signal] void InputMethod::activeChanged(bool active)
Emitted when the input method becomes active or inactive.
bool InputMethod::activeClientSupportsTextInput() const
Whether the currently focused client supports Wayland's text-input protocol (v2 or v3) and can receive text input from the input method.
[signal] void InputMethod::activeClientSupportsTextInputChanged()
Emitted when the state of whether the currently focused client supports text input changes.
KWin::Window *InputMethod::activeWindow() const
The window that is currently receiving input from the input method.
Returns nullptr if no window is currently connected to the input method.
[signal] void InputMethod::activeWindowChanged()
Emitted when the active window (which supports text input) changes.
[signal] void InputMethod::availableChanged()
Emitted when the configured input method changes.
void InputMethod::commitPendingText()
Commits any pending preedit text to the focused text input.
KWin::RectF InputMethod::cursorRectangle() const
The location of the text input cursor, in global coordinates.
[signal] void InputMethod::cursorRectangleChanged()
Emitted when the location of the text input cursor changes.
void InputMethod::forceActivate()
Request the input method to activate itself, even if the currently focused client does not support text input.
Does not guarantee that the input method will actually show itself.
void InputMethod::forwardModifiers(KWin::InputMethod::ForwardModifiersForce force)
Sync the keyboard modifiers state to the active input method keyboard grab, if any.
void InputMethod::hide()
Hides the on-screen keyboard and any overlay panels, if they are currently visible.
bool InputMethod::isActive() const
Considered active if the focused client has a Wayland text-input enabled and the input method is currently connected to it.
This does not necessarily mean that the on-screen keyboard is visible.
bool InputMethod::isAvailable() const
Whether an input method has been configured and is available for use.
bool InputMethod::isEnabled() const
The input method is considered enabled if the on-screen keyboard is configured to show automatically.
bool InputMethod::isVisible() const
Whether the on-screen keyboard is currently visible.
KWin::InputMethodGrabV1 *InputMethod::keyboardGrab()
Returns the currently installed keyboard grab, if any.
[signal] void InputMethod::modeChanged(KWin::InputMethod::VirtualKeyboardVisibility mode)
Emitted when the visibility InputMethod::mode of the on-screen keyboard changes.
KWin::InputPanelV1Window *InputMethod::panel() const
The window for the on-screen keyboard and overlay panels.
See also setPanel().
[signal] void InputMethod::panelChanged()
Emitted when the input method panel window has been added or replaced.
void InputMethod::setActive(bool active)
Instruct the input method to (de)activate itself for the currently focused client.
See also isActive().
void InputMethod::setInputMethodCommand(const QString &path)
Sets the command to launch the input method process.
If an input method process is already running, it will be terminated and the new command will be used to launch a new process.
void InputMethod::setPanel(KWin::InputPanelV1Window *panel)
Installs a new input method panel window, replacing any existing one.
See also panel().
bool InputMethod::shouldShowOnActive() const
Whether the on-screen keyboard should be shown automatically when a text input field is focused, based on the current visibility mode and the last input device used.
void InputMethod::show()
Show the on-screen keyboard (but only if the input method has something to display).
This method is more of a "you are allowed to show yourself" than a "please show yourself" request.
[signal] void InputMethod::visibleChanged()
Emitted when the on-screen keyboard is shown or hidden.