diff --git a/crates/bevy_input_focus/Cargo.toml b/crates/bevy_input_focus/Cargo.toml index 60ca101301436..a469e006374bf 100644 --- a/crates/bevy_input_focus/Cargo.toml +++ b/crates/bevy_input_focus/Cargo.toml @@ -10,7 +10,17 @@ keywords = ["bevy"] rust-version = "1.85.0" [features] -default = ["std", "bevy_reflect", "bevy_ecs/async_executor"] +default = [ + "std", + "bevy_reflect", + "bevy_ecs/async_executor", + "gamepad", + "keyboard", + "mouse", +] +gamepad = ["bevy_input/gamepad"] +keyboard = ["bevy_input/keyboard"] +mouse = ["bevy_input/mouse"] # Functionality @@ -63,10 +73,7 @@ libm = ["bevy_math/libm", "bevy_window/libm"] bevy_app = { path = "../bevy_app", version = "0.18.0-dev", default-features = false } bevy_camera = { path = "../bevy_camera", version = "0.18.0-dev", default-features = false } bevy_ecs = { path = "../bevy_ecs", version = "0.18.0-dev", default-features = false } -bevy_input = { path = "../bevy_input", version = "0.18.0-dev", default-features = false, features = [ - "keyboard", - "gamepad", -] } +bevy_input = { path = "../bevy_input", version = "0.18.0-dev", default-features = false } bevy_math = { path = "../bevy_math", version = "0.18.0-dev", default-features = false } bevy_picking = { path = "../bevy_picking", version = "0.18.0-dev", default-features = false, optional = true } bevy_ui = { path = "../bevy_ui", version = "0.18.0-dev", default-features = false } diff --git a/crates/bevy_input_focus/src/lib.rs b/crates/bevy_input_focus/src/lib.rs index 2f2c8e61e3e66..7dc4f757b3b7f 100644 --- a/crates/bevy_input_focus/src/lib.rs +++ b/crates/bevy_input_focus/src/lib.rs @@ -34,7 +34,12 @@ use bevy_app::{App, Plugin, PostStartup, PreUpdate}; use bevy_ecs::{ entity::Entities, prelude::*, query::QueryData, system::SystemParam, traversal::Traversal, }; -use bevy_input::{gamepad::GamepadButtonChangedEvent, keyboard::KeyboardInput, mouse::MouseWheel}; +#[cfg(feature = "gamepad")] +use bevy_input::gamepad::GamepadButtonChangedEvent; +#[cfg(feature = "keyboard")] +use bevy_input::keyboard::KeyboardInput; +#[cfg(feature = "mouse")] +use bevy_input::mouse::MouseWheel; use bevy_window::{PrimaryWindow, Window}; use core::fmt::Debug; @@ -221,8 +226,11 @@ impl Plugin for InputDispatchPlugin { .add_systems( PreUpdate, ( + #[cfg(feature = "keyboard")] dispatch_focused_input::, + #[cfg(feature = "gamepad")] dispatch_focused_input::, + #[cfg(feature = "mouse")] dispatch_focused_input::, ) .in_set(InputFocusSystems::Dispatch), diff --git a/crates/bevy_internal/Cargo.toml b/crates/bevy_internal/Cargo.toml index 40993d65c9e7a..989cddf728d56 100644 --- a/crates/bevy_internal/Cargo.toml +++ b/crates/bevy_internal/Cargo.toml @@ -427,9 +427,9 @@ async_executor = [ web = ["bevy_app/web", "bevy_platform/web", "bevy_reflect/web"] # Input sources. -mouse = ["bevy_input/mouse"] -keyboard = ["bevy_input/keyboard"] -gamepad = ["bevy_input/gamepad"] +mouse = ["bevy_input/mouse", "bevy_input_focus?/mouse"] +keyboard = ["bevy_input/keyboard", "bevy_input_focus?/keyboard"] +gamepad = ["bevy_input/gamepad", "bevy_input_focus?/gamepad"] touch = ["bevy_input/touch"] gestures = ["bevy_input/gestures"]