River libinput configuration
该协议暴露了 libinput 设备配置 API。有关 libinput 的 行为详细信息,应参考 libinput 文档。
设计此协议的目的是为了(希望)任何向后兼容的 libinput API 更改都可以与本协议的向后兼容更改相匹配。
注意:libinput API 使用浮点类型(C 语言中的 float 和 double), Wayland 协议目前(尚未?)原生支持这些类型。但是, Wayland 协议支持通过数组(array)参数类型发送任意字节。 该协议使用例如 type="array" summary="double" 来 表示原生字节序的 IEEE-754 64 位 double 值。
本文档中的关键字“must”、“must not”、“required”、“shall”、“shall not”、 “should”、“should not”、“recommended”、“may”和“optional”应按 IETF RFC 2119 中描述的方式解释。
用于配置 libinput 设备的全局接口。仅当同时也广播了 river_input_manager_v1 时,才应广播此全局对象。
stop()
此请求表明客户端不愿再在此对象上 接收事件。
Wayland 协议是异步的,这意味着在处理完 stop 请求之前, 服务端可能会继续发送事件。客户端必须等待 river_libinput_config_v1.finished 事件才能销毁 该对象。
destroy()
在接收到 finished 事件后应调用此请求 以完成对象的销毁。
在接收到 finished 事件之前发出此请求属于协议错误。
如果客户端希望销毁此对象,它应发送 river_libinput_config_v1.stop 请求并等待 river_libinput_config_v1.finished 事件。一旦接收到 finished 事件, 即可安全销毁此对象以及通过此接口创建的任何其他对象。
create_accel_config(id: new_id<river_libinput_accel_config_v1>, profile: uint<river_libinput_device_v1.accel_profile>)
参数 | 类型 | 描述 |
|---|---|---|
| id | new_id<river_libinput_accel_config_v1> | |
| profile | uint<river_libinput_device_v1.accel_profile> |
创建可通过 river_libinput_device_v1.apply_accel_config 应用的加速配置。
finished()
此事件表明服务端将不再在此对象上发送进一步的事件。 客户端应销毁该对象。详情请参阅 river_libinput_config_v1.destroy。
libinput_device(id: new_id<river_libinput_device_v1>)
参数 | 类型 | 描述 |
|---|---|---|
| id | new_id<river_libinput_device_v1> |
已创建新的 libinput 设备。并非每个 river_input_device_v1 都必定是 libinput 设备。
error { invalid_arg, invalid_destroy }
参数 | 值 | 描述 |
|---|---|---|
| invalid_arg | 0 | 无效的枚举值或类似参数 |
| invalid_destroy | 1 |
通常,*_support 事件将在 river_libinput_device_v1 创建后立即发送一次。如果支持该配置选项,*_default 事件将在 *_support 事件之后发送,*_current 事件将在 *_default 事件之后发送,并在配置选项更改时再次发送。
destroy()
此请求表明客户端将不再使用该输入 设备对象,可以安全地销毁它。
set_send_events(result: new_id<river_libinput_result_v1>, mode: uint<river_libinput_device_v1.send_events_modes>)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| mode | uint<river_libinput_device_v1.send_events_modes> |
设置设备的发送事件模式。
set_tap(result: new_id<river_libinput_result_v1>, state: uint<river_libinput_device_v1.tap_state>)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| state | uint<river_libinput_device_v1.tap_state> |
在该设备上配置轻触点击,默认将 1、2、3 指轻触分别映射为左键、右键和中键点击。
set_tap_button_map(result: new_id<river_libinput_result_v1>, button_map: uint<river_libinput_device_v1.tap_button_map>)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| button_map | uint<river_libinput_device_v1.tap_button_map> |
设置轻触点击的手指数量到按钮编号的映射。 大多数设备上的默认映射是将 1、2 和 3 指轻触 分别映射为左、右和中键。
set_drag(result: new_id<river_libinput_result_v1>, state: uint<river_libinput_device_v1.drag_state>)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| state | uint<river_libinput_device_v1.drag_state> |
在设备上配置轻触拖拽功能。
set_drag_lock(result: new_id<river_libinput_result_v1>, state: uint<river_libinput_device_v1.drag_lock_state>)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| state | uint<river_libinput_device_v1.drag_lock_state> |
配置设备上的轻触期间拖拽锁定。启用时, 手指可以抬起并放回触摸板上以继续拖拽过程。 抬起手指的超时可选。禁用时, 在轻触拖拽期间抬起手指会立即停止拖拽。 详情请参阅 libinput 文档。
set_three_finger_drag(result: new_id<river_libinput_result_v1>, state: uint<river_libinput_device_v1.three_finger_drag_state>)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| state | uint<river_libinput_device_v1.three_finger_drag_state> |
为设备配置三指拖拽功能。
set_calibration_matrix(result: new_id<river_libinput_result_v1>, matrix: array)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| matrix | array | array of 6 floats |
设置校准矩阵。
set_accel_profile(result: new_id<river_libinput_result_v1>, profile: uint<river_libinput_device_v1.accel_profile>)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| profile | uint<river_libinput_device_v1.accel_profile> |
设置加速配置文件。
set_accel_speed(result: new_id<river_libinput_result_v1>, speed: array)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| speed | array | double |
在 [-1, 1] 范围内设置加速速度,其中 0 是 此设备的默认加速,-1 是最慢的加速, 而 1 是此设备上可用的最大加速。
apply_accel_config(result: new_id<river_libinput_result_v1>, config: object<river_libinput_accel_config_v1>)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| config | object<river_libinput_accel_config_v1> |
应用指针加速配置。
set_natural_scroll(result: new_id<river_libinput_result_v1>, state: uint<river_libinput_device_v1.natural_scroll_state>)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| state | uint<river_libinput_device_v1.natural_scroll_state> |
设置自然滚动状态。
set_left_handed(result: new_id<river_libinput_result_v1>, state: uint<river_libinput_device_v1.left_handed_state>)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| state | uint<river_libinput_device_v1.left_handed_state> |
设置左手模式状态。
set_click_method(result: new_id<river_libinput_result_v1>, method: uint<river_libinput_device_v1.click_method>)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| method | uint<river_libinput_device_v1.click_method> |
设置点击方法。
set_clickfinger_button_map(result: new_id<river_libinput_result_v1>, button_map: uint<river_libinput_device_v1.clickfinger_button_map>)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| button_map | uint<river_libinput_device_v1.clickfinger_button_map> |
设置 clickfinger 按钮映射。 如果支持 click_methods.clickfinger 则受支持。
set_middle_emulation(result: new_id<river_libinput_result_v1>, state: uint<river_libinput_device_v1.middle_emulation_state>)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| state | uint<river_libinput_device_v1.middle_emulation_state> |
设置中键模拟状态。
set_scroll_method(result: new_id<river_libinput_result_v1>, method: uint<river_libinput_device_v1.scroll_method>)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| method | uint<river_libinput_device_v1.scroll_method> |
设置滚动方法。
set_scroll_button(result: new_id<river_libinput_result_v1>, button: uint)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| button | uint |
设置滚动按钮。 如果支持 scroll_methods.on_button_down 则受支持。
set_scroll_button_lock(result: new_id<river_libinput_result_v1>, state: uint<river_libinput_device_v1.scroll_button_lock_state>)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| state | uint<river_libinput_device_v1.scroll_button_lock_state> |
设置滚动按钮锁定状态。 如果支持 scroll_methods.on_button_down 则受支持。
set_dwt(result: new_id<river_libinput_result_v1>, state: uint<river_libinput_device_v1.dwt_state>)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| state | uint<river_libinput_device_v1.dwt_state> |
设置打字时禁用状态。
set_dwtp(result: new_id<river_libinput_result_v1>, state: uint<river_libinput_device_v1.dwtp_state>)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| state | uint<river_libinput_device_v1.dwtp_state> |
设置使用指点杆时禁用状态。
set_rotation(result: new_id<river_libinput_result_v1>, angle: uint)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| angle | uint |
设置偏离逻辑中性位置的顺时针旋转角度(度)。 角度必须在 [0-360) 范围内。
removed()
此事件表示 libinput 设备已被移除。
服务端将不再在此对象上发送进一步的事件,并忽略在发送此事件后 发出的任何请求(river_libinput_device_v1.destroy 除外)。 客户端应使用 river_libinput_device_v1.destroy 请求销毁此对象以释放资源。
input_device(device: object<river_input_device_v1>)
参数 | 类型 | 描述 |
|---|---|---|
| device | object<river_input_device_v1> |
对应此 libinput 设备的 river_input_device_v1。 此事件将始终是 river_libinput_device_v1 对象上 发送的第一个事件,并且只发送一次。
send_events_support(modes: uint<river_libinput_device_v1.send_events_modes>)
参数 | 类型 | 描述 |
|---|---|---|
| modes | uint<river_libinput_device_v1.send_events_modes> |
支持的发送事件模式。
send_events_default(mode: uint<river_libinput_device_v1.send_events_modes>)
参数 | 类型 | 描述 |
|---|---|---|
| mode | uint<river_libinput_device_v1.send_events_modes> |
默认发送事件模式。
send_events_current(mode: uint<river_libinput_device_v1.send_events_modes>)
参数 | 类型 | 描述 |
|---|---|---|
| mode | uint<river_libinput_device_v1.send_events_modes> |
当前发送事件模式。
tap_support(finger_count: int)
参数 | 类型 | 描述 |
|---|---|---|
| finger_count | int |
支持轻触点击/拖拽的手指数量。 如果 finger_count 为 0,则不支持轻触点击和拖拽。
tap_default(state: uint<river_libinput_device_v1.tap_state>)
参数 | 类型 | 描述 |
|---|---|---|
| state | uint<river_libinput_device_v1.tap_state> |
默认轻触点击状态。
tap_current(state: uint<river_libinput_device_v1.tap_state>)
参数 | 类型 | 描述 |
|---|---|---|
| state | uint<river_libinput_device_v1.tap_state> |
当前轻触点击状态。
tap_button_map_default(button_map: uint<river_libinput_device_v1.tap_button_map>)
默认轻触点击按钮映射。
tap_button_map_current(button_map: uint<river_libinput_device_v1.tap_button_map>)
当前轻触点击按钮映射。
drag_default(state: uint<river_libinput_device_v1.drag_state>)
参数 | 类型 | 描述 |
|---|---|---|
| state | uint<river_libinput_device_v1.drag_state> |
默认轻触拖拽状态。
drag_current(state: uint<river_libinput_device_v1.drag_state>)
参数 | 类型 | 描述 |
|---|---|---|
| state | uint<river_libinput_device_v1.drag_state> |
当前轻触拖拽状态。
drag_lock_default(state: uint<river_libinput_device_v1.drag_lock_state>)
参数 | 类型 | 描述 |
|---|---|---|
| state | uint<river_libinput_device_v1.drag_lock_state> |
默认拖拽锁定状态。
drag_lock_current(state: uint<river_libinput_device_v1.drag_lock_state>)
参数 | 类型 | 描述 |
|---|---|---|
| state | uint<river_libinput_device_v1.drag_lock_state> |
当前拖拽锁定状态。
three_finger_drag_support(finger_count: int)
参数 | 类型 | 描述 |
|---|---|---|
| finger_count | int |
支持三/四指拖拽的手指数量。 如果 finger_count 小于 3,则不支持三指拖拽。
three_finger_drag_default(state: uint<river_libinput_device_v1.three_finger_drag_state>)
默认三指拖拽状态。
three_finger_drag_current(state: uint<river_libinput_device_v1.three_finger_drag_state>)
当前三指拖拽状态。
accel_profiles_support(profiles: uint<river_libinput_device_v1.accel_profiles>)
参数 | 类型 | 描述 |
|---|---|---|
| profiles | uint<river_libinput_device_v1.accel_profiles> |
支持的加速配置文件。
accel_profile_default(profile: uint<river_libinput_device_v1.accel_profile>)
参数 | 类型 | 描述 |
|---|---|---|
| profile | uint<river_libinput_device_v1.accel_profile> |
默认加速配置文件。
accel_profile_current(profile: uint<river_libinput_device_v1.accel_profile>)
参数 | 类型 | 描述 |
|---|---|---|
| profile | uint<river_libinput_device_v1.accel_profile> |
当前加速配置文件。
natural_scroll_default(state: uint<river_libinput_device_v1.natural_scroll_state>)
默认自然滚动。
natural_scroll_current(state: uint<river_libinput_device_v1.natural_scroll_state>)
当前自然滚动。
left_handed_default(state: uint<river_libinput_device_v1.left_handed_state>)
参数 | 类型 | 描述 |
|---|---|---|
| state | uint<river_libinput_device_v1.left_handed_state> |
默认左手模式。
left_handed_current(state: uint<river_libinput_device_v1.left_handed_state>)
参数 | 类型 | 描述 |
|---|---|---|
| state | uint<river_libinput_device_v1.left_handed_state> |
当前左手模式。
click_method_support(methods: uint<river_libinput_device_v1.click_methods>)
参数 | 类型 | 描述 |
|---|---|---|
| methods | uint<river_libinput_device_v1.click_methods> |
设备支持的点击方法。
click_method_default(method: uint<river_libinput_device_v1.click_method>)
参数 | 类型 | 描述 |
|---|---|---|
| method | uint<river_libinput_device_v1.click_method> |
默认点击方法。
click_method_current(method: uint<river_libinput_device_v1.click_method>)
参数 | 类型 | 描述 |
|---|---|---|
| method | uint<river_libinput_device_v1.click_method> |
当前点击方法。
clickfinger_button_map_default(button_map: uint<river_libinput_device_v1.clickfinger_button_map>)
默认 clickfinger 按钮映射。 如果支持 click_methods.clickfinger 则受支持。
clickfinger_button_map_current(button_map: uint<river_libinput_device_v1.clickfinger_button_map>)
当前 clickfinger 按钮映射。 如果支持 click_methods.clickfinger 则受支持。
middle_emulation_default(state: uint<river_libinput_device_v1.middle_emulation_state>)
默认中键模拟。
middle_emulation_current(state: uint<river_libinput_device_v1.middle_emulation_state>)
当前中键模拟。
scroll_method_support(methods: uint<river_libinput_device_v1.scroll_methods>)
参数 | 类型 | 描述 |
|---|---|---|
| methods | uint<river_libinput_device_v1.scroll_methods> |
设备支持的滚动方法。
scroll_method_default(method: uint<river_libinput_device_v1.scroll_method>)
参数 | 类型 | 描述 |
|---|---|---|
| method | uint<river_libinput_device_v1.scroll_method> |
默认滚动方法。
scroll_method_current(method: uint<river_libinput_device_v1.scroll_method>)
参数 | 类型 | 描述 |
|---|---|---|
| method | uint<river_libinput_device_v1.scroll_method> |
当前滚动方法。
scroll_button_default(button: uint)
参数 | 类型 | 描述 |
|---|---|---|
| button | uint |
默认滚动按钮。 如果支持 scroll_methods.on_button_down 则受支持。
scroll_button_current(button: uint)
参数 | 类型 | 描述 |
|---|---|---|
| button | uint |
当前滚动按钮。 如果支持 scroll_methods.on_button_down 则受支持。
scroll_button_lock_default(state: uint<river_libinput_device_v1.scroll_button_lock_state>)
默认滚动按钮锁定状态。 如果支持 scroll_methods.on_button_down 则受支持。
scroll_button_lock_current(state: uint<river_libinput_device_v1.scroll_button_lock_state>)
当前滚动按钮锁定状态。 如果支持 scroll_methods.on_button_down 则受支持。
dwt_default(state: uint<river_libinput_device_v1.dwt_state>)
参数 | 类型 | 描述 |
|---|---|---|
| state | uint<river_libinput_device_v1.dwt_state> |
默认打字时禁用状态。
dwt_current(state: uint<river_libinput_device_v1.dwt_state>)
参数 | 类型 | 描述 |
|---|---|---|
| state | uint<river_libinput_device_v1.dwt_state> |
当前打字时禁用状态。
dwtp_default(state: uint<river_libinput_device_v1.dwtp_state>)
参数 | 类型 | 描述 |
|---|---|---|
| state | uint<river_libinput_device_v1.dwtp_state> |
默认使用指点杆时禁用状态。
dwtp_current(state: uint<river_libinput_device_v1.dwtp_state>)
参数 | 类型 | 描述 |
|---|---|---|
| state | uint<river_libinput_device_v1.dwtp_state> |
当前使用指点杆时禁用状态。
send_events_modes { enabled, disabled, disabled_on_external_mouse }
drag_lock_state { disabled, enabled_timeout, enabled_sticky }
three_finger_drag_state { disabled, enabled_3fg, enabled_4fg }
参数 | 值 | 描述 |
|---|---|---|
| disabled | 0 | |
| enabled_3fg | 1 | |
| enabled_4fg | 2 |
click_method { none, button_areas, clickfinger }
参数 | 值 | 描述 |
|---|---|---|
| none | 0 | |
| button_areas | 1 | |
| clickfinger | 2 |
click_methods { none, button_areas, clickfinger }
参数 | 值 | 描述 |
|---|---|---|
| none | 0 | |
| button_areas | 1 | |
| clickfinger | 2 |
scroll_method { no_scroll, two_finger, edge, on_button_down }
scroll_methods { no_scroll, two_finger, edge, on_button_down }
libinput 设置设备配置时返回的结果。
destroy()
此请求表明客户端将不再使用 accel 配置对象,可以安全地销毁它。
set_points(result: new_id<river_libinput_result_v1>, type: uint<river_libinput_accel_config_v1.accel_type>, step: array, points: array)
参数 | 类型 | 描述 |
|---|---|---|
| result | new_id<river_libinput_result_v1> | |
| type | uint<river_libinput_accel_config_v1.accel_type> | |
| step | array | double |
| points | array | array of doubles |
定义使用自定义加速配置文件的加速配置中 给定移动类型的加速函数。
libinput 设置设备配置时返回的结果。
合成器支持
Copyright
SPDX-FileCopyrightText: © 2025 Isaac Freund SPDX-License-Identifier: MIT
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 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.