nwjs / nw.js

Call all Node.js modules directly from DOM/WebWorker and enable a new way of writing applications with all Web technologies.
https://nwjs.io
MIT License
40.22k stars 3.88k forks source link

Remove gamepad face button requirement (redundant security policy) #683

Open davey3000 opened 11 years ago

davey3000 commented 11 years ago

At present, input from non-face buttons on a connected gamepad are ignored until a face button is pressed. This security restriction seems unnecessary for windows that have access to Node.js, and could cause confusion to the user when they first start the application. I would like to suggest that this restriction be removed for windows that can access Node.js.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

davey3000 commented 11 years ago

I believe the required change in Chromium is to remove all references to ever_interacted_with_ from the files:

chromium/src/content/renderer/gamepad_shared_memory_reader.h chromium/src/content/renderer/gamepad_shared_memory_reader.cc

In particular, the section of code that implements the "press face button to connect" security policy on gamepads appears to be the following code near the end of gamepad_shared_memory_reader.cc:

if (!ever_interacted_with_) {
  if (GamepadsHaveUserGesture(gamepads)) {
    ever_interacted_with_ = true;
  } else {
    // Clear the connected flag if the user hasn't interacted with any of the
    // gamepads to prevent fingerprinting. The actual data is not cleared.
    // WebKit will only copy out data into the JS buffers for connected
    // gamepads so this is sufficient.
    for (unsigned i = 0; i < WebKit::WebGamepads::itemsLengthCap; i++)
      gamepads.items[i].connected = false;
  }
}

Note that this is untested.

bored-engineer commented 10 years ago

Is this issue dead? I would still like to see this merged, or at least a response as to why not.

ghost commented 10 years ago

ditto, I would like to see the face button press requirement removed too otherwise, does anyone know of a way to tell chromium a face button has been pressed via node if a gamepad is detected as being physically connected to the PC? therefore bypassing the required user interaction to press a face button everytime they start my app...

skaughtx0r commented 9 years ago

I'd like to see this issue resolved also as we had problems on a device that has joystick axes, but no buttons, so the gamepad is never activated.

gavrochelegnou commented 9 years ago

Hi, This would be a great feature for me too. I currently have to code and display a message saying "please click a button before moving" in my app where clicking a button should be the last action (a validation) and not the first ...

gavrochelegnou commented 9 years ago

For the record you could star and comment this issue in chromium to have a flag or permission to allow gamepad detection without user interaction.

ghost commented 8 years ago

The Chromium status says "WontFix", so will this not be resolved?

I also encountered the issue with RPG Maker MV, which now uses NW.js for the games. I kept pressing the directional buttons and nothing happened until I pressed a face button.