summary history branches tags files
commit:6d398520933c224939bde6d49a3ce60a5a06e3fe
author:Trevor Bentley
committer:Trevor Bentley
date:Wed Jul 26 08:18:17 2017 +0000
parents:7119cea65468100ae312b6eb5ac4bf81d46dd697
Fix compilation on non-Mac platforms
diff --git a/examples/example.rs b/examples/example.rs
line changes: +1/-1
index b60d76c..24c4a2b
--- a/examples/example.rs
+++ b/examples/example.rs
@@ -77,7 +77,7 @@ fn populate(bar_rc: Rc<RefCell<Touchbar>>, count: u32) {
     tb.update_label_width(&label1_id, 100);
 
     // Support double-clicking the label with one finger
-    tb.add_item_tap_gesture(&label1_id, 2, 1, Box::new(move |item| {
+    tb.add_item_tap_gesture(&label1_id, 2, 1, Box::new(move |_item| {
         info!("Label double-clicked!");
     }));
 

diff --git a/src/lib.rs b/src/lib.rs
line changes: +22/-21
index 34b5f0c..953f8d1
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -58,15 +58,18 @@
 mod interface;
 pub use interface::*;
 
+#[allow(unused_imports)]
+#[macro_use]
+extern crate log;
+
+//
+// Mac+TouchBar imports
+//
 #[cfg(target_os = "macos")]
 #[cfg(feature = "private_api")]
 #[macro_use]
 mod wrapper;
 
-#[allow(unused_imports)]
-#[macro_use]
-extern crate log;
-
 #[cfg(target_os = "macos")]
 #[cfg(feature = "private_api")]
 #[macro_use]
@@ -77,27 +80,25 @@ extern crate objc;
 #[macro_use]
 mod touchbar;
 
-/// Main controller for creating and using Touch Bar UIs
-///
-/// Blah
 #[cfg(target_os = "macos")]
 #[cfg(feature = "private_api")]
 pub use touchbar::Touchbar as Touchbar;
 
-#[cfg(not(feature = "private_api"))]
-mod dummy;
-
-/// Main controller for creating and using Touch Bar UIs
-///
-/// Blah
-#[cfg(not(feature = "private_api"))]
-pub use dummy::DummyTouchbar as Touchbar;
-
 #[cfg(target_os = "macos")]
 #[cfg(feature = "private_api")]
 pub use touchbar::util;
 
-#[cfg(not(feature = "private_api"))]
+
+//
+// Non-Mac/Dummy TouchBar imports
+//
+#[cfg(not(all(target_os = "macos", feature = "private_api")))]
+mod dummy;
+
+#[cfg(not(all(target_os = "macos", feature = "private_api")))]
+pub use dummy::DummyTouchbar as Touchbar;
+
+#[cfg(not(all(target_os = "macos", feature = "private_api")))]
 pub use dummy::util;
 
 /// Module for creating and running a simple Mac application
@@ -113,7 +114,7 @@ pub mod app {
     extern crate objc;
     extern crate log4rs;
     use std::env;
-    #[cfg(not(feature = "private_api"))]
+    #[cfg(not(all(target_os = "macos", feature = "private_api")))]
     use std::process;
 
     #[cfg(target_os = "macos")]
@@ -135,7 +136,7 @@ pub mod app {
             let _ = msg_send![app, setActivationPolicy: 1]; // NSApplicationActivationPolicyAccessory
         }
     }
-    #[cfg(not(feature = "private_api"))]
+    #[cfg(not(all(target_os = "macos", feature = "private_api")))]
     ///
     pub fn init_app() {}
 
@@ -154,7 +155,7 @@ pub mod app {
             let _ = msg_send![app, run];
         }
     }
-    #[cfg(not(feature = "private_api"))]
+    #[cfg(not(all(target_os = "macos", feature = "private_api")))]
     ///
     pub fn run_forever() { loop {} }
 
@@ -173,7 +174,7 @@ pub mod app {
             let _ = msg_send![app, terminate: 0];
         }
     }
-    #[cfg(not(feature = "private_api"))]
+    #[cfg(not(all(target_os = "macos", feature = "private_api")))]
     ///
     pub fn quit() {
         process::exit(0);