Index: ppapi/shared_impl/ppb_gamepad_shared.cc |
diff --git a/ppapi/shared_impl/ppb_gamepad_shared.cc b/ppapi/shared_impl/ppb_gamepad_shared.cc |
index 41c7668ebb1c62fda45cffd0acfcf848de3fe334..f8868410c3e7cb585fc758d2050f58e7ca4760e8 100644 |
--- a/ppapi/shared_impl/ppb_gamepad_shared.cc |
+++ b/ppapi/shared_impl/ppb_gamepad_shared.cc |
@@ -20,16 +20,17 @@ void ConvertWebKitGamepadData(const WebKitGamepads& webkit_data, |
id_size_does_not_match); |
COMPILE_ASSERT(sizeof(output_pad.axes) == sizeof(webkit_pad.axes), |
axes_size_does_not_match); |
- COMPILE_ASSERT(sizeof(output_pad.buttons) == sizeof(webkit_pad.buttons), |
- buttons_size_does_not_match); |
memcpy(output_pad.id, webkit_pad.id, sizeof(output_pad.id)); |
output_pad.timestamp = webkit_pad.timestamp; |
output_pad.axes_length = webkit_pad.axes_length; |
memcpy(output_pad.axes, webkit_pad.axes, sizeof(output_pad.axes)); |
output_pad.buttons_length = webkit_pad.buttons_length; |
- memcpy(output_pad.buttons, |
- webkit_pad.buttons, |
- sizeof(output_pad.buttons)); |
+ // Can't memcpy because buttons are different types |
+ for (unsigned j = 0; j < webkit_pad.buttons_length; ++j) { |
+ output_pad.buttons[j].value = webkit_pad.buttons[j]; |
+ output_pad.buttons[j].pressed = webkit_pad.buttons[j] >= 0.1f ? |
scottmg
2014/02/18 23:45:26
I think the deadzoning/threshold should happen in
bajones
2014/02/18 23:54:04
Fair enough. That will require a few more #ifdef g
|
+ PP_TRUE : PP_FALSE; |
+ } |
} |
} |
} |