mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-12-01 01:36:09 +03:00
108 lines
2.5 KiB
Plaintext
108 lines
2.5 KiB
Plaintext
|
// Copyright 2016 The Chromium Authors. All rights reserved.
|
||
|
// Use of this source code is governed by a BSD-style license that can be
|
||
|
// found in the LICENSE file.
|
||
|
|
||
|
module device.mojom;
|
||
|
|
||
|
struct GamepadQuaternion {
|
||
|
float x;
|
||
|
float y;
|
||
|
float z;
|
||
|
float w;
|
||
|
};
|
||
|
|
||
|
struct GamepadVector {
|
||
|
float x;
|
||
|
float y;
|
||
|
float z;
|
||
|
};
|
||
|
|
||
|
struct GamepadButton {
|
||
|
bool pressed;
|
||
|
bool touched;
|
||
|
double value;
|
||
|
};
|
||
|
|
||
|
struct GamepadPose {
|
||
|
GamepadQuaternion? orientation;
|
||
|
GamepadVector? position;
|
||
|
GamepadVector? angular_velocity;
|
||
|
GamepadVector? linear_velocity;
|
||
|
GamepadVector? angular_acceleration;
|
||
|
GamepadVector? linear_acceleration;
|
||
|
};
|
||
|
|
||
|
enum GamepadHand {
|
||
|
GamepadHandNone = 0,
|
||
|
GamepadHandLeft = 1,
|
||
|
GamepadHandRight = 2
|
||
|
};
|
||
|
|
||
|
enum GamepadHapticActuatorType {
|
||
|
GamepadHapticActuatorTypeVibration = 0,
|
||
|
GamepadHapticActuatorTypeDualRumble = 1
|
||
|
};
|
||
|
|
||
|
enum GamepadHapticEffectType {
|
||
|
GamepadHapticEffectTypeDualRumble = 0
|
||
|
};
|
||
|
|
||
|
struct GamepadHapticActuator {
|
||
|
GamepadHapticActuatorType type;
|
||
|
};
|
||
|
|
||
|
struct Gamepad {
|
||
|
bool connected;
|
||
|
array<uint16> id;
|
||
|
uint64 timestamp;
|
||
|
array<double> axes;
|
||
|
array<GamepadButton> buttons;
|
||
|
GamepadHapticActuator? vibration_actuator;
|
||
|
array<uint16> mapping;
|
||
|
GamepadPose? pose;
|
||
|
GamepadHand hand;
|
||
|
uint32 display_id;
|
||
|
};
|
||
|
|
||
|
interface GamepadObserver {
|
||
|
GamepadConnected(int32 index, Gamepad gamepad);
|
||
|
GamepadDisconnected(int32 index, Gamepad gamepad);
|
||
|
};
|
||
|
|
||
|
// Asks the browser process to start polling, and return a shared memory
|
||
|
// handle that will hold the data from the hardware. See
|
||
|
// gamepad_shared_buffer.h for a description of how synchronization is
|
||
|
// handled. The number of Starts should match the number of Stops.
|
||
|
interface GamepadMonitor {
|
||
|
[Sync]
|
||
|
GamepadStartPolling() => (handle<shared_buffer> memory_handle);
|
||
|
|
||
|
[Sync]
|
||
|
GamepadStopPolling() => ();
|
||
|
|
||
|
SetObserver(GamepadObserver gamepad_observer);
|
||
|
};
|
||
|
|
||
|
struct GamepadEffectParameters {
|
||
|
double duration;
|
||
|
double start_delay;
|
||
|
double strong_magnitude;
|
||
|
double weak_magnitude;
|
||
|
};
|
||
|
|
||
|
enum GamepadHapticsResult {
|
||
|
GamepadHapticsResultError = 0,
|
||
|
GamepadHapticsResultComplete = 1,
|
||
|
GamepadHapticsResultPreempted = 2,
|
||
|
GamepadHapticsResultInvalidParameter = 3,
|
||
|
GamepadHapticsResultNotSupported = 4
|
||
|
};
|
||
|
|
||
|
interface GamepadHapticsManager {
|
||
|
PlayVibrationEffectOnce(int32 pad_index,
|
||
|
GamepadHapticEffectType type,
|
||
|
GamepadEffectParameters params)
|
||
|
=> (GamepadHapticsResult result);
|
||
|
ResetVibrationActuator(int32 pad_index) => (GamepadHapticsResult result);
|
||
|
};
|