Rename unixes to posix (#197)

* Rename `unix`es to `posix`

* Whoops

* deprecate get_unix_menus in favor of get_posix_menus

* doc fixes
This commit is contained in:
LoganDark 2020-07-09 01:21:18 -07:00 committed by GitHub
parent c5ee83af72
commit d0d3ffcf7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 28 additions and 17 deletions

View file

@ -24,7 +24,7 @@ fn main() {
} else if !env.contains("windows") {
// build scalar on non-windows and non-mac
cc::Build::new()
.file("src/native/unix/scalar.cpp")
.file("src/native/posix/scalar.cpp")
.opt_level(3) // always build with opts for scaler so it's fast in debug also
.compile("libscalar.a")
}

View file

@ -66,7 +66,7 @@ fn main() {
let menu_handle = window.add_menu(&menu);
window.get_unix_menus().map(|menus| {
window.get_posix_menus().map(|menus| {
println!("Menus {:?}", menus);
});

View file

@ -113,7 +113,7 @@ use self::os::redox as imp;
target_os = "netbsd",
target_os = "openbsd"
))]
use self::os::unix as imp;
use self::os::posix as imp;
#[cfg(target_os = "windows")]
use self::os::windows as imp;
///
@ -704,7 +704,7 @@ impl Window {
/// on which window you have active.
/// Linux/BSD/etc:
/// Menus aren't supported as they depend on each WindowManager and is outside of the
/// scope for this library to support. Use [get_unix_menus] to get a structure
/// scope for this library to support. Use [get_posix_menus] to get a structure
/// ```
///
#[inline]
@ -721,11 +721,11 @@ impl Window {
}
///
/// Get Unix menu. Will only return menus on Unix class OSes
/// Get POSIX menus. Will only return menus on POSIX-like OSes like Linux or BSD
/// otherwise ```None```
///
#[cfg(any(target_os = "macos", target_os = "windows"))]
pub fn get_unix_menus(&self) -> Option<&Vec<UnixMenu>> {
pub fn get_posix_menus(&self) -> Option<&Vec<UnixMenu>> {
None
}
@ -737,8 +737,16 @@ impl Window {
target_os = "openbsd",
target_os = "redox"
))]
pub fn get_posix_menus(&self) -> Option<&Vec<UnixMenu>> {
self.0.get_posix_menus()
}
#[deprecated(
since = "0.17.0",
note = "`get_unix_menus` will be removed in 1.0.0, use `get_posix_menus` instead"
)]
pub fn get_unix_menus(&self) -> Option<&Vec<UnixMenu>> {
self.0.get_unix_menus()
self.get_posix_menus()
}
///
@ -764,8 +772,11 @@ pub const MENU_KEY_ALT: usize = 16;
const MENU_ID_SEPARATOR: usize = 0xffffffff;
///
/// Used on Unix (Linux, FreeBSD, etc) as menus aren't supported in a native where there.
/// This structure can be used by calling [#get_unix_menus] on Window.
/// Used on POSIX systems (Linux, FreeBSD, etc) as menus aren't supported in a native way there.
/// This structure can be used by calling [#get_posix_menus] on Window.
///
/// In version 1.0.0, this struct will be renamed to PosixMenu, but it remains UnixMenu for backwards compatibility
/// reasons.
///
#[derive(Debug, Clone)]
pub struct UnixMenu {
@ -780,7 +791,7 @@ pub struct UnixMenu {
}
///
/// Used for on Unix (Linux, FreeBSD, etc) as menus aren't supported in a native where there.
/// Used on POSIX systems (Linux, FreeBSD, etc) as menus aren't supported in a native way there.
/// This structure holds info for each item in a #UnixMenu
///
#[derive(Debug, Clone)]

View file

@ -9,6 +9,6 @@ pub mod redox;
target_os = "netbsd",
target_os = "openbsd"
))]
pub mod unix;
pub mod posix;
#[cfg(target_os = "windows")]
pub mod windows;

View file

@ -309,12 +309,12 @@ impl Window {
}
}
pub fn get_unix_menus(&self) -> Option<&Vec<UnixMenu>> {
pub fn get_posix_menus(&self) -> Option<&Vec<UnixMenu>> {
match *self {
#[cfg(feature = "x11")]
Window::X11(ref w) => w.get_unix_menus(),
Window::X11(ref w) => w.get_posix_menus(),
#[cfg(feature = "wayland")]
Window::Wayland(ref w) => w.get_unix_menus(),
Window::Wayland(ref w) => w.get_posix_menus(),
}
}

View file

@ -694,7 +694,7 @@ impl Window {
handle
}
pub fn get_unix_menus(&self) -> Option<&Vec<UnixMenu>> {
pub fn get_posix_menus(&self) -> Option<&Vec<UnixMenu>> {
//FIXME
unimplemented!()
}

View file

@ -775,7 +775,7 @@ impl Window {
handle
}
pub fn get_unix_menus(&self) -> Option<&Vec<UnixMenu>> {
pub fn get_posix_menus(&self) -> Option<&Vec<UnixMenu>> {
Some(&self.menus)
}

View file

@ -393,7 +393,7 @@ impl Window {
handle
}
pub fn get_unix_menus(&self) -> Option<&Vec<UnixMenu>> {
pub fn get_posix_menus(&self) -> Option<&Vec<UnixMenu>> {
Some(&self.menus)
}