mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-12-22 03:48:21 -06:00
support keyboard input on wayland and android properly
This commit is contained in:
parent
097bdc29ff
commit
bb4d2a80bf
|
@ -48,8 +48,9 @@ ndk = "0.9"
|
|||
winapi = { version = "0.3", features = ["wincon"] }
|
||||
|
||||
[features]
|
||||
default = ["raw-evt"]
|
||||
raw-evt = [] #required for mouse input, but breaks keyboard on android
|
||||
default = ["raw-evt-mouse"]
|
||||
raw-evt-keyboard = [] # use raw input for keyboard. works on x11 and windows, breaks keyboard on android and wayland
|
||||
raw-evt-mouse = [] # required for mouse input
|
||||
generate_visualizer_data = ["dep:serde_json", "shipyard/serde1"]
|
||||
safe_lz4 = ["lz4_flex/safe-encode", "lz4_flex/safe-decode"]
|
||||
parallel = ["shipyard/parallel"] # causes some serious issues!
|
||||
|
|
|
@ -34,8 +34,12 @@ pub fn process_winit_events(world: &mut World, event: &Event<()>) {
|
|||
));
|
||||
},
|
||||
|
||||
#[cfg(not(feature = "raw-evt"))]
|
||||
#[cfg(not(feature = "raw-evt-keyboard"))]
|
||||
WindowEvent::KeyboardInput { device_id, event, .. } => {
|
||||
// HACK: translate KeyboardInput events to raw device events
|
||||
if event.repeat {
|
||||
return;
|
||||
}
|
||||
world.add_entity((
|
||||
EventComponent,
|
||||
InputDeviceEvent {
|
||||
|
@ -63,8 +67,21 @@ pub fn process_winit_events(world: &mut World, event: &Event<()>) {
|
|||
_ => ()
|
||||
},
|
||||
|
||||
#[cfg(feature = "raw-evt")]
|
||||
#[cfg(any(
|
||||
feature = "raw-evt-keyboard",
|
||||
feature = "raw-evt-mouse",
|
||||
))]
|
||||
Event::DeviceEvent { device_id, event } => {
|
||||
// Filter out events we don't care about
|
||||
match event {
|
||||
#[cfg(feature = "raw-evt-keyboard")]
|
||||
DeviceEvent::Key(_) => (),
|
||||
|
||||
#[cfg(feature = "raw-evt-mouse")]
|
||||
DeviceEvent::MouseMotion { .. } | DeviceEvent::Button { .. } => (),
|
||||
|
||||
_ => return,
|
||||
};
|
||||
world.add_entity((
|
||||
EventComponent,
|
||||
InputDeviceEvent {
|
||||
|
|
Loading…
Reference in a new issue