Skip to content

Commit 9b771b8

Browse files
authored
Add support for other BSDs. (#157)
1 parent 474a7fb commit 9b771b8

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ core-foundation-sys = {version = "0.8"}
3232
dispatch = "0.2"
3333

3434

35-
[target.'cfg(target_os = "linux")'.dependencies]
35+
[target.'cfg(all(target_family = "unix", not(target_os = "macos")))'.dependencies]
3636
libc = "0.2"
3737
x11 = {version = "2.18", features = ["xlib", "xrecord", "xinput"], optional = true}
3838
evdev-rs = {version = "0.6", optional=true}

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,11 @@ use crate::macos::{display_size as _display_size, listen as _listen, simulate as
230230
#[cfg(target_os = "macos")]
231231
pub use crate::macos::{set_is_main_thread, Keyboard};
232232

233-
#[cfg(target_os = "linux")]
233+
#[cfg(all(target_family = "unix", not(target_os = "macos")))]
234234
mod linux;
235-
#[cfg(target_os = "linux")]
235+
#[cfg(all(target_family = "unix", not(target_os = "macos")))]
236236
pub use crate::linux::Keyboard;
237-
#[cfg(target_os = "linux")]
237+
#[cfg(all(target_family = "unix", not(target_os = "macos")))]
238238
use crate::linux::{display_size as _display_size, listen as _listen, simulate as _simulate};
239239

240240
#[cfg(target_os = "windows")]
@@ -323,7 +323,7 @@ pub fn display_size() -> Result<(u64, u64), DisplayError> {
323323
}
324324

325325
#[cfg(feature = "unstable_grab")]
326-
#[cfg(target_os = "linux")]
326+
#[cfg(all(target_family = "unix", not(target_os = "macos")))]
327327
pub use crate::linux::grab as _grab;
328328
#[cfg(feature = "unstable_grab")]
329329
#[cfg(target_os = "macos")]

src/linux/wayland/keyboard.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ use super::xkb_keycodes::internal_to_xkb_keycode;
33
use crate::rdev::{EventType, Key, KeyboardState};
44
use xkbcommon::xkb;
55

6+
#[allow(dead_code)]
7+
// TODO this does not handle keyboard mapping change
8+
// which is handled by the compositor and depend on window to window
69
pub struct Keyboard {
710
context: xkb::Context,
811
keymap: xkb::Keymap,

0 commit comments

Comments
 (0)