From 546f51a3974c15af0d6c84525d3c8e448911f8a8 Mon Sep 17 00:00:00 2001 From: "Ngo Iok Ui (Wu Yu Wei)" Date: Tue, 20 Jul 2021 20:52:12 +0800 Subject: [PATCH] Add flags to support other unix systems. (#142) --- .changes/unix-support.md | 6 ++++++ src/clipboard.rs | 8 +++++++- src/event.rs | 4 ++-- src/lib.rs | 10 +++++++++- 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 .changes/unix-support.md diff --git a/.changes/unix-support.md b/.changes/unix-support.md new file mode 100644 index 000000000..10fc74a10 --- /dev/null +++ b/.changes/unix-support.md @@ -0,0 +1,6 @@ +--- +"tao": patch +--- + +Add flags to support all other possible unix systems. + diff --git a/src/clipboard.rs b/src/clipboard.rs index 083a8044d..b33f25b80 100644 --- a/src/clipboard.rs +++ b/src/clipboard.rs @@ -65,7 +65,13 @@ impl ClipboardFormat { pub const TEXT: &'static str = "public.utf8-plain-text"; #[cfg(any(target_os = "windows", target_os = "android"))] pub const TEXT: &'static str = "text/plain"; - #[cfg(target_os = "linux")] + #[cfg(any( + target_os = "linux", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd" + ))] pub const TEXT: &'static str = "UTF8_STRING"; } diff --git a/src/event.rs b/src/event.rs index 32658344b..722e00286 100644 --- a/src/event.rs +++ b/src/event.rs @@ -774,7 +774,7 @@ pub struct KeyEvent { pub(crate) platform_specific: platform_impl::KeyEventExtra, } -#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))] +#[cfg(not(any(target_os = "android", target_os = "ios")))] impl KeyEvent { /// Identical to `KeyEvent::text` but this is affected by Ctrl. /// @@ -798,7 +798,7 @@ impl KeyEvent { } } -#[cfg(not(any(target_os = "windows", target_os = "linux", target_os = "macos")))] +#[cfg(any(target_os = "android", target_os = "ios"))] impl KeyEvent { /// Identical to `KeyEvent::text`. pub fn text_with_all_modifiers(&self) -> Option<&str> { diff --git a/src/lib.rs b/src/lib.rs index 938d2eb98..2e309b96b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -170,7 +170,15 @@ pub mod keyboard; pub mod menu; pub mod monitor; mod platform_impl; -#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))] +#[cfg(any( + target_os = "windows", + target_os = "macos", + target_os = "linux", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd" +))] #[cfg(feature = "tray")] pub mod system_tray; pub mod window;