From 3ad7f9a58429b02b11b18f6a70ac011f698b6f4b Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Fri, 24 Apr 2015 09:51:23 +0200 Subject: [PATCH] Create reorganization --- src/{ => api}/android/ffi.rs | 0 src/{ => api}/android/mod.rs | 2 ++ src/{ => api}/cocoa/event.rs | 0 src/{ => api}/cocoa/headless.rs | 0 src/{ => api}/cocoa/mod.rs | 2 ++ src/{ => api}/cocoa/monitor.rs | 0 src/api/mod.rs | 4 ++++ src/{ => api}/win32/callback.rs | 0 src/{ => api}/win32/event.rs | 0 src/{ => api}/win32/gl.rs | 0 src/{ => api}/win32/headless.rs | 0 src/{ => api}/win32/init.rs | 0 src/{ => api}/win32/make_current_guard.rs | 0 src/{ => api}/win32/mod.rs | 2 ++ src/{ => api}/win32/monitor.rs | 0 src/{ => api}/x11/ffi.rs | 0 src/{ => api}/x11/headless.rs | 0 src/{ => api}/x11/mod.rs | 2 ++ src/{ => api}/x11/window/events.rs | 0 src/{ => api}/x11/window/mod.rs | 0 src/{ => api}/x11/window/monitor.rs | 0 src/lib.rs | 16 +--------------- src/platform/android/mod.rs | 3 +++ src/platform/linux/mod.rs | 3 +++ src/platform/macos/mod.rs | 3 +++ src/platform/mod.rs | 17 +++++++++++++++++ src/platform/windows/mod.rs | 3 +++ 27 files changed, 42 insertions(+), 15 deletions(-) rename src/{ => api}/android/ffi.rs (100%) rename src/{ => api}/android/mod.rs (99%) rename src/{ => api}/cocoa/event.rs (100%) rename src/{ => api}/cocoa/headless.rs (100%) rename src/{ => api}/cocoa/mod.rs (99%) rename src/{ => api}/cocoa/monitor.rs (100%) create mode 100644 src/api/mod.rs rename src/{ => api}/win32/callback.rs (100%) rename src/{ => api}/win32/event.rs (100%) rename src/{ => api}/win32/gl.rs (100%) rename src/{ => api}/win32/headless.rs (100%) rename src/{ => api}/win32/init.rs (100%) rename src/{ => api}/win32/make_current_guard.rs (100%) rename src/{ => api}/win32/mod.rs (99%) rename src/{ => api}/win32/monitor.rs (100%) rename src/{ => api}/x11/ffi.rs (100%) rename src/{ => api}/x11/headless.rs (100%) rename src/{ => api}/x11/mod.rs (95%) rename src/{ => api}/x11/window/events.rs (100%) rename src/{ => api}/x11/window/mod.rs (100%) rename src/{ => api}/x11/window/monitor.rs (100%) create mode 100644 src/platform/android/mod.rs create mode 100644 src/platform/linux/mod.rs create mode 100644 src/platform/macos/mod.rs create mode 100644 src/platform/mod.rs create mode 100644 src/platform/windows/mod.rs diff --git a/src/android/ffi.rs b/src/api/android/ffi.rs similarity index 100% rename from src/android/ffi.rs rename to src/api/android/ffi.rs diff --git a/src/android/mod.rs b/src/api/android/mod.rs similarity index 99% rename from src/android/mod.rs rename to src/api/android/mod.rs index afe49c27..c769fc8e 100644 --- a/src/android/mod.rs +++ b/src/api/android/mod.rs @@ -1,3 +1,5 @@ +#![cfg(target_os = "android")] + extern crate android_glue; use libc; diff --git a/src/cocoa/event.rs b/src/api/cocoa/event.rs similarity index 100% rename from src/cocoa/event.rs rename to src/api/cocoa/event.rs diff --git a/src/cocoa/headless.rs b/src/api/cocoa/headless.rs similarity index 100% rename from src/cocoa/headless.rs rename to src/api/cocoa/headless.rs diff --git a/src/cocoa/mod.rs b/src/api/cocoa/mod.rs similarity index 99% rename from src/cocoa/mod.rs rename to src/api/cocoa/mod.rs index 71257204..b9c566fa 100644 --- a/src/cocoa/mod.rs +++ b/src/api/cocoa/mod.rs @@ -1,3 +1,5 @@ +#![cfg(target_os = "macos")] + #[cfg(feature = "headless")] pub use self::headless::HeadlessContext; diff --git a/src/cocoa/monitor.rs b/src/api/cocoa/monitor.rs similarity index 100% rename from src/cocoa/monitor.rs rename to src/api/cocoa/monitor.rs diff --git a/src/api/mod.rs b/src/api/mod.rs new file mode 100644 index 00000000..472c7162 --- /dev/null +++ b/src/api/mod.rs @@ -0,0 +1,4 @@ +pub mod android; +pub mod cocoa; +pub mod win32; +pub mod x11; diff --git a/src/win32/callback.rs b/src/api/win32/callback.rs similarity index 100% rename from src/win32/callback.rs rename to src/api/win32/callback.rs diff --git a/src/win32/event.rs b/src/api/win32/event.rs similarity index 100% rename from src/win32/event.rs rename to src/api/win32/event.rs diff --git a/src/win32/gl.rs b/src/api/win32/gl.rs similarity index 100% rename from src/win32/gl.rs rename to src/api/win32/gl.rs diff --git a/src/win32/headless.rs b/src/api/win32/headless.rs similarity index 100% rename from src/win32/headless.rs rename to src/api/win32/headless.rs diff --git a/src/win32/init.rs b/src/api/win32/init.rs similarity index 100% rename from src/win32/init.rs rename to src/api/win32/init.rs diff --git a/src/win32/make_current_guard.rs b/src/api/win32/make_current_guard.rs similarity index 100% rename from src/win32/make_current_guard.rs rename to src/api/win32/make_current_guard.rs diff --git a/src/win32/mod.rs b/src/api/win32/mod.rs similarity index 99% rename from src/win32/mod.rs rename to src/api/win32/mod.rs index 4a9dcbf6..41fb6aa0 100644 --- a/src/win32/mod.rs +++ b/src/api/win32/mod.rs @@ -1,3 +1,5 @@ +#![cfg(target_os = "windows")] + use std::sync::atomic::AtomicBool; use std::mem; use std::ptr; diff --git a/src/win32/monitor.rs b/src/api/win32/monitor.rs similarity index 100% rename from src/win32/monitor.rs rename to src/api/win32/monitor.rs diff --git a/src/x11/ffi.rs b/src/api/x11/ffi.rs similarity index 100% rename from src/x11/ffi.rs rename to src/api/x11/ffi.rs diff --git a/src/x11/headless.rs b/src/api/x11/headless.rs similarity index 100% rename from src/x11/headless.rs rename to src/api/x11/headless.rs diff --git a/src/x11/mod.rs b/src/api/x11/mod.rs similarity index 95% rename from src/x11/mod.rs rename to src/api/x11/mod.rs index cc87b2ba..5aadc94d 100644 --- a/src/x11/mod.rs +++ b/src/api/x11/mod.rs @@ -1,3 +1,5 @@ +#![cfg(target_os = "linux")] + #[cfg(feature = "headless")] pub use self::headless::HeadlessContext; diff --git a/src/x11/window/events.rs b/src/api/x11/window/events.rs similarity index 100% rename from src/x11/window/events.rs rename to src/api/x11/window/events.rs diff --git a/src/x11/window/mod.rs b/src/api/x11/window/mod.rs similarity index 100% rename from src/x11/window/mod.rs rename to src/api/x11/window/mod.rs diff --git a/src/x11/window/monitor.rs b/src/api/x11/window/monitor.rs similarity index 100% rename from src/x11/window/monitor.rs rename to src/api/x11/window/monitor.rs diff --git a/src/lib.rs b/src/lib.rs index 9ed059eb..4079a972 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -61,22 +61,8 @@ pub use window::{AvailableMonitorsIter, MonitorID, get_available_monitors, get_p #[cfg(feature = "window")] pub use native_monitor::NativeMonitorId; -#[cfg(all(not(target_os = "windows"), not(target_os = "linux"), not(target_os = "macos"), not(target_os = "android")))] -use this_platform_is_not_supported; - -#[cfg(target_os = "windows")] -#[path="win32/mod.rs"] +mod api; mod platform; -#[cfg(target_os = "linux")] -#[path="x11/mod.rs"] -mod platform; -#[cfg(target_os = "macos")] -#[path="cocoa/mod.rs"] -mod platform; -#[cfg(target_os = "android")] -#[path="android/mod.rs"] -mod platform; - mod events; #[cfg(feature = "headless")] mod headless; diff --git a/src/platform/android/mod.rs b/src/platform/android/mod.rs new file mode 100644 index 00000000..c90d8ced --- /dev/null +++ b/src/platform/android/mod.rs @@ -0,0 +1,3 @@ +#![cfg(target_os = "android")] + +pub use api::android::*; diff --git a/src/platform/linux/mod.rs b/src/platform/linux/mod.rs new file mode 100644 index 00000000..df3a318d --- /dev/null +++ b/src/platform/linux/mod.rs @@ -0,0 +1,3 @@ +#![cfg(target_os = "linux")] + +pub use api::x11::*; diff --git a/src/platform/macos/mod.rs b/src/platform/macos/mod.rs new file mode 100644 index 00000000..1d253a0a --- /dev/null +++ b/src/platform/macos/mod.rs @@ -0,0 +1,3 @@ +#![cfg(target_os = "macos")] + +pub use api::cocoa::*; diff --git a/src/platform/mod.rs b/src/platform/mod.rs new file mode 100644 index 00000000..68ddfccb --- /dev/null +++ b/src/platform/mod.rs @@ -0,0 +1,17 @@ +pub use self::platform::*; + +#[cfg(target_os = "windows")] +#[path="windows/mod.rs"] +mod platform; +#[cfg(target_os = "linux")] +#[path="linux/mod.rs"] +mod platform; +#[cfg(target_os = "macos")] +#[path="macos/mod.rs"] +mod platform; +#[cfg(target_os = "android")] +#[path="android/mod.rs"] +mod platform; + +#[cfg(all(not(target_os = "windows"), not(target_os = "linux"), not(target_os = "macos"), not(target_os = "android")))] +use this_platform_is_not_supported; diff --git a/src/platform/windows/mod.rs b/src/platform/windows/mod.rs new file mode 100644 index 00000000..c13f4f55 --- /dev/null +++ b/src/platform/windows/mod.rs @@ -0,0 +1,3 @@ +#![cfg(target_os = "windows")] + +pub use api::win32::*;