Commit Graph

2966 Commits

Author SHA1 Message Date
Chris Thrasher
0c418dce4d Use std::unordered_map 2023-01-25 10:06:03 -07:00
Chris Thrasher
9f08d67dcc Convert scancodes into a scoped enumeration 2023-01-25 10:06:03 -07:00
Chris Thrasher
17a8e9e2c2 Tweak formatting 2023-01-25 10:06:03 -07:00
Chris Thrasher
5ce82f3ef4 Fix copyright years 2023-01-25 10:06:03 -07:00
Chris Thrasher
77e429e6d7 Use std::map::emplace 2023-01-25 10:06:03 -07:00
Chris Thrasher
31d946baa0 Convert empty struct to namespace 2023-01-25 10:06:03 -07:00
Chris Thrasher
72cd8781bb Remove deprecated keycodes 2023-01-25 10:06:03 -07:00
Jim-Marsden
976bbda911 Drawable Test 2023-01-24 16:27:11 -07:00
Norm Evangelista
4c8b770992 Replaced anonymous enums with constexpr per #2328
Addressed review comments


Addressed review comments


Changed NOLINTBEGIN/END to NOLINTNEXTLINE


Addressed CI complaint


Fixed BSD CI issues
2023-01-24 16:15:16 -07:00
Chris Thrasher
8a307df494 Update copyright year 2023-01-24 08:46:30 +01:00
Shiv
ca5ca65004
Removed return EXIT_SUCCESS and cstdlib 2023-01-23 10:00:48 +01:00
Norm Evangelista
9b1b0f5b07 Streamlined readability-* clang-tidy checks
Addressed CI complaints

Addressed review comments, CI issues

Reverted files exempted from linting

Fixed missing comma

Fixed clang-format escape

Disabled spurious readability-non-const-parameter

Addressed review comment

Moved NOLINT inside namespace per review

Remove const from function argument decls


Fixed rebase and formatting issues


Fixed macOS CI issues
2023-01-22 17:00:25 -07:00
Chris Thrasher
b48f4b70a7 Export StreamDeleter symbols
We're unsure why this is necessary but it satisfies a linker error
2023-01-22 15:50:53 -07:00
Chris Thrasher
dd83189fae Enable move semantics for SoundFile types
Funny how the addition of a forward declaration resulted in
accidentally disabling move semantics for two types. We ought to
be careful that build time improvements don't have runtime
performance impacts.
2023-01-22 15:50:53 -07:00
Chris Thrasher
97adbfa8c7 Let compiler generate destructors
These destructors call a function that does nothing that the
destructors for each member already do so there's no value in calling
it.
2023-01-22 15:50:53 -07:00
Chris Thrasher
6ea07b810c Let compiler implicitly delete copy operations
Because this class is implemented with unique pointers, copy semantics
are implicitly deleted. This can be verified by the type trait tests
which continue to affirm that these types are noncopyable.
2023-01-22 15:50:53 -07:00
Lukas Dürrenberger
ea94c620c6
Merge branch 2.6.x into master 2023-01-22 19:29:25 +01:00
Lukas Dürrenberger
d9f8df9ca0 Merge branch '2.6.x' into master 2023-01-21 10:17:18 +01:00
Lukas Dürrenberger
e82d20c291 Change formatting and implement suggestions 2023-01-20 16:32:59 +01:00
kimci86
59a93ff737 Fix virtual code translation to text for dead keys on macOS 2023-01-20 16:32:59 +01:00
kimci86
752955c6f8 Rename Key::Tilde to Key::Grave 2023-01-20 16:32:59 +01:00
kimci86
722838d590 Generate key events for caps lock when the modifier state changes
This is not accurate because modifier state and key state are not the
same thing for caps lock, but at least some events are generated
instead of nothing.
2023-01-20 16:32:59 +01:00
kimci86
1cbd6e9d12 Revamp the macOS implementation of scancodes
- Describe keys in separate words when applicable on macOS
- Use "Option" instead of "Alt" to describe keys on macOS
- Filter key up events like key down events
- Use localize to generate keyboard events
  That is better than translating to text because several keys can
  generate the same text.
- Add fallback mapping for NumpadEnter
- Handle swapped virtual key codes with ISO keyboard
2023-01-20 16:32:59 +01:00
Lukas Dürrenberger
89ea3af65e Add mapping notification support for X11 2023-01-20 16:32:59 +01:00
kimci86
aba54925d8 Add initial dummy scancode implementation on Linux (DRM) 2023-01-20 16:32:59 +01:00
kimci86
a717ce66e1 Improve description for NumpadDivide 2023-01-20 16:32:59 +01:00
kimci86
b6606ad60a Fix missing description for NumpadMinus 2023-01-20 16:32:59 +01:00
kimci86
7cf6d72633 Avoid overwriting key to scancode mapping 2023-01-20 16:32:59 +01:00
kimci86
914ae374ff Silence clang warnings about Scancode enumeration 2023-01-20 16:32:59 +01:00
kimci86
b354f7f7ee Scancode renaming leftover 2023-01-20 16:32:59 +01:00
Lukas Dürrenberger
5dbe85bfec Use a nested struct instead of a prefix 2023-01-20 16:32:59 +01:00
kimci86
08d1095314 Make getKeyFromEvent more robust for Decimal (Numpad) 2023-01-20 16:32:59 +01:00
kimci86
1754f24609 Fix description for dead keys 2023-01-20 16:32:59 +01:00
kimci86
7f5e7205c4 Improve scancodeToKeycode mapping 2023-01-20 16:32:59 +01:00
kimci86
3d62999485 Make right Alt key work on X11 2023-01-20 16:32:59 +01:00
Lukas Dürrenberger
39b8d67262 Align and fix mappings and general logic
- Aligned mappings
  - ScanDash -> ScanHyphen
  - Numpad keys include Numpad
  - *Equals -> *Equal
  - Key 29/42 are Backslash
  - Key 45 is Non-US Backslash
  - Add additional media & more scancodes
  - Rename ScanAgain to ScanRedo
  - Rename ScanMute to ScanVolumeMute
  - Add the missing F-key mappings for macOS
  - Fix mapping in Windows code
  - Correctly handle numpad keys on Windows for isKeyPressed
- Refactorings
  - Use mapping for Linux from different key config
  - Refactor some mapping code
  - Fix map initialization
  - Layout independent keys also don't have unicode characters, so it
    makes more sense to translate them first and use unicode as fallback
  - Fix iteration limits on Windows
  - Consistently use 'Scancode' instead of 'ScanCode' everywhere
  - Use 'delocalize' instead of 'unlocalize'
  - Fix conversion warnings
  - Remove unused mapping function
  - Hide parameters for non-applicable iOS functions
- Update documentation
- Add Android InputImpl scancode function stubs
2023-01-20 16:32:59 +01:00
Elias Daler
5bf4982239 Align key mappings & refactorings
- Changed getDescription output: Alt -> Meta, System -> Super
- Correct initialization of mapping arrays
- Added "ReverseSolidus" support
- Swap ScanEnter and ScanReturn
  (ScanEnter = Numpad Enter, ScanReturn = Keyboard Enter)
- Better descriptions for some keys
  (e.g. "Shift (Left)" -> "Left Shift")
2023-01-20 16:32:59 +01:00
Elias Daler
95f19ff478 Refactor X11InputManager and align mappings
- getDescription implementation for X11
- Generate KeySym -> Unicode mapping, so we don't need
  to make fake events in getDescription now
- KeySym to sf::Keyboard::Key mapping
- Better names for keycode, sf::Scancode and sf::Key conversion functions
- X11InputManager doesn't need m_display now
- Move a lot of stuff into free functions
- X11InputManager now only has static members
- X11InputManager -> KeyboardImpl
- Removed redundant "sf::" where possible
- Moved some functions from sf::priv::anonymous to anonymous namespace.
- Added NullKeyCode constant for readability
2023-01-20 16:32:59 +01:00
Elias Daler
b62c0ed13f Store pointer to Display in X11InputManager 2023-01-20 16:32:59 +01:00
jonathan.r.paton@googlemail.com
a34d48c42d Initial Windows implementation 2023-01-20 16:32:59 +01:00
Marco Antognini
34197ba5b5 Add new API for scancodes 2023-01-20 16:32:59 +01:00
Lukas Dürrenberger
b191a0dc58 Use Scan prefix instead of 's'
Also use getDescription instead of localizedRepresentation
2023-01-20 16:32:59 +01:00
Marco Antognini
cabf1a3c34 Handle layout changes on macOS 2023-01-20 16:32:59 +01:00
Marco Antognini
e806048904 Add support of scancodes for macOS 2023-01-20 16:32:59 +01:00
Marco Antognini
75ef99e2ca Add new API for scancodes 2023-01-20 16:32:59 +01:00
Norm Evangelista
144b336c17 Added readability-redundant-*, readability-simplify-* checks
Fixed CI complaints


Restored comment for clarity
2023-01-20 08:31:25 -07:00
Norm Evangelista
6ef8e487cc Added readability-qualified-auto, -redundant-access-specifiers
Fixed clang-format escapes

Fixed OSX clang-tidy issues

Collapsed extraneous lines

Fixed clang-format escape
2023-01-19 15:53:40 -07:00
Chris Thrasher
84f56d0936 Add option for skipping tests that require an attached display 2023-01-18 16:06:00 -07:00
Chris Thrasher
b128fcd3df Add tests for sf::Texture 2023-01-18 16:06:00 -07:00
Chris Thrasher
9265607d79 Run Linux tests with dummy display
This lets us test certain classes like sf::Texture which will otherwise
fail if a display is not detected.
2023-01-18 16:06:00 -07:00