fix(inject): export options fields and change macos default delay

This commit is contained in:
Federico Terzi 2021-05-08 14:02:30 +02:00
parent ca6d04cd0e
commit 4068f5ac66

View File

@ -50,12 +50,12 @@ pub trait Injector {
#[allow(dead_code)] #[allow(dead_code)]
pub struct InjectionOptions { pub struct InjectionOptions {
// Delay between injected events // Delay between injected events
delay: i32, pub delay: i32,
// Use original libxdo methods instead of patched version // Use original libxdo methods instead of patched version
// using XSendEvent rather than XTestFakeKeyEvent // using XSendEvent rather than XTestFakeKeyEvent
// NOTE: Only relevant on X11 linux systems. // NOTE: Only relevant on X11 linux systems.
disable_fast_inject: bool, pub disable_fast_inject: bool,
} }
impl Default for InjectionOptions { impl Default for InjectionOptions {
@ -63,7 +63,7 @@ impl Default for InjectionOptions {
let default_delay = if cfg!(target_os = "windows") { let default_delay = if cfg!(target_os = "windows") {
0 0
} else if cfg!(target_os = "macos") { } else if cfg!(target_os = "macos") {
2 1
} else if cfg!(target_os = "linux") { } else if cfg!(target_os = "linux") {
if cfg!(feature = "wayland") { if cfg!(feature = "wayland") {
1 1
@ -84,19 +84,19 @@ impl Default for InjectionOptions {
#[allow(dead_code)] #[allow(dead_code)]
pub struct InjectorCreationOptions { pub struct InjectorCreationOptions {
// Only relevant in X11 Linux systems, use the EVDEV backend instead of X11. // Only relevant in X11 Linux systems, use the EVDEV backend instead of X11.
use_evdev: bool, pub use_evdev: bool,
// Overwrite the list of modifiers to be scanned when // Overwrite the list of modifiers to be scanned when
// populating the evdev injector lookup maps // populating the evdev injector lookup maps
evdev_modifiers: Option<Vec<u32>>, pub evdev_modifiers: Option<Vec<u32>>,
// Overwrite the maximum number of modifiers used tested in // Overwrite the maximum number of modifiers used tested in
// a single combination to populate the lookup maps // a single combination to populate the lookup maps
evdev_max_modifier_combination_len: Option<i32>, pub evdev_max_modifier_combination_len: Option<i32>,
// Can be used to overwrite the keymap configuration // Can be used to overwrite the keymap configuration
// used by espanso to inject key presses. // used by espanso to inject key presses.
evdev_keyboard_rmlvo: Option<KeyboardConfig>, pub evdev_keyboard_rmlvo: Option<KeyboardConfig>,
} }
// This struct identifies the keyboard layout that // This struct identifies the keyboard layout that