Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(767)

Unified Diff: content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc

Issue 165983005: Updating Gamepad API to match latest spec (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed typo in GamepadProviderTest Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/common.gypi ('k') | content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc
diff --git a/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc b/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc
index 63733b21a2cbd166846d478e12a3f988b628b0d7..a211bb67df1444114db0a83b5406b4b977e38cc1 100644
--- a/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc
+++ b/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc
@@ -191,6 +191,17 @@ void GamepadPlatformDataFetcherLinux::RefreshDevice(udev_device* dev) {
memset(pad.id, 0, sizeof(pad.id));
tmp16.copy(pad.id, arraysize(pad.id) - 1);
+ if (mapper) {
+ std::string mapping = "standard";
+ base::TruncateUTF8ToByteSize(mapping, WebGamepad::mappingLengthCap - 1,
+ &mapping);
+ tmp16 = base::UTF8ToUTF16(mapping);
+ memset(pad.mapping, 0, sizeof(pad.mapping));
+ tmp16.copy(pad.mapping, arraysize(pad.mapping) - 1);
+ } else {
+ pad.mapping[0] = 0;
+ }
+
pad.connected = true;
}
}
@@ -246,7 +257,8 @@ void GamepadPlatformDataFetcherLinux::ReadDeviceData(size_t index) {
} else if (event.type & JS_EVENT_BUTTON) {
if (item >= WebGamepad::buttonsLengthCap)
continue;
- pad.buttons[item] = event.value ? 1.0 : 0.0;
+ pad.buttons[item].pressed = event.value;
+ pad.buttons[item].value = event.value ? 1.0 : 0.0;
if (item >= pad.buttonsLength)
pad.buttonsLength = item + 1;
}
« no previous file with comments | « build/common.gypi ('k') | content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698