summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon
AgeCommit message (Collapse)Author
2023-12-12Merge pull request #12399 from lioncash/erasingTilka
General: Make use of std::erase_if/std::erase where applicable
2023-12-12ExpressionParser: Avoid some miscellaneous copiesLioncash
Just some trivial copies that can be eliminated or turned into moves.
2023-12-12ExpressionParser: Mark constructors explicit where applicableLioncash
Makes for consistency with the surrounding code.
2023-12-12ExpressionParser: Pass control qualifiers by const referenceLioncash
These aren't necessarily cheap to copy, since a control qualifier will have around 3 std::strings inside of it, so passing by value can churn allocations a little bit.
2023-12-12ExpressionParser: Make use of std::erase_ifLioncash
2023-12-12MappingCommon: Make use of std::erase_ifLioncash
2023-11-28Merge pull request #12215 from JosJuice/android-si-devicesMai
Android: Add more GameCube controller types
2023-11-10SDL: Add default case to switch statementDentomologist
Fix -WSwitch warning about unhandled enum value SDL_NUM_LOG_PRIORITIES. log_level is initialized to LNOTICE right before the switch statement so this doesn't cause any behavior changes.
2023-10-26ControllerInterface/SDL: Remove Xbox 360 controller disabling hack.Jordan Woyak
2023-10-01Android: Get profile name from coreJosJuice
To avoid duplicating information between Kotlin and C++.
2023-09-28Merge pull request #12172 from ArcaneNibble/sdAdmiral H. Curtiss
Steam Deck: Periodically reenable gyro
2023-09-21fmt 10.0.0-10.1.1 compile fixesget
Implicit conversion operators and enums was removed for parity with std::format (https://github.com/fmtlib/fmt/commit/fce74caa15b24cbc0fcafe4706692cb06cb0b815).
2023-09-07Steam Deck: Periodically reenable gyroR
2023-08-26Merge pull request #12117 from JosJuice/config-callback-cpuAdmiral H. Curtiss
Don't call RunAsCPUThread in config callbacks
2023-08-18Merge pull request #12083 from JosJuice/android-controlled-by-gamepadAdmiral H. Curtiss
InputConfig: Update IsControllerControlledByGamepadDevice for Android input overhaul
2023-08-17Use structs for config callback IDsJosJuice
This way you can't mix up regular config callback IDs and CPU thread config callback IDs. (It would be rather bad if you did!)
2023-08-15Merge pull request #12109 from JosJuice/android-adddevice-nullAdmiral H. Curtiss
ControllerInterface/Android: Add null check to AddDevice
2023-08-15ControllerInterface/Android: Add null check to AddDeviceJosJuice
The Google Play Console is showing some users getting a crash here, and indeed, InputDevice.getDevice can return null.
2023-08-12GCAdapter: Fix Android unused constant warningDentomologist
CONTROLLER_OUTPUT_INIT_PAYLOAD_SIZE is only used by the libusb implementation.
2023-08-12GCAdapter: Fix spelling of constantsDentomologist
2023-08-01InputConfig: Update IsControllerControlledByGamepadDevice for Android input ↵JosJuice
overhaul This only matters for analytics, but still.
2023-07-05Switch libusb_config_descriptor to RAII typenyanpasu64
2023-07-05Workaround GC adapter detection breaking when reset failsnyanpasu64
2023-07-05Reset GC adapter upon IO error after sleep-wakenyanpasu64
Fixes GC adapter breaking on sleep-wake on Linux and burning a full CPU core. This is cleaner than alternative approaches.
2023-07-05Don't burn a CPU core and spam logs when GC Adapter failsnyanpasu64
2023-07-05Fix memory leak in libusb codenyanpasu64
2023-06-30Merge pull request #11955 from TellowKrinkle/CMakeDependenciesAdmiral H. Curtiss
CMake: Allow ignoring system packages
2023-06-19Merge pull request #11972 from Minty-Meeo/string-improvements-part-1cAdmiral H. Curtiss
Replace std::ostringstream usage with fmt::format
2023-06-18Replace std::ostringstream usage with fmt::formatget
2023-06-17DITConfiguration: Use File::ReadFileToStringget
2023-06-15CMake: Use targets for all optionally-external dependenciesTellowKrinkle
2023-06-12ControllerEmu: Convert Translatability to enum classDentomologist
2023-06-08Merge pull request #11681 from iwubcode/asset_managementAdmiral H. Curtiss
VideoCommon: migrate texture packs to use the asset loader system
2023-06-08Merge pull request #11902 from Minty-Meeo/regex-best-practicesAdmiral H. Curtiss
static const std::regex
2023-06-08Prefer static const std::regexget
std::regex has a relatively expensive constructor, and these are unchanging regexes.
2023-06-07InputCommon / VideoCommon: remove dynamic input reloading the texture cache, ↵iwubcode
this is no longer needed, assets reload automatically!
2023-06-06InputCommon: Don't treat two analog inputs as a spurious trigger comboJosJuice
I've received a report from an Android user with a gamepad (a "BSP-D3") where one physical trigger is controlling two analog axes at the same time. This was causing RemoveSpuriousTriggerCombinations to delete both axes, which is clearly not a desireable outcome. With this change, now the axis with the greatest smoothness is kept, or both in case they have the same smoothness.
2023-06-06Merge pull request #11762 from jbosboom/xinput2-raw-event-queryAdmiral H. Curtiss
Xinput2: use raw events and queries
2023-05-29Merge pull request #11819 from JosJuice/android-input-device-nullAdmiral H. Curtiss
ControllerInterface/Android: Use InputEvent.getDeviceId
2023-05-19XInput2: Listen to master devices onlyJeffrey Bosboom
A comment removed by this commit gives two reasons for listening to slave devices, both of which no longer apply: - "Only slaves emit raw motion events": perhaps this was true when the comment was written, but now master devices provide raw motion events along with the other raw events. - "Selecting slave keyboards avoids dealing with key focus": we get raw key events regardless of the focus. Listening to both master and slave devices results in duplicate raw events. For button and key events, that's a tiny waste of time setting the update flag a second time, but for raw mouse events the raw motion will be processed twice. That makes this commit a user-facing change.
2023-05-19XInput2: Use raw events and queries for buttons and keysJeffrey Bosboom
In X, the ButtonPress events generated when a mouse button is pressed have a special property: if they don't activate an existing passive grab, the X server automatically activates the "implicit passive grab" on behalf of the client the event is delivered to. This ensures the ButtonRelease event is delivered to the same client even if the pointer moves between windows, but it also causes all events from that pointer to be delivered exclusively to that client. As a consequence of the implicit passive grab, for each window, only one client can listen for ButtonPress events; any further listeners would never receive the event. XInput 1 made the implicit grab optional and explicit by allowing clients to listen for DeviceButtonPress events without DeviceButtonPressGrab events. XInput 2 does not have a separate grab event class, but multiple clients can listen for XI_ButtonPress on the same window. When a button is pressed, the X server first tries to deliver an XI_ButtonPress event; if no clients want it, then the server tries to deliver a DeviceButtonPress event; if no clients want it, then the server tries to deliver a ButtonPress event. Once an event has been delivered, event processing stops and earlier protocol levels are not considered. The reason for this rule is not obviously documented, but it is probably because of the implicit passive grab; a client receiving a ButtonPress event assumes it is the only client receiving that event, and later protocols maintain that property for backward compatibility. Before this commit, Dolphin listened for XI_ButtonPress events on the root window. This interferes with window managers that expect to receive ButtonPress events on the root window, such as awesome and Openbox. In Openbox, applications are often launched from a menu activated by clicking on the root window, and desktops are switched by scroll wheel input on the root window. This makes normal use of other applications difficult when Dolphin is open (though Openbox keyboard shortcuts still work). Conversely, Dolphin only receives XI_ButtonPress events for clicks on the root window or window decorations (title bars), not on Dolphin's windows' content or the render window. In window managers that use a "virtual root window" covering the actual root window, such as Mutter running in X, Dolphin and the window manager do not conflict, but clicks delivered to other applications using XInput2 (for testing, try xinput --test-xi2) are not seen by Dolphin, which is relevant when background input is enabled. This commit changes Dolphin to listen for XI_RawButtonPress (and the raw versions of other events); Dolphin was already listening to XI_RawMotion for raw mouse movement. Raw events are always and exclusively delivered to the root window and are delivered to every client listening for them, so Dolphin will not interfere with (or be interfered with by) other applications listening for events. As part of being raw, button numbers and keycodes in raw events have not had mapping applied. If a left-handed user swapped the left and right buttons on their mouse, raw events do not reflect that. It is possible to query the mappings for each device and apply them manually, but that would require a fair amount of code, including listening for mapping changes. Instead, Dolphin now uses the events only to set a "changed" flag, then queries the current button and key state after processing all events. Dolphin was already querying the pointer to get its absolute position and querying the keyboard to filter the key bitmap it created from events; now Dolphin also uses the button state from the pointer query and uses the keyboard query directly. Queries have a performance cost because they are synchronous requests to the X server (Dolphin waits for the result). Commit 2b640a4f made the pointer query conditional on receiving a motion event to "cut down on round trips", but commit bbb12a75 added an unconditional keyboard query, and there have apparently been no performance complaints. This commit queries the pointer slightly more often (on button events in addition to motion), but only queries the keyboard after key events, so the total rate of queries should be substantially reduced. Fixes: https://bugs.dolphin-emu.org/issues/10668
2023-05-19XInput2: Request XInput 2.1Jeffrey Bosboom
We need XInput 2.1 to get raw events on the root window even while another client has a grab. We currently use raw events for relative mouse input, and upcoming commits will use raw events for buttons and keys.
2023-05-19XInput2: Make button state a u32Jeffrey Bosboom
Because we care how many bits it has, not its arithmetic range. No functional change on all supported platforms.
2023-05-19Merge pull request #11739 from OatmealDome/iokit-be-goneAdmiral H. Curtiss
InputCommon: Remove OSX (IOKit) input backend
2023-05-19Merge pull request #11758 from jbosboom/xinput2-client-pointerAdmiral H. Curtiss
XInput2: Accept input from keyboards other than the first master
2023-05-16StringUtil: Move IsAlpha() into Common namespaceLioncash
2023-05-10Support Steam Deck controls directly through hidrawR
This reads Steam Deck controls bypassing Steam Input. This allows for access to motion controls as well as independent access to thumb sticks, trackpads, and back grip buttons.
2023-05-07ControllerInterface/Android: Add some missing DeleteLocalRef callsJosJuice
2023-05-07ControllerInterface/Android: Use InputEvent.getDeviceIdJosJuice
Instead of InputEvent.getDevice followed by InputDevice.getId. Should hopefully fix https://bugs.dolphin-emu.org/issues/13237, while also being simpler.
2023-04-14Merge pull request #11756 from lioncash/iniAdmiral H. Curtiss
Common/IniFile: Move interface into Common namespace