XWayland keyboard grabbing
此协议是特定于应用程序的,旨在满足 X11 协议通过 Xwayland 的需求。它为 Xwayland 提供了一种方式,可以请求将所有键盘事件转发到一个 surface,即使该 surface 没有键盘焦点。
在 X11 协议中,客户端可以请求对键盘进行"活动抓取"。成功后,所有按键事件仅报告给正在抓取的 X11 客户端。有关详细信息,请参阅 XGrabKeyboard(3)。
核心 Wayland 协议没有活动键盘抓取的概念。当在 Xwayland 中运行时,X11 应用程序可以在 Xwayland 内部获取活动抓取,但这无法转换到 Wayland compositor,后者可能会将输入焦点设置到其他 surface。这样做会破坏 X11 客户端的假设,即所有按键事件都会报告给正在抓取的客户端。
此协议指定了一种方式,让 Xwayland 请求将所有键盘定向到给定的 surface。该协议不保证 compositor 会接受此请求,也不规定用户界面如何处理响应。例如,compositor 可以通知用户所有按键事件现在都转发到给定的客户端 surface,或者它可以请求用户许可。
compositor 必须将对此特定于应用程序的协议的访问限制为仅 Xwayland。
警告!此文件中描述的协议是实验性的,可能会进行向后不兼容的更改。向后兼容的更改可能会与相应的接口版本号提升一起添加。 向后不兼容的更改通过提升协议和接口名称中的版本号并重置接口版本来完成。一旦协议被声明为稳定,协议和接口名称中的 "z" 前缀和版本号将被移除,接口版本号将被重置。
用于抓取键盘的全局接口。
grab_keyboard(id: new_id<zwp_xwayland_keyboard_grab_v1>, surface: object<wl_surface>, seat: object<wl_seat>)
参数 | 类型 | 描述 |
|---|---|---|
| id | new_id<zwp_xwayland_keyboard_grab_v1> | |
| surface | object<wl_surface> | surface to report keyboard events to |
| seat | object<wl_seat> | the seat for which the keyboard should be grabbed |
grab_keyboard 请求请求抓取键盘,强制将给定 seat 的键盘焦点置于给定的 surface 上。
该协议不保证抓取一定会被满足,也不要求 compositor 在抓取永远无法满足时发送错误。因此,可能会请求一个永远不会生效的键盘抓取。
该协议:
用于抓取键盘的全局接口。
destroy()
销毁已抓取的键盘对象。如果适用,compositor 将取消键盘抓取。
合成器支持
Copyright
Copyright © 2017 Red Hat Inc.
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.