Virtual keyboard

虚拟键盘

虚拟键盘为应用程序提供了模拟物理键盘行为的请求。

此接口可由客户端单独使用以提供原始输入事件,也可配合输入法协议使用。

keymap(format: uint, fd: fd, size: uint)
参数
类型
描述
formatuint
keymap format
fdfd
keymap file descriptor
sizeuint
keymap size, in bytes
键盘映射

向 compositor 提供一个文件描述符,可通过内存映射来提供键盘映射描述。

format 取值来自 keymap_format 枚举。

key(time: uint, key: uint, state: uint)
参数
类型
描述
timeuint
timestamp with millisecond granularity
keyuint
key that produced the event
stateuint
physical state of the key
按键事件

按键被按下或释放。 time 参数是毫秒精度的时间戳,基准未定义。同一对象的所有请求必须使用相同的时钟。

发送此请求前必须先设置 keymap。

state 取值来自 key_state 枚举。

modifiers(mods_depressed: uint, mods_latched: uint, mods_locked: uint, group: uint)
参数
类型
描述
mods_depresseduint
depressed modifiers
mods_latcheduint
latched modifiers
mods_lockeduint
locked modifiers
groupuint
keyboard layout
修饰键和组状态

通知 compositor 修饰键和/或组状态已改变,应更新状态。

客户端应使用 wl_keyboard.modifiers 事件来同步其内部状态与 seat 状态。

发送此请求前必须先设置 keymap。

destroy
类型: destructor起始版本 1
destroy()
销毁虚拟键盘对象
error { no_keymap } 
参数
描述
no_keymap0
未设置 keymap

虚拟键盘管理器

虚拟键盘管理器允许应用程序提供键盘输入事件,如同来自物理键盘一样。

create_virtual_keyboard(seat: object<wl_seat>, id: new_id<zwp_virtual_keyboard_v1>)
参数
类型
描述
seatobject<wl_seat>
idnew_id<zwp_virtual_keyboard_v1>
创建新的虚拟键盘

创建一个与 seat 关联的新虚拟键盘。

如果 compositor 允许键盘执行任意操作,当不受信任的客户端请求新键盘时,应报错。

error { unauthorized } 
参数
描述
unauthorized0
客户端未被授权使用此接口

合成器支持

Cage
Cage
0.2.0
COSMIC
COSMIC
1.0.0~beta.8
GameScope
GameScope
3.15.14
Hyprland
Hyprland
0.52.1
Jay
1.12.0
KWin
KWin
6.6
Labwc
Labwc
0.9.2
Louvre
Louvre
2.14.1
Mir
Mir
2.26
Muffin
Muffin
6.6.0
Mutter
Mutter
49.2
niri
niri
25.11
phoc
phoc
0.52
river
river
0.3.13
Sway
Sway
1.11
Treeland
Treeland
0.8.0
Wayfire
Wayfire
0.9.0
Weston
Weston
14.0.2
zwp_virtual_keyboard_manager_v1
1
1
x
1
1
x
1
x
1
x
x
1
1
1
1
1
1
x

Copyright © 2008-2011 Kristian Høgsberg Copyright © 2010-2013 Intel Corporation Copyright © 2012-2013 Collabora, Ltd. Copyright © 2018 Purism SPC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Footer

© 2026 Wayland Explorer

本网站与 Wayland 官方项目无任何关联。网站所有内容均根据 Wayland 协议 XML 文件自动生成。

本网站使用的 Visual Studio Code - Codicons 遵循 CC BY 4.0 许可。