Hyprland focus grab
此协议允许客户端将输入焦点限制在一组特定的 surface 上,并在限制器被移除时接收通知。
此接口允许客户端创建 surface 抓取对象。
create_grab(grab: new_id<hyprland_focus_grab_v1>)
参数 | 类型 | 描述 |
|---|---|---|
| grab | new_id<hyprland_focus_grab_v1> |
创建一个 surface 抓取对象。
此接口将输入焦点限制在指定的 surface 白名单中,只要焦点抓取对象存在且至少有一个已提交的 surface。
白名单内 surface 的鼠标和触摸事件将正常传递给该 surface,而白名单外的事件将清除抓取对象。键盘事件将传递给客户端,如果白名单中的 surface 尚未获得焦点,合成器选择的白名单中的 surface 将接收 wl_keyboard::enter 事件。
当满足实现定义的条件(通常意味着在所有白名单 surface 之外发生鼠标或触摸输入)时,合成器将清除白名单,使抓取失效并发送 cleared 事件。如果合成器酌情启动了另一个焦点抓取或类似操作,也会发生同样的情况。
add_surface(surface: object<wl_surface>)
参数 | 类型 | 描述 |
|---|---|---|
| surface | object<wl_surface> |
将 surface 添加到白名单。销毁 surface 等同于显式调用 remove_surface,重复添加将被忽略。
在调用 commit 之前不会生效。
remove_surface(surface: object<wl_surface>)
参数 | 类型 | 描述 |
|---|---|---|
| surface | object<wl_surface> |
从白名单中移除 surface。销毁 surface 等同于显式调用此函数。
如果抓取处于活动状态且被移除的 surface 已获得键盘焦点,另一个 surface 将在提交时获得焦点。
在调用 commit 之前不会生效。
commit()
提交对 surface 白名单的待处理更改。
如果列表之前没有条目现在至少有一个,抓取将启动。如果之前有条目现在没有,抓取将变为失效状态。
合成器支持
Cage | COSMIC | GameScope | Hyprland | Jay | KWin | Labwc | Louvre | Mir | Muffin | Mutter | niri | phoc | river | Sway | Treeland | Wayfire | Weston | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| hyprland_focus_grab_manager_v1 | x | x | x | 1 | x | x | x | x | x | x | x | x | x | x | x | x | x | x |
Copyright
Copyright © 2024 outfoxxed All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.