Commit Graph

3596 Commits

Author SHA1 Message Date
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
Chris Thrasher
b2e918bafc Simplify how test runner command is created 2023-01-18 16:06:00 -07:00
Chris Thrasher
88d40412d7 Enable all modernize- checks by default 2023-01-18 08:03:10 -07:00
Chris Thrasher
18e8d339e2 Add clang-tidy modernize-use-transparent-functors check 2023-01-18 08:03:10 -07:00
Chris Thrasher
a9bc4aa576 Add clang-tidy modernize-use-override check 2023-01-18 08:03:10 -07:00
Chris Thrasher
8a5b206bb8 Add clang-tidy modernize-use-default-member-init check 2023-01-18 08:03:10 -07:00
Chris Thrasher
d202f753ed Add clang-tidy modernize-deprecated-headers check 2023-01-18 08:03:10 -07:00
Chris Thrasher
8c3f07de80 Add clang-tidy modernize-loop-convert check 2023-01-18 08:03:10 -07:00
Chris Thrasher
8dc28909d3 Add clang-tidy portability checks 2023-01-16 15:16:46 -07:00
Norm Evangelista
3745ea2336 Added readability-container-size-empty, readability-isolate-declaration
FIxed Windows escapes for readability-* checks


Fixed Linux DRM readability-isolate-declaration escape


Fixed typo in fix :-|


Fixed clang-format issue
2023-01-16 21:45:33 +01:00
Norm Evangelista
a4bca20567 Added modernize-use-equals-default, modernize-use-equals-delete
Fixed formatting issues per review


Implemented copy constructor since operator= is implemented


Reverted operator=, add NOLINT for copy constructor per review


Fixed clang-tidy escape in examples


Fixed OSX clang-tidy escapes
2023-01-14 18:12:18 -07:00
Chris Thrasher
f0119145c2 Fix Windows clang-tidy errors 2023-01-14 15:13:02 -07:00
Chris Thrasher
cab0e75503 Run clang-tidy on Windows in CI
Co-authored-by: Bambo-Borris <canyoufeelit4@gmail.com>
2023-01-14 15:13:02 -07:00
Chris Thrasher
ab34b9f9bf Invoke run-clang-tidy with Python executable
This is required since Windows can't support she-bang scripts like
macOS and Linux were taking advantange of. This is more verbose but
ultimately the same as before.
2023-01-14 15:13:02 -07:00
Chris Thrasher
c5c6276291 Ensure clang-tidy uses color output 2023-01-14 15:13:02 -07:00
Chris Thrasher
0e8072e6cd Hide examples, tests, and documentation from projects consuming SFML via add_subdirectory 2023-01-13 14:28:09 -07:00
Chris Thrasher
8b7429b9c0 Analyze DRM backend 2023-01-13 14:16:25 -07:00
Nikita
1f0167192b
Update to year 2023 2023-01-12 11:38:41 +01:00
Norm Evangelista
39dd630f07 Added modernize-use-nullptr check
Addressed review comments


Fixed Vulkan.cpp clang-tidy issues


Used default-constructed objects instead of 0


More fun with OSX clang-tidy


Try casting a nullptr to see if clang-tidy can live with it


Revert "Try casting a nullptr to see if clang-tidy can live with it"

This reverts commit e217a1d8be45e3fd27dc73e1c7043be921d3830b.

Restored deleted line
2023-01-11 17:36:16 -07:00
Chris Thrasher
badb388507 Remove unnecessary casts 2023-01-11 15:30:22 -07:00
Jim-Marsden
b2009e2fca Changed from std::scoped_lock to std::lock_guard 2023-01-11 15:07:29 -07:00