Mypal/dom/gamepad/ipc/GamepadEventTypes.ipdlh
2019-03-11 13:26:37 +03:00

59 lines
1.4 KiB
Plaintext

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
using mozilla::dom::GamepadServiceType from "mozilla/dom/GamepadMessageUtils.h";
using mozilla::dom::GamepadPoseState from "mozilla/dom/GamepadMessageUtils.h";
namespace mozilla {
namespace dom {
struct GamepadAdded {
nsString id;
uint32_t index;
// Ideally, mapping should be a GamepadMappingType
// But, we have dependency problems in non MOZ_GAMEPAD
// platforms. Therefore, we make it as an uint32_t here.
uint32_t mapping;
GamepadServiceType service_type;
uint32_t num_buttons;
uint32_t num_axes;
};
struct GamepadRemoved {
uint32_t index;
GamepadServiceType service_type;
};
struct GamepadAxisInformation {
uint32_t index;
GamepadServiceType service_type;
uint32_t axis;
double value;
};
struct GamepadButtonInformation {
uint32_t index;
GamepadServiceType service_type;
uint32_t button;
bool pressed;
double value;
};
struct GamepadPoseInformation {
uint32_t index;
GamepadServiceType service_type;
GamepadPoseState pose_state;
};
union GamepadChangeEvent {
GamepadAdded;
GamepadRemoved;
GamepadAxisInformation;
GamepadButtonInformation;
GamepadPoseInformation;
};
} // namespace dom
} // namespace mozilla