Commit Graph

171 Commits

Author SHA1 Message Date
19c47c5d99 Remove #include "scene/main/timer.h" from control.h 2025-10-05 14:41:06 +09:00
63409a91e0 Fix button down signal not emitting on first press after being disabled 2025-07-30 16:23:42 +02:00
360ee10a6e Make BaseButtons' shortcut feedback timers internal 2025-06-03 09:52:28 -04:00
f8f350a32a Add GLOBAL_GET cached macros.
GLOBAL_GET is an expensive operation which should not be used each frame / tick.
This PR adds macros which do a cheaper revision check, and only call the expensive GLOBAL_GET when project settings have changed.

Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
2025-04-30 15:08:50 +01:00
b106dfd4f9 Base accessibility API. 2025-04-08 20:14:28 +03:00
5fad891759 Fix menus and dropdowns requiring two clicks
Fixes some editor menus and option buttons requiring two clicks to open
by checking status.pressed_down_with_focus separately from other press
status flags. Makes all pressed statuses consistent on toggle buttons
with ACTION_MODE_BUTTON_PRESSED.
2025-01-08 10:07:37 -05:00
f99a465956 Merge pull request #81532 from wlsnmrk/button-focus-loss-event-fix
Fix `button_up` and `button_down` signals with focus changes or multiple inputs
2025-01-06 22:46:26 +01:00
a1846b27ea Improve use of Ref.is_null/valid
Use `is_null` over `!is_valid` and vice versa.
2024-12-23 16:35:02 -05:00
73d85f46c9 Remove unused headers in scene.
Co-authored-by: Thaddeus Crews <repiteo@outlook.com>

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2024-12-24 00:40:09 +08:00
3db9bdf8d8 Fix Button minimum size when disabled is toggled. 2024-10-07 15:21:24 +00:00
6a12fac44c Fix button up and down events with focus changes
Adds a flag to guard button_up and button_down events based on whether
button_down has been previously emitted. Buttons now emit button_up
signals if they have emitted button_down and subsequently lose focus,
do not emit button_up if they gain focus while ui_accept is still
pressed, and do not emit multiple up/down signals if multiple
ui_accept keys are pressed simultaneously.
2024-09-26 15:53:07 -04:00
6a7183119f Make _make_custom_tooltip receive raw tooltip for buttons with shortcut enabled 2024-09-26 08:05:10 +08:00
ac80ba71e2 Merge pull request #93500 from anniryynanen/multi-press
Improve button behavior when multiple mouse buttons are used at the same time
2024-09-16 13:34:15 +02:00
2033510a65 Improve button behavior when multiple mouse buttons are used at the same time
- To emit `pressed`, buttons require that the press was initiated while hovering.
- Controls can't grab focus from a mouse click if they're not hovered.
- Hovers are updated both before and after a handled mouse button event.
2024-09-15 19:06:10 +03:00
52889ab7ee [Scene] Add SceneStringName::toggled 2024-08-28 15:14:26 +03:00
ee79386f7b [Scene] Add SceneStringNames::pressed 2024-05-14 15:51:28 +02:00
413c11357d Use Core/Scene stringnames consistently 2024-05-13 23:41:07 +02:00
21f0529aa9 Revert "Update Node::get_configuration_warnings signature"
This reverts commit d3852deaa4.
2024-02-17 19:03:21 +01:00
d3852deaa4 Update Node::get_configuration_warnings signature 2024-02-08 23:05:20 +01:00
47d601b316 Fix BaseButton.shortcut_feedback's timer raises errors
when a button is removed from the scene tree
2023-10-25 14:47:25 +08:00
3d128f67a4 Rename button_pressed bindings to avoid shadowing 2023-07-05 18:38:18 +02:00
390aa2a565 Fix ButtonGroup unpressing
It was possible to unpress a button group that had `allow_unpress = false`
using shortcuts.
Adjust `BaseButton::shortcut_input` to use the same logic as
`BaseButton::on_action_event`.
2023-06-16 00:15:37 +02:00
d829b43ab5 Add option for ButtonGroups to be unpressed
Add an option for ButtonGroups to be unpressed

Apply suggestions from code review

Co-Authored-By: Tomek <kobewi4e@gmail.com>
Co-Authored-By: Yuri Rubinsky <chaosus89@gmail.com>
Co-Authored-By: kleonc <9283098+kleonc@users.noreply.github.com>
2023-04-20 17:09:39 -06:00
7d14c44025 Add more sections to Button and BaseButton 2023-01-25 15:39:02 +01:00
51777a2914 Fix constant editor redraw after shortcut
Introduced by me by mistake on #71328. Fixes #71652.
2023-01-21 10:54:45 +01:00
dd3a1b08a9 Button shortcuts no longer "press" the Button.
* Button shortcuts were treated as generic input events on buttons. This means that to activate a button shortcut you had to press and release.
* This logic is removed and now shortcuts always activate on press.
* This makes the editor feel more responsive and solves problems related to this behavior.

Fixes #45033 and possibly others.
2023-01-13 18:43:02 +01:00
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
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
e4e13a404d Add configuration warning when ButtonGroup is used with non-toggleable buttons
Also fix ambiguous documentation of ButtonGroup.
2022-12-22 06:59:47 +01:00
4e47324b3f Merge pull request #68097 from KoBeWi/no_signal🔕
Add `set_value_no_signal()` to Range
2022-11-04 10:48:47 +01:00
4aa1efb0fe Add set_value_no_signal() to Range 2022-10-31 23:59:01 +01:00
d846dd6e91 Make BaseButton Shortcut feedback togglable 2022-10-20 02:02:12 -04:00
2ffb609658 Merge pull request #66337 from EricEzaM/sprite-frames
Ensure control built-in shortcuts are matched exactly & add shortcuts for SpriteFrames editor
2022-10-13 15:24:39 +02:00
a3ed9e6f2c Move Shortcut Context to Control and ensure that shortcut_input adheres to contexts. Also ensure that controls with no context are only triggered AFTER nodes which do have a context. 2022-10-13 21:07:19 +10:00
7ab01450cf Fix MSVC warning C4702: unreachable code
Part of #66537.
2022-09-28 16:46:48 +02:00
2eda77c682 Ensure all checks of is_action in the editor which are for 'shortcut' use, check the action exactly. 2022-09-24 18:01:02 +10:00
a12c71fff1 Fix #66062: editing shortcut_context in inspector 2022-09-19 19:13:52 +02:00
e31bb5ffeb Rename CanvasItem.update() to queue_redraw()
Affects a lot of classes. Very thoroughly checked signal connections and deferred calls to this method, add_do_method/add_undo_method calls, and so on.

Also renames the internal `_update_callback()` to `_redraw_callback()` for consistency.

Just a few comments have also been changed to say "redraw".

In CPUParticles2D, there was a private variable with the same name. It has been renamed to `do_redraw`.
2022-08-29 14:59:47 +02:00
221344b9e2 Fix some corner cases in the Menu/OptionButton item auto-highlight 2022-08-28 01:15:03 -03:00
b7d2ba12c8 Merge pull request #64635 from YeldhamDev/menu_buttons_popup_fix
Make `Menu/OptionButton` item auto-highlight behave better
2022-08-24 19:07:25 +02:00
8be27dc59e Replace Array return types with TypedArray 2022-08-22 22:42:36 +02:00
1da50698fc Make Menu/OptionButton item auto-highlight behave better 2022-08-19 14:54:53 -03:00
900c676b02 Use range iterators for RBSet in most cases 2022-05-19 12:09:16 +02:00
746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
d1207a0504 [Input] Add extra shortcut_input input processing step to process Unicode character input with Alt / Ctrl modifiers, after processing of shortcuts. 2022-04-05 13:46:45 +03:00
be5116c4a4 Fix typo in BaseButton shortcut context methods 2022-03-07 22:36:12 +01:00
0f5455230c Use switch consistently in _notification (scene folder) 2022-02-15 18:44:55 +01:00
73e784de1e Remove get_focus_owner() from Control, replaced by get_viewport()->gui_get_focus_owner() 2022-02-03 11:59:32 +01:00
7c3003fcbe Improve some signal bindings to use specific Object subtypes 2022-01-28 15:35:40 +01:00
306b98638e Allow unsetting shortcut_context. 2022-01-25 14:17:45 +02:00