Skip to content

Commit bf5952c

Browse files
committed
feat: wlroots support Win32 VK keycodes
1 parent 05e453b commit bf5952c

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

maa-framework/src/controller.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,23 @@ impl Controller {
200200
/// # Arguments
201201
/// * `wlr_socket_path` - Wayland socket path
202202
pub fn new_wlroots(wlr_socket_path: &str) -> MaaResult<Self> {
203+
Self::new_wlroots_with_vk_code(wlr_socket_path, false)
204+
}
205+
206+
/// Create a new WlRoots controller for apps running in wlroots compositor on Linux.
207+
///
208+
/// # Arguments
209+
/// * `wlr_socket_path` - Wayland socket path
210+
/// * `use_win32_vk_code` - Interpret key codes as Win32 Virtual-Key codes and translate
211+
/// them to Linux evdev codes internally when set to `true`
212+
pub fn new_wlroots_with_vk_code(
213+
wlr_socket_path: &str,
214+
use_win32_vk_code: bool,
215+
) -> MaaResult<Self> {
203216
let c_path = CString::new(wlr_socket_path)?;
204-
let handle = unsafe { sys::MaaWlRootsControllerCreate(c_path.as_ptr()) };
217+
let handle = unsafe {
218+
sys::MaaWlRootsControllerCreate(c_path.as_ptr(), use_win32_vk_code as sys::MaaBool)
219+
};
205220

206221
Self::from_handle(handle)
207222
}

0 commit comments

Comments
 (0)