Skip to content

Commit f604235

Browse files
committed
input: upgrade to libinput 1.30
1 parent b0e0047 commit f604235

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- **Breaking:** `Device::name`, `Device::output_name`, `Seat::physical_name` and `Seat::logical_name` now return Cow strings due to lossy conversion into UTF8
44
- **Breaking:** `Device::config_tap_default_drag_lock_enabled` and `Device::config_tap_set_drag_lock_enabled` now use `DragLockState` type rather than `bool`
5-
- Added support for libinput 1.23, 1.26, 1.27, 1.28, 1.29 features
5+
- Added support for libinput 1.23, 1.26, 1.27, 1.28, 1.29, 1.30 features
66

77
## 0.9.1
88

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ libinput_1_26 = ["input-sys/libinput_1_26", "libinput_1_23"]
4242
libinput_1_27 = ["input-sys/libinput_1_27", "libinput_1_26"]
4343
libinput_1_28 = ["input-sys/libinput_1_28", "libinput_1_27"]
4444
libinput_1_29 = ["input-sys/libinput_1_29", "libinput_1_28"]
45+
libinput_1_30 = ["input-sys/libinput_1_30", "libinput_1_29"]
4546

4647
[workspace]
4748
members = [
4849
"input-sys"
4950
]
5051

5152
[package.metadata.docs.rs]
52-
features = ["libinput_1_28"]
53+
features = ["libinput_1_30"]

src/context.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,45 @@ impl Libinput {
427427
}
428428
}
429429

430+
#[cfg(feature = "libinput_1_30")]
431+
bitflags::bitflags! {
432+
/// Flags used for [`Libinput::plugin_system_load_plugins`]
433+
#[doc(alias = "libinput_plugin_system_flags")]
434+
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
435+
pub struct PluginSystemFlags: u32 {}
436+
}
437+
438+
#[cfg(feature = "libinput_1_30")]
439+
impl Libinput {
440+
/// Add the default plugin lookup paths
441+
#[doc(alias = "libinput_plugin_system_append_default_paths")]
442+
pub fn plugin_system_append_default_paths(&self) {
443+
unsafe { ffi::libinput_plugin_system_append_default_paths(self.as_raw_mut()) };
444+
}
445+
446+
/// Appends the given directory path to the libinput plugin lookup path.
447+
/// If the path is already in the lookup paths, this function does nothing.
448+
#[doc(alias = "libinput_plugin_system_append_path")]
449+
pub fn plugin_system_append_path(&self, path: &str) {
450+
let path = CString::new(path).expect("Plugin path contained a null-byte");
451+
unsafe { ffi::libinput_plugin_system_append_path(self.as_raw_mut(), path.as_ptr()) };
452+
}
453+
454+
/// Load the plugins from the set of lookup paths.
455+
/// This function does nothing if no plugin paths have been configured,
456+
/// see [`Self::plugin_system_append_default_paths`] and [`Self::plugin_system_append_path`]
457+
#[doc(alias = "libinput_plugin_system_load_plugins")]
458+
pub fn plugin_system_load_plugins(&self, flags: PluginSystemFlags) -> IoResult<()> {
459+
unsafe {
460+
match ffi::libinput_plugin_system_load_plugins(self.as_raw_mut(), flags.bits()) {
461+
0 => Ok(()),
462+
x if x < 0 => Err(IoError::from_raw_os_error(-x)),
463+
_ => unreachable!(),
464+
}
465+
}
466+
}
467+
}
468+
430469
impl AsRawFd for Libinput {
431470
fn as_raw_fd(&self) -> RawFd {
432471
unsafe { ffi::libinput_get_fd(self.as_raw_mut()) }

0 commit comments

Comments
 (0)