Commit Graph

2422 Commits

Author SHA1 Message Date
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
marwen.azouzi
5e9bb60d68 Fixes the following compilation error
error: implicit conversion from 'size_t' (aka 'unsigned long') to 'CGFloat' (aka 'double') may lose precision [-Werror,-Wimplicit-int-float-conversion]
2022-12-29 14:56:52 +01:00
kimci86
f0b44937ce Update Image documentation regarding supported input formats 2022-12-29 00:08:52 +01:00
kimci86
3649fceb8b Update stb_image to v2.27 and stb_image_write to v1.16 2022-12-29 00:08:52 +01:00
dan
3ae6848727 Update x11 sf::Cursor::Hand to use xc_hand2 instead of xc_hand1, in order to be consistent with windows and macos 2022-12-27 11:32:23 +01:00
kimci86
37db7a83f3 Update Catch to v1.12.2 with latest bugfixes
It solves compilation errors with GCC 11.3 on Ubuntu 22.04
2022-12-22 08:37:50 -07:00
zakinadhif
253a4abad4 Replace c-style casts & fix implicit conversion warnings. SFML/SFML#2297 2022-12-15 13:12:56 -07:00
Chris Thrasher
ed6d944810 Always trigger drmModeSetCrtc 2022-12-13 21:52:42 -07:00
Chris Thrasher
866dbee8cb Add DRM utilities to sfml-window 2022-12-13 21:52:42 -07:00
Chris Thrasher
07bf6f8c12 Add option for enabling DRM 2022-12-13 21:52:42 -07:00
Chris Thrasher
75b0c3a9a1 Disable warnings as errors for Clang on Windows 2022-12-12 12:09:51 -07:00
Chris Thrasher
fa2e61b9d5 Lock CI jobs to Ubuntu 20
Recently GitHub updated the ubuntu-latest images to point at Ubuntu
22 which broke CI for ths 2.6.x branch so let's stick to Ubuntu 20
until we can sort out what was failing.
2022-12-12 12:09:51 -07:00
Bruno Van de Velde
c744369552 Use Per Monitor Aware instead of System Aware for DPI scaling on Windows 2022-11-15 22:38:52 +01:00
kimci86
0310b03aef Document that checking XButton1 and XButton2 state on X11 is not supported 2022-11-15 22:36:37 +01:00
Chris Thrasher
c1064bae92 Lock 2.6.x branch to macOS 11 images
The macos-latest image recently upgraded to macOS 12. This includes
the iOS 16 SDK which deprecates some features which we're using. The
short term fix is to just keep using macOS 11 for 2.6.x.
2022-10-25 18:18:46 +02:00
kimci86
f796205a21 Process events in order to avoid X11 input method being confused 2022-10-24 23:14:48 +02:00
kimci86
b11328f386 Fix duplicated KeyPressed events with X11
Co-authored-by: Edgaru089 <sjs333@outlook.com>
2022-10-24 23:14:48 +02:00
Subs
65ef0619c8 [DRM] Use the current resolution
In order to prevent an unnecessary modeswitch and use the current TTY resolution, don't use the preferred mode reported by DRM. This is useful for people who set a custom resolution at boot and are forced into the monitor's preferred resolution when a SFML DRM app starts
2022-10-24 00:16:32 +02:00
Subs
1d12c56332 [DRM] Use a GFX card with connected monitors 2022-10-20 00:19:30 +02:00
Radek Dutkiewicz
2503b00299 Fix compile on linux with gcc 12.2.0
Undefined NUL
2022-10-11 15:30:23 +02:00
kimci86
d0cf86d516 Fix minor inconsistency in type cast in voip example
because m_samples is a vector of Int16 values.
2022-10-01 19:51:48 +02:00
kimci86
01fc55ba37 Include InputStream.hpp directly in SoundFileReaderMp3.cpp
instead of indirect inclusion through MemoryInputStream.hpp
2022-10-01 19:50:57 +02:00
kimci86
3acd9620eb Fix SoundRecorder example code 2022-10-01 11:15:02 -06:00
kimci86
b5be18cd8d Fix typo in variable name 2022-10-01 11:09:09 -06:00