Use cfg aliases throught the code base

Co-authored-by: Mads Marquart <mads@marquart.dk>
This commit is contained in:
Amr Bashir 2022-12-25 09:57:27 +02:00 committed by GitHub
parent 58ec458877
commit 5e77d70245
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 185 additions and 227 deletions

View file

@ -15,47 +15,26 @@
//!
//! However only the module corresponding to the platform you're compiling to will be available.
#[cfg(target_os = "android")]
#[cfg(android_platform)]
pub mod android;
#[cfg(target_os = "ios")]
#[cfg(ios_platform)]
pub mod ios;
#[cfg(target_os = "macos")]
#[cfg(macos_platform)]
pub mod macos;
#[cfg(all(
feature = "wayland",
any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
)
))]
#[cfg(wayland_platform)]
pub mod wayland;
#[cfg(target_arch = "wasm32")]
#[cfg(wasm_platform)]
pub mod web;
#[cfg(target_os = "windows")]
#[cfg(windows_platform)]
pub mod windows;
#[cfg(all(
feature = "x11",
any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
)
))]
#[cfg(x11_platform)]
pub mod x11;
#[cfg(any(
target_os = "windows",
target_os = "macos",
target_os = "android",
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
windows_platform,
macos_platform,
android_platform,
x11_platform,
wayland_platform
))]
pub mod run_return;

View file

@ -41,7 +41,7 @@ impl<T> EventLoopWindowTargetExtWayland for EventLoopWindowTarget<T> {
LinuxEventLoopWindowTarget::Wayland(ref p) => {
Some(p.display().get_display_ptr() as *mut _)
}
#[cfg(feature = "x11")]
#[cfg(x11_platform)]
_ => None,
}
}
@ -95,7 +95,7 @@ impl WindowExtWayland for Window {
fn wayland_surface(&self) -> Option<*mut raw::c_void> {
match self.window {
LinuxWindow::Wayland(ref w) => Some(w.surface().as_ref().c_ptr() as *mut _),
#[cfg(feature = "x11")]
#[cfg(x11_platform)]
_ => None,
}
}
@ -104,7 +104,7 @@ impl WindowExtWayland for Window {
fn wayland_display(&self) -> Option<*mut raw::c_void> {
match self.window {
LinuxWindow::Wayland(ref w) => Some(w.display().get_display_ptr() as *mut _),
#[cfg(feature = "x11")]
#[cfg(x11_platform)]
_ => None,
}
}

View file

@ -60,7 +60,7 @@ impl<T> EventLoopWindowTargetExtX11 for EventLoopWindowTarget<T> {
fn xlib_xconnection(&self) -> Option<Arc<XConnection>> {
match self.p {
LinuxEventLoopWindowTarget::X(ref e) => Some(e.x_connection().clone()),
#[cfg(feature = "wayland")]
#[cfg(wayland_platform)]
_ => None,
}
}
@ -124,7 +124,7 @@ impl WindowExtX11 for Window {
fn xlib_window(&self) -> Option<raw::c_ulong> {
match self.window {
LinuxWindow::X(ref w) => Some(w.xlib_window()),
#[cfg(feature = "wayland")]
#[cfg(wayland_platform)]
_ => None,
}
}
@ -133,7 +133,7 @@ impl WindowExtX11 for Window {
fn xlib_display(&self) -> Option<*mut raw::c_void> {
match self.window {
LinuxWindow::X(ref w) => Some(w.xlib_display()),
#[cfg(feature = "wayland")]
#[cfg(wayland_platform)]
_ => None,
}
}
@ -142,7 +142,7 @@ impl WindowExtX11 for Window {
fn xlib_screen_id(&self) -> Option<raw::c_int> {
match self.window {
LinuxWindow::X(ref w) => Some(w.xlib_screen_id()),
#[cfg(feature = "wayland")]
#[cfg(wayland_platform)]
_ => None,
}
}
@ -151,7 +151,7 @@ impl WindowExtX11 for Window {
fn xlib_xconnection(&self) -> Option<Arc<XConnection>> {
match self.window {
LinuxWindow::X(ref w) => Some(w.xlib_xconnection()),
#[cfg(feature = "wayland")]
#[cfg(wayland_platform)]
_ => None,
}
}
@ -160,7 +160,7 @@ impl WindowExtX11 for Window {
fn xcb_connection(&self) -> Option<*mut raw::c_void> {
match self.window {
LinuxWindow::X(ref w) => Some(w.xcb_connection()),
#[cfg(feature = "wayland")]
#[cfg(wayland_platform)]
_ => None,
}
}