mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1014162 - Make Gamepad.mapping into an enum. r=smaug
This commit is contained in:
parent
fc83829a6e
commit
539dcae325
@ -6,6 +6,7 @@
|
||||
#define mozilla_dom_gamepad_Gamepad_h
|
||||
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/GamepadBinding.h"
|
||||
#include "mozilla/dom/GamepadButton.h"
|
||||
#include <stdint.h>
|
||||
#include "nsCOMPtr.h"
|
||||
@ -16,12 +17,6 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
enum GamepadMappingType
|
||||
{
|
||||
NoMapping = 0,
|
||||
StandardMapping = 1
|
||||
};
|
||||
|
||||
// Per spec:
|
||||
// https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#remapping
|
||||
const int kStandardGamepadButtons = 17;
|
||||
@ -70,13 +65,9 @@ public:
|
||||
aID = mID;
|
||||
}
|
||||
|
||||
void GetMapping(nsAString& aMapping) const
|
||||
GamepadMappingType Mapping()
|
||||
{
|
||||
if (mMapping == StandardMapping) {
|
||||
aMapping = NS_LITERAL_STRING("standard");
|
||||
} else {
|
||||
aMapping = NS_LITERAL_STRING("");
|
||||
}
|
||||
return mMapping;
|
||||
}
|
||||
|
||||
bool Connected() const
|
||||
|
@ -9,6 +9,11 @@ interface GamepadButton {
|
||||
readonly attribute double value;
|
||||
};
|
||||
|
||||
enum GamepadMappingType {
|
||||
"",
|
||||
"standard"
|
||||
};
|
||||
|
||||
[Pref="dom.gamepad.enabled"]
|
||||
interface Gamepad {
|
||||
/**
|
||||
@ -26,7 +31,7 @@ interface Gamepad {
|
||||
* The mapping in use for this device. The empty string
|
||||
* indicates that no mapping is in use.
|
||||
*/
|
||||
readonly attribute DOMString mapping;
|
||||
readonly attribute GamepadMappingType mapping;
|
||||
|
||||
/**
|
||||
* true if this gamepad is currently connected to the system.
|
||||
|
@ -171,7 +171,7 @@ DarwinGamepadService::DeviceAdded(IOHIDDeviceRef device)
|
||||
sprintf(buffer, "%x-%x-%s", vendorId, productId, product_name);
|
||||
nsRefPtr<GamepadService> service(GamepadService::GetService());
|
||||
mGamepads[slot].mSuperIndex = service->AddGamepad(buffer,
|
||||
mozilla::dom::NoMapping,
|
||||
mozilla::dom::GamepadMappingType::_empty,
|
||||
(int)mGamepads[slot].numButtons(),
|
||||
(int)mGamepads[slot].numAxes());
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ LinuxGamepadService::AddDevice(struct udev_device* dev)
|
||||
|
||||
nsRefPtr<GamepadService> service(GamepadService::GetService());
|
||||
gamepad.index = service->AddGamepad(gamepad.idstring,
|
||||
mozilla::dom::NoMapping,
|
||||
mozilla::dom::GamepadMappingType::_empty,
|
||||
gamepad.numButtons,
|
||||
gamepad.numAxes);
|
||||
|
||||
|
@ -479,7 +479,7 @@ WindowsGamepadService::ScanForXInputDevices()
|
||||
gamepad.numButtons = kStandardGamepadButtons;
|
||||
gamepad.numAxes = kStandardGamepadAxes;
|
||||
gamepad.id = gamepadsvc->AddGamepad("xinput",
|
||||
StandardMapping,
|
||||
GamepadMappingType::Standard,
|
||||
kStandardGamepadButtons,
|
||||
kStandardGamepadAxes);
|
||||
mGamepads.AppendElement(gamepad);
|
||||
@ -762,7 +762,7 @@ WindowsGamepadService::GetRawGamepad(HANDLE handle)
|
||||
}
|
||||
|
||||
gamepad.id = gamepadsvc->AddGamepad(gamepad_id,
|
||||
NoMapping,
|
||||
GamepadMappingType::_empty,
|
||||
gamepad.numButtons,
|
||||
gamepad.numAxes);
|
||||
mGamepads.AppendElement(gamepad);
|
||||
|
@ -601,7 +601,7 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
|
||||
if (svc) {
|
||||
if (curEvent->Action() == AndroidGeckoEvent::ACTION_GAMEPAD_ADDED) {
|
||||
int svc_id = svc->AddGamepad("android",
|
||||
mozilla::dom::StandardMapping,
|
||||
mozilla::dom::GamepadMappingType::Standard,
|
||||
mozilla::dom::kStandardGamepadButtons,
|
||||
mozilla::dom::kStandardGamepadAxes);
|
||||
mozilla::widget::android::GeckoAppShell::GamepadAdded(curEvent->ID(),
|
||||
|
Loading…
Reference in New Issue
Block a user