Skip to content

Expose a GamepadProvider and use Responder types for messages #41453

@mrobinson

Description

@mrobinson

We should create a GamepadProvider like the ClipboardProvider that we have. This would be responsible for managing all interactions with gamepads. In addition, a default implementation would be provided that did nothing.

The API for this would look like this:

trait GamepadProvider {
    /// Request to play a haptic effect on a connected gamepad.
    fn play_haptic_effect(
        &self,
        _webview: WebView,
        _gamepad_index: usize,
        _effect_type: GamepadHapticEffectType,
         _responder: IpcResponder<bool>
    );

    /// Request to stop a haptic effect on a connected gamepad.
    fn stop_haptic_effect(&self, _webview: WebView, gamepad_index: usize, _responder: IpcResponder<bool>) {}
}

Each resonder would be default send a false (for failure message). The default implementation of this trait would just always return failures (the implementation of the methods would be empty).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions