Skip to content

Commit

Permalink
Rename unixes to posix (#197)
Browse files Browse the repository at this point in the history
* Rename `unix`es to `posix`

* Whoops

* deprecate get_unix_menus in favor of get_posix_menus

* doc fixes
  • Loading branch information
LoganDark committed Jul 9, 2020
1 parent c5ee83a commit d0d3ffc
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion examples/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down
27 changes: 19 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
///
Expand Down Expand Up @@ -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]
Expand All @@ -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
}

Expand All @@ -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()
}

///
Expand All @@ -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 {
Expand All @@ -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)]
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/os/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
File renamed without changes.
6 changes: 3 additions & 3 deletions src/os/unix/mod.rs → src/os/posix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/os/unix/wayland.rs → src/os/posix/wayland.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!()
}
Expand Down
2 changes: 1 addition & 1 deletion src/os/unix/x11.rs → src/os/posix/x11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion src/os/redox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit d0d3ffc

Please sign in to comment.