Commit Graph

123 Commits

Author SHA1 Message Date
31f7d68ef4 Popup: Reset state on visibility change
The original logic was never called for certain platforms, leaving the
hide reason unset and causing weird semi-random issues with the few
users of that internal API, such as when renaming nodes in the scene
tree editor.
2025-08-24 10:37:12 +02:00
7b47f5e8db [Accessibility] Process non-focusable windows (popups, menus) as part of the parent window tree. 2025-08-17 12:15:08 +03:00
8ba4656ea3 Compile out editor-only logic within validate_property in games 2025-06-12 12:54:19 +08:00
1d33693e0d Add missing TRANSLATION_CHANGED notifications. 2025-05-26 07:52:07 +03:00
408de3c970 Wayland: Fix window fitting in single-window mode
We disabled window fitting in multi-window mode as it was broken due to
the limited data but it should still be enabled for embedded windows.
2025-05-21 00:58:41 +02: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
147b8415b1 Fix shadow offset larger than shadow size in PopupMenu and PopupPanel.
Panel shadow offsets larger than shadow size should no longer place the
panel edges outside its window.
2025-04-10 12:31:06 +01:00
e6a61b1ecc Merge pull request #76829 from bruvzg/ac_kit_direct
Implement screen reader support using AccessKit library.
2025-04-08 12:32:47 -05:00
b106dfd4f9 Base accessibility API. 2025-04-08 20:14:28 +03:00
f37fb49739 Add separate minimize_disabled and maximize_disabled window flags. 2025-04-07 18:58:11 +03:00
84d3adcf2f Wayland: Implement native sub-windows
The backend is now mature enough to not explode with multiple windows
but the `DisplayServer` API still cannot meet some guarantees required
by the various Wayland protocols we use. To meet those guarantees this
patch adds three new elements to the DisplayServer API, with relative
handling logic for `Window` and `Popup` nodes:

 - `WINDOW_EVENT_FORCE_CLOSE`, which tells a window to *forcefully*
close itself and ensure a proper cleanup of its references, as Wayland
enforces this behavior;

 - `WINDOW_FLAG_POPUP_WM_HINT`, which explicitly declares a window as a
"popup", as Wayland enforces this distinction and heuristics are not
reliable enough;

 - `FEATURE_SELF_FITTING_WINDOWS`, which signals that the compositor can
fit windows to the screen automatically and that nodes should not do
that themselves.

Given the size of this feature, this patch also includes various
`WaylandThread` reworks and fixes including:

 - Improvements to frame wait logic, with fixes to various stalls and a
configurable (through a `#define`) timeout amount;

 - A proper implementation of `window_can_draw`;

 - Complete overhaul of pointer and tablet handling. Now everything is
always accumulated and handled only on each respective `frame` event.
This makes their logic simpler and more robust.

 - Better handling of pointer leaving and pointer enter/exit event
sending;

 - Keyboard focus tracking;

 - More solid window references using IDs instead of raw pointers as
windows can be deleted at any time;

 - More aggressive messaging to window nodes to enforce rects imposed by
the compositor.
2025-04-04 20:23:25 +02:00
10f6c01b9c Remove ABS in favor of Math::abs 2025-03-19 13:52:40 +01:00
a32d3663c4 Fix popup shadows misbehaving with content_scale_factor 2025-02-10 11:55:08 -03:00
5c63646e87 Change print warnings to config ones for popups that need transparency 2025-01-09 15:59:56 -03:00
f7f6432af6 Make PopupMenu/Panel shadows properly visible again 2024-12-02 14:20:58 -03:00
926afccbd8 [Scene] Add SceneStringNames::panel 2024-05-30 22:54:50 +02:00
7d4d63b807 Fix Tree and FileSystemList edit popup double events and ESC behavior. 2024-05-17 10:03:52 +03:00
413c11357d Use Core/Scene stringnames consistently 2024-05-13 23:41:07 +02:00
eb2bd41fb8 Make handling of rename line-edit popups more robust 2024-05-07 14:29:35 +02:00
3a88373a4c Merge pull request #86553 from Koyper/fix_popup_panel_content_scaling
Fix non-embedded tooltips, popups and dialogs resizing to match Viewport content scale factors != 1.0
2024-04-18 12:24:11 +02:00
0881c81c13 Fix non-embedded Windows resizing to match Viewport content scale factor 2024-04-17 09:30:16 -05:00
7c75355541 Remove Popup's unused "panel" style 2024-04-13 15:18:12 -03:00
79ba22a73f Use Vector* component-wise min/max/clamp functions where applicable 2024-03-20 13:47:42 +01:00
0e8f90f4c8 Update deferred calls to use Callables 2024-01-09 16:11:47 +01:00
fa02d19fd1 Fix internal events not being delivered to some Window types
`AcceptDialog`, `Popup` and `PopupMenu` no longer subscribe to
"window_input" signal, because that is only sent if it is not an
internal signal.

Instead they receive events in `_input_from_window`. They ensure that
the event is also propagated to their super-function, just like
previously the signals would be treated.
2023-11-14 20:29:17 +01:00
2924bfd4d3 Register theme properties with ThemeDB 2023-09-11 13:45:23 +02:00
f0927250ca Support controller input on popup/dialogs 2023-08-13 17:32:08 +01:00
4c5c7cbb58 Fix auto-reparenting logic in the ProgressDialog
* Make sure `Popup` signals are disconnected when unparented.
* Remove a fail condition from `Window::is_embedded` when
not in tree.
2023-05-29 17:02:16 +02:00
8ab2cf3d2d Use defined key mapping for closing popups and dialogs
As opposed to hardcoding the escape key. Also removed such hardcoding in a few other places as well as a hardcoded enter key in one of the affected input fields.
2023-05-20 17:39:59 -07:00
39b69e6f76 [Editor] Fix editor progress dialog auto closing on ESC press, and on application focus loss. 2023-02-14 09:23:40 +02:00
615c517034 Use range iterators in LocalVector loops 2023-01-21 18:44:42 +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
2e1fcbe14b Prevent Popups it the edited scene tree from closing on focus loss. Hide irrelevant Popup flags from the editor inspector. 2022-10-11 08:55:00 +03:00
0103af1ddd Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
15fd025f90 Add dumb and manual theme caching systems to Window 2022-09-01 16:05:02 +03:00
fd6453c45e Revert "Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED"
This reverts commit 4b817a565c.

Fixes #64988.
Fixes #64997.

This caused several regressions (#64988, #64997,
https://github.com/godotengine/godot/issues/64997#issuecomment-1229970605)
which point at a flaw in the current logic:

- `Control::NOTIFICATION_ENTER_TREE` triggers a *deferred* notification with
  `NOTIFCATION_THEME_CHANGED` as introduced in #62845.
- Some classes use their `THEME_CHANGED` to cache theme items in
  member variables (e.g. `style_normal`, etc.), and use those member
  variables in `ENTER_TREE`, `READY`, `DRAW`, etc. Since the `THEME_CHANGE`
  notification is now deferred, they end up accessing invalid state and this
  can lead to not applying theme properly (e.g. for EditorHelp) or crashing
  (e.g. for EditorLog or CodeEdit).

So we need to go back to the drawing board and see if `THEME_CHANGED` can be
called earlier so that the previous logic still works?

Or can we refactor all engine code to make sure that:
- `ENTER_TREE` and similar do not depend on theme properties cached in member
  variables.
- Or `THEME_CHANGE` does trigger a general UI update to make sure that any
  bad theme handling in `ENTER_TREE` and co. gets fixed when `THEME_CHANGE`
  does arrive for the first time. But that means having a temporary invalid
  (and possibly still crashing) state, and doing some computations twice
  which might be heavy (e.g. `EditorHelp::_update_doc()`).
2022-08-29 11:11:29 +02:00
4b817a565c Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED 2022-08-27 11:52:29 -06:00
f7269fe878 Single-window mode popups and edited scene windows fixes.
Fix single-window mode popup not closing when OptionBox is clicked.
Fix single-window mode submenus closing when parent menu item, that was used to open it is clicked (using same safe-area logic as platform specific code).
Disallow windows that are part of an edited scene from being set as exclusive or popup to prevent it from locking up the editor.
2022-06-13 09:56:08 +03:00
47d0dc8a41 popup deferred hide suppressed if reopened
popup no longer tries to close itself a second time
popup no longer closes after having been reopened
fixed bug in RenameDialog not calling base (by inspection)
fixes #59181
fixes #60921
reverts #59287
2022-05-13 09:30:00 -04:00
7d44bb8f06 Remove set_as_minsize() 2022-03-06 00:57:42 +01:00
74ff5921d6 Improve popup window handling.
Add window FLAG_POPUP and a platform specific routines to control popup auto-hiding and event forwarding.
2022-02-25 09:33:27 +02:00
0f5455230c Use switch consistently in _notification (scene folder) 2022-02-15 18:44:55 +01:00
fc076ece3d Revert "Add missing SNAME macro optimization to all theme methods call"
This reverts commit a988fad9a0.

As discussed in #57725 and clarified in #57788, `SNAME` is not meant to be used
everywhere but only in critical code paths. For theme methods specifically, it
was by design that only getters use `SNAME` and not setters.
2022-02-08 10:17:25 +01:00
a988fad9a0 Add missing SNAME macro optimization to all theme methods call 2022-02-06 23:06:11 +01:00
fe52458154 Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
3c0fdcc8ac Use "enum class" for input enums 2021-11-12 15:37:54 -06:00
5869d053f9 Fix popup trying to emit a non existing signal when closed 2021-10-31 23:21:31 +01:00
88b347dc27 Merge pull request #51920 from jmb462/missing-sname-macro-optimization-in-some-functions 2021-09-23 13:14:20 +02:00
a913ae8d56 Add support for internal nodes 2021-08-28 02:07:23 +02:00
54de7114c5 Add missing SNAME macro optimization for StringName in some functions 2021-08-20 14:50:24 +02:00