mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2024-12-23 19:31:30 +11:00
Rename unix
es 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:
parent
c5ee83af72
commit
d0d3ffcf7b
2
build.rs
2
build.rs
|
@ -24,7 +24,7 @@ fn main() {
|
||||||
} else if !env.contains("windows") {
|
} else if !env.contains("windows") {
|
||||||
// build scalar on non-windows and non-mac
|
// build scalar on non-windows and non-mac
|
||||||
cc::Build::new()
|
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
|
.opt_level(3) // always build with opts for scaler so it's fast in debug also
|
||||||
.compile("libscalar.a")
|
.compile("libscalar.a")
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ fn main() {
|
||||||
|
|
||||||
let menu_handle = window.add_menu(&menu);
|
let menu_handle = window.add_menu(&menu);
|
||||||
|
|
||||||
window.get_unix_menus().map(|menus| {
|
window.get_posix_menus().map(|menus| {
|
||||||
println!("Menus {:?}", menus);
|
println!("Menus {:?}", menus);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
27
src/lib.rs
27
src/lib.rs
|
@ -113,7 +113,7 @@ use self::os::redox as imp;
|
||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
target_os = "openbsd"
|
target_os = "openbsd"
|
||||||
))]
|
))]
|
||||||
use self::os::unix as imp;
|
use self::os::posix as imp;
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
use self::os::windows as imp;
|
use self::os::windows as imp;
|
||||||
///
|
///
|
||||||
|
@ -704,7 +704,7 @@ impl Window {
|
||||||
/// on which window you have active.
|
/// on which window you have active.
|
||||||
/// Linux/BSD/etc:
|
/// Linux/BSD/etc:
|
||||||
/// Menus aren't supported as they depend on each WindowManager and is outside of the
|
/// 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]
|
#[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```
|
/// otherwise ```None```
|
||||||
///
|
///
|
||||||
#[cfg(any(target_os = "macos", target_os = "windows"))]
|
#[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
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -737,8 +737,16 @@ impl Window {
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
target_os = "redox"
|
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>> {
|
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;
|
const MENU_ID_SEPARATOR: usize = 0xffffffff;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Used 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 can be used by calling [#get_unix_menus] on Window.
|
/// 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)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct UnixMenu {
|
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
|
/// This structure holds info for each item in a #UnixMenu
|
||||||
///
|
///
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
|
|
@ -9,6 +9,6 @@ pub mod redox;
|
||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
target_os = "openbsd"
|
target_os = "openbsd"
|
||||||
))]
|
))]
|
||||||
pub mod unix;
|
pub mod posix;
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
pub mod windows;
|
pub mod windows;
|
||||||
|
|
|
@ -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 {
|
match *self {
|
||||||
#[cfg(feature = "x11")]
|
#[cfg(feature = "x11")]
|
||||||
Window::X11(ref w) => w.get_unix_menus(),
|
Window::X11(ref w) => w.get_posix_menus(),
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
Window::Wayland(ref w) => w.get_unix_menus(),
|
Window::Wayland(ref w) => w.get_posix_menus(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -694,7 +694,7 @@ impl Window {
|
||||||
handle
|
handle
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_unix_menus(&self) -> Option<&Vec<UnixMenu>> {
|
pub fn get_posix_menus(&self) -> Option<&Vec<UnixMenu>> {
|
||||||
//FIXME
|
//FIXME
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
|
@ -775,7 +775,7 @@ impl Window {
|
||||||
handle
|
handle
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_unix_menus(&self) -> Option<&Vec<UnixMenu>> {
|
pub fn get_posix_menus(&self) -> Option<&Vec<UnixMenu>> {
|
||||||
Some(&self.menus)
|
Some(&self.menus)
|
||||||
}
|
}
|
||||||
|
|
|
@ -393,7 +393,7 @@ impl Window {
|
||||||
handle
|
handle
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_unix_menus(&self) -> Option<&Vec<UnixMenu>> {
|
pub fn get_posix_menus(&self) -> Option<&Vec<UnixMenu>> {
|
||||||
Some(&self.menus)
|
Some(&self.menus)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue