summaryrefslogtreecommitdiffstats
path: root/dom/gamepad/ipc/GamepadEventTypes.ipdlh
blob: 68ca360166d11951358c0757739b832ce3fc836c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* 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