diff options
author | Daniel Adams <70986246+msub2@users.noreply.github.com> | 2024-07-19 20:29:27 -1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-20 06:29:27 +0000 |
commit | 2c17de7fa72ca6f96f4e37faf90ac9786d0b53a0 (patch) | |
tree | 3f4b1d4691e1170c3d7106ade77d10fa486c634f /components/shared/script/lib.rs | |
parent | 9212ed203a7dcec88008fca47bce0bff3fe2649b (diff) | |
download | servo-2c17de7fa72ca6f96f4e37faf90ac9786d0b53a0.tar.gz servo-2c17de7fa72ca6f96f4e37faf90ac9786d0b53a0.zip |
Gamepad: Implement GamepadHapticActuator (#32046)
* Implement Servo side of GamepadHapticActuator
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Get build working
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Create effect handling on embedder side
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Update tracing for GamepadHapticEffect
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Update gilrs to point to commit with effect complete event
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Implement playing and preempting haptic effects
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Update IDL to add trigger rumble
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Update WPT expectations
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Handle stopping haptic effects from reset()
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* ./mach fmt, fix test-tidy issues
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Add extra validity checks for trigger rumble
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Retrieve supported haptic effects from embedder
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Fix test expectations
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Add missing spec link, pin gilrs commit
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* servoshell cargo formatting
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Fix Cargo.toml
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Additional comments, realm proof, naming
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* ./mach fmt
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Update gilrs rev to gilrs-core 0.5.12 release
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Implement sequence ids for gamepad haptic promises
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Take playing effect promise instead of cloning
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Implement listener for reset function
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Fix Cargo.lock
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Restructure IPC listeners, add comments, handle visibility change
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Check that haptic effect still exists before handling ff completion event
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Visibility steps, add InRealm bindings for promises
Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Add Gamepad EmbedderMsg arms to egl servo_glue
Signed-off-by: Daniel Adams <msub2official@gmail.com>
---------
Signed-off-by: Daniel Adams <msub2official@gmail.com>
Diffstat (limited to 'components/shared/script/lib.rs')
-rw-r--r-- | components/shared/script/lib.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/components/shared/script/lib.rs b/components/shared/script/lib.rs index ff6e2baeefb..895923930cd 100644 --- a/components/shared/script/lib.rs +++ b/components/shared/script/lib.rs @@ -1093,11 +1093,25 @@ pub struct GamepadInputBounds { } #[derive(Clone, Debug, Deserialize, Serialize)] +/// The haptic effects supported by this gamepad +pub struct GamepadSupportedHapticEffects { + /// Gamepad support for dual rumble effects + pub supports_dual_rumble: bool, + /// Gamepad support for trigger rumble effects + pub supports_trigger_rumble: bool, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] /// The type of Gamepad event pub enum GamepadEvent { /// A new gamepad has been connected /// <https://www.w3.org/TR/gamepad/#event-gamepadconnected> - Connected(GamepadIndex, String, GamepadInputBounds), + Connected( + GamepadIndex, + String, + GamepadInputBounds, + GamepadSupportedHapticEffects, + ), /// An existing gamepad has been disconnected /// <https://www.w3.org/TR/gamepad/#event-gamepaddisconnected> Disconnected(GamepadIndex), |