diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 0b7ba7f..7bd868a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -28,6 +28,8 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-latest]
runs-on: ${{ matrix.os }}
steps:
+ - if: matrix.os == 'ubuntu-latest'
+ run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
diff --git a/Cargo.toml b/Cargo.toml
index 0a9a8eb..016ddd8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -39,65 +39,19 @@ features = [
"errhandlingapi"
]
-[target.i686-unknown-linux-gnu.dependencies]
-x11-dl = "2.18.3"
-wayland-client = "0.25"
-wayland-protocols = { version = "0.25", features = ["client"] }
-tempfile = "3.1.0"
+[features]
+default = ["wayland", "x11"]
+x11 = ["x11-dl"]
+wayland = ["wayland-client", "wayland-protocols", "wayland-cursor", "tempfile", "xkb", "xkbcommon-sys"]
-[target.x86_64-unknown-linux-gnu.dependencies]
-x11-dl = "2.18.3"
-wayland-client = "0.25"
-wayland-protocols = { version = "0.25", features = ["client"] }
-tempfile = "3.1.0"
-
-[target.arm-unknown-linux-gnueabihf.dependencies]
-x11-dl = "2.18.3"
-wayland-client = "0.25"
-wayland-protocols = { version = "0.25", features = ["client"] }
-tempfile = "3.1.0"
-
-[target.armv7-unknown-linux-gnueabihf.dependencies]
-x11-dl = "2.18.3"
-wayland-client = "0.25"
-wayland-protocols = { version = "0.25", features = ["client"] }
-tempfile = "3.1.0"
-
-[target.aarch64-unknown-linux-gnu.dependencies]
-x11-dl = "2.18.3"
-wayland-client = "0.25"
-wayland-protocols = { version = "0.25", features = ["client"] }
-tempfile = "3.1.0"
-
-[target.x86_64-unknown-dragonfly.dependencies]
-x11-dl = "2.18.3"
-wayland-client = "0.25"
-wayland-protocols = { version = "0.25", features = ["client"] }
-tempfile = "3.1.0"
-
-[target.armv6-unknown-freebsd.dependencies]
-x11-dl = "2.18.3"
-wayland-client = "0.25"
-wayland-protocols = { version = "0.25", features = ["client"] }
-tempfile = "3.1.0"
-
-[target.armv7-unknown-freebsd.dependencies]
-x11-dl = "2.18.3"
-wayland-client = "0.25"
-wayland-protocols = { version = "0.25", features = ["client"] }
-tempfile = "3.1.0"
-
-[target.aarch64-unknown-freebsd.dependencies]
-x11-dl = "2.18.3"
-wayland-client = "0.25"
-wayland-protocols = { version = "0.25", features = ["client"] }
-tempfile = "3.1.0"
-
-[target.x86_64-unknown-freebsd.dependencies]
-x11-dl = "2.18.3"
-wayland-client = "0.25"
-wayland-protocols = { version = "0.25", features = ["client"] }
-tempfile = "3.1.0"
+[target.'cfg(not(any(target_os = "macos", target_os = "redox", windows)))'.dependencies]
+wayland-client = {version = "0.25", optional = true}
+wayland-protocols = { version = "0.25", features = ["client", "unstable_protocols"], optional = true }
+wayland-cursor = {version = "0.25", optional = true}
+tempfile = {version = "3.1.0", optional = true}
+xkb = {version = "0.2.1", optional = true}
+xkbcommon-sys = {version = "0.7", optional = true}
+x11-dl = {version = "2.18.3", optional = true}
[target.x86_64-unknown-redox.dependencies]
orbclient = "0.3.20"
diff --git a/build.rs b/build.rs
index 4e849ea..07b0092 100644
--- a/build.rs
+++ b/build.rs
@@ -2,6 +2,15 @@ use std::env;
extern crate cc;
fn main() {
+ if cfg!(not(any(
+ target_os = "macos",
+ target_os = "windows",
+ target_os = "redox"
+ ))) && cfg!(not(any(feature = "wayland", feature = "x11")))
+ {
+ panic!("At least one of the x11 or wayland features must be enabled");
+ }
+
let env = env::var("TARGET").unwrap();
if env.contains("darwin") {
cc::Build::new()
diff --git a/src/os/unix/common.rs b/src/os/unix/common.rs
new file mode 100644
index 0000000..be9b524
--- /dev/null
+++ b/src/os/unix/common.rs
@@ -0,0 +1,58 @@
+use crate::Result;
+use crate::{Key, MenuHandle, MenuItem, MenuItemHandle, UnixMenu, UnixMenuItem};
+
+pub struct Menu {
+ pub internal: UnixMenu,
+}
+
+impl Menu {
+ pub fn new(name: &str) -> Result