Commit Graph

87 Commits

Author SHA1 Message Date
Markus Sauermann
916d480686 Fix InputEvent device id clash
`InputMap::ALL_DEVICES` and `InputEvent::DEVICE_ID_EMULATION` have the
same value `-1`.

Change value of `InputMap::All_DEVICES` so that it's different from
`InputEvent::DEVICE_ID_EMULATION`. `InputEvent::DEVICE_ID_EMULATION`
is part of the API and can't be changed without potentially breaking
projects.

Gather all special device constants in a single location inside
`InputEvent`.

Add a converter to project settings, that takes care of adjusting
project files during loading.
2024-10-20 21:56:41 +02:00
Micky
3ecf346f12 Allow JOY_AXIS_INVALID in InputEventJoypadMotion's axis 2024-09-16 12:12:27 +02:00
kobewi
17d3f26e5d Add event_index to InputEventAction 2024-05-30 12:51:15 +02:00
Hugo Locurcio
6818e50adc Expose DEVICE_ID_EMULATION constant in InputEvent
This also improves the documentation related to emulated InputEvents.
2024-03-16 19:16:40 +01:00
Markus Sauermann
2235a1cbd0 Add screen-related attributes to mouse input events 2024-02-05 23:30:15 +01:00
Mel Collins
8406e60522 Add InputEventKey.location to tell left from right
This adds a new enum `KeyLocation` and associated property
`InputEventKey.location`, which indicates the left/right location of key
events which may come from one of two physical keys, eg. Shift, Ctrl.

It also adds simulation of missing Shift KEYUP events for Windows.
When multiple Shifts are held down at the same time, Windows natively
only sends a KEYUP for the last one to be released.
2024-01-26 14:42:28 +01:00
kobewi
90a0b19301 Make InputEventShortcut always pressed 2023-09-23 19:43:07 +02:00
alcomposer
deaf6c3bb1
Context aware MIDI event printing 2023-08-28 12:42:15 +02:00
Hugo Locurcio
1621b4e2b1
Mention Xbox menu button by name in Start button description
Microsoft officially calls it the Menu button:

https://support.xbox.com/en-US/help/hardware-network/controller/get-to-know-your-xbox-series-x-s-controller
2023-06-26 09:41:54 +02:00
Rémi Verschelde
0b30785bca
Merge pull request #75438 from ronyeh/typo
Fix typo on "autoremapping".
2023-06-15 10:39:44 +02:00
Rémi Verschelde
f00c971b81
Merge pull request #63168 from Levrault/master
Fix: InputEventJoypadMotion should trigger only once on a vslider
2023-06-05 18:04:39 +02:00
Luc-Frédéric Langis
166ca77f20 feat(gamepad): improve gamepad behavior with slider and popup_menu 2023-06-05 10:20:46 -04:00
Rémi Verschelde
b0f49266f9
Merge pull request #76719 from m4gr3d/add_input_event_cancelled_state_main
Augment the `InputEvent` class with a `CANCELED` state
2023-05-17 11:25:21 +02:00
Fredia Huya-Kouadio
250749fa79 Augment the InputEvent class with a CANCELED state
The `InputEvent` class currently supports the `pressed` and `released` states, which given the binary nature, is represented by a `bool` field.
This commit introduced the `CANCELED` state, which signals that an ongoing input event has been canceled.
To represent all the states, the `InputEventState` enum is added and the `InputEvent` logic is refactored accordingly.
2023-05-15 11:48:25 -07:00
RedworkDE
8e7afec479 Fix various errors when running the unit tests
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2023-05-09 18:40:56 +02:00
bruvzg
a5009f4d3c
[Web] Detect host OS and use macOS keys on mac hosts. 2023-04-11 10:58:54 +03:00
Ron B. Yeh
40ae917db8 Fix typo on "autoremapping".
Update warning strings to be consistent with the rest of the code base, which uses "Command or Control".
2023-03-28 16:48:18 -07:00
Hakim
52de40310a Use physical shortcuts for freelook navigation in the editor 2023-02-21 10:56:14 +01:00
Haoyu Qiu
26581ca574 Add some missing translatable editor strings 2023-02-10 16:55:50 +08:00
Markus Sauermann
8748f4dcaa Fix mouse/drag/touch InputEvents having no device id
Some internally created emulated/instantiated events didn't have a
device id. This PR sets for these cases a device id.

Also rename `DEVICE_ID_TOUCH_MOUSE` to the more generic
`DEVICE_ID_EMULATION`.
2023-02-06 22:49:42 +01:00
Rémi Verschelde
e92393d295
Merge pull request #67783 from EricEzaM/67715-input-event-action-as-text
Make InputEventAction as_text() return the text of the first valid event for the action.
2023-01-27 10:30:00 +01:00
bruvzg
57b5d112f7
[Input] Do not add key labels to the default actions, to display it correctly in the UI. 2023-01-24 14:49:11 +02:00
bruvzg
daad4aed62
Cleanup and unify keyboard input.
- Unify keycode values (secondary label printed on a key), remove unused hardcoded Latin-1 codes.
- Unify IME behaviour, add inline composition string display on Windows and X11.
- Add key_label (localized label printed on a key) value to the key events, and allow mapping actions to the unshifted Unicode events.
- Add support for physical keyboard (Bluetooth or Sidecar) handling on iOS.
- Add support for media key handling on macOS.

Co-authored-by: Raul Santos <raulsntos@gmail.com>
2023-01-23 15:08:12 +02:00
Eric M
7b66806dd3 Make InputEventAction as_text() return the text of the first valid event for the action. 2023-01-12 00:10:44 +10:00
Juan Linietsky
2b815df3c1 Use BitField<> in core type masks
* All core types masks are now correctly marked as bitfields.
* The enum hacks in MouseButtonMask and many other types are gone. This ensures that binders to other languages non C++ can actually implement type safe bitmasks.
* Most bitmask operations replaced by functions in BitField<>
* Key is still a problem because its enum and mask at the same time. While it kind of works in C++, this most likely can't be implemented safely in other languages and will have to be changed at some point. Mostly left as-is.
* Documentation and API dump updated to reflect bitfields in core types.
2023-01-08 22:17:40 +01:00
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
bruvzg
223a612c0c
[iOS] Add Apple Pencil pressure and tilt support. 2022-12-23 23:44:10 +02:00
alcomposer
73db3b67df add controller_number & controller_value to allow printing of all MIDI event data 2022-11-14 21:55:43 +10:30
Fredia Huya-Kouadio
13e4770b97 Add double_tap attribute to InputEventScreenTouch
This provides parity with the `InputEventMouseButton` allowing for proper conversion between the two events.
2022-10-22 07:30:46 -07:00
bruvzg
0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
Rémi Verschelde
f3d763011f Merge pull request #63109 from OverloadedOrama/fix-input-event-action
Fix `InputEventAction`'s `is_match` method ignoring `exact_match` parameter
2022-09-25 11:06:38 +02:00
bruvzg
6f4d233062
Fix key mapping changes when moving from macOS to other platform
Removes separate `Command` key (use `Meta` instead).
Adds an event flag to automatically remap `Command` <-> `Control` (cannot be set alongside `Control` or `Meta`).
2022-09-07 18:45:35 +02:00
Yuri Sizov
1a24c9e14b Make _validate_property a multilevel method 2022-08-22 18:35:11 +03:00
Haoyu Qiu
e061b1cc3c Use %s for bool value in vformat 2022-08-07 09:57:09 +08:00
Emmanouil Papadeas
38b51942d6 Fix InputEventAction's is_action method ignoring exact_match parameter 2022-07-17 17:20:37 +03:00
Hansem Ro
6dcc9d1131 [macOS, Windows, X11] Add stylus inverted/eraser support to
InputEventMouseMotion event
2022-07-04 10:36:53 -07:00
FireForge
4678736a39 Add suffixes to all nodes and resources 2022-06-11 09:41:05 -05:00
bruvzg
f851c4aa33
Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
Rémi Verschelde
7119d355eb String: Remove TTR and DTR defines in non-tools build
This ensures we don't use TTR in runtime code, as it's specifically meant
to source translations for the editor.
2022-03-28 20:26:35 +02:00
Marcel Admiraal
ea20049afc Ensure minimum modifiers are pressed when matching actions 2022-03-20 08:02:54 +00:00
Nathan Franke
8a0a3accee
simplify formatting scripts, add a clang-tidy script, and run clang-tidy 2022-01-29 04:41:03 -06:00
Nathan Franke
dc1c4cfbfa
Fix action exact match 2022-01-24 05:55:37 -06:00
Rémi Verschelde
46624388d4
Merge pull request #56322 from madmiraal/fix-42450 2022-01-11 11:33:59 +01:00
Rémi Verschelde
fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Marcel Admiraal
3105d9b1f3 Rename speed to velocity when it's a directional Vector 2021-12-29 15:35:26 +00:00
Nathan Franke
49403cbfa0
Replace String comparisons with "", String() to is_empty()
Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
2021-12-09 04:48:38 -06:00
Aaron Franke
3c0fdcc8ac
Use "enum class" for input enums 2021-11-12 15:37:54 -06:00
Rémi Verschelde
3b11e33a09
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 15:19:35 +02:00
bruvzg
a975682ef6 Fix handling multiple "physical key" events in the single input map action. 2021-10-19 22:19:41 +03:00
LATRio
41c1cfe28e InputEventJoypadMotion::set_axis - reject invalid axis 2021-09-30 19:32:21 +09:00