Commit Graph

250 Commits

Author SHA1 Message Date
Rémi Verschelde c951421c99
Merge pull request #90268 from RandomShaper/wtp_servers
Use WorkerThreadPool for Server threads (enhanced)
2024-04-15 10:12:00 +02:00
aaronp64 4ed51933f9 Fix Window.hide() crash when force_native changed
Moved force_native = p_force_native assignment to after is_visible() check, to prevent value from changing after window is shown.

Fixes #90609
2024-04-13 14:03:29 -04:00
Pedro J. Estébanez c28f5901c7 Polish interaction between windowing, input and rendering
- Adapt GL make/release API to the current architecture.
- Fix DisplayServer being locked while dispatching input (prevent deadlocks).
2024-04-10 18:47:42 +02:00
Markus Sauermann 945babc619 Prohibit execution of delayed input events by different means
In some cases it can happen, that the order of input events and
window events is not followed, when input buffering or input accumulation
is active.

The display server order `InputEvent` => window-event gets changed to
window-event => `InputEvent` which becomes problematic in certain
situations.

This PR makes sure, that the order is adhered to by flushing input events
before a window event is sent.
Previously this problem was mitigated by discarding these delayed events.
But this solution was problematic in the setting of android input events.
2024-03-27 20:58:15 +01:00
Rémi Verschelde d66539e485 Merge pull request #89673 from bruvzg/f_na_ed
Do not apply `force_native` to the edited scene windows.
2024-03-25 13:16:03 +01:00
A Thousand Ships 79ba22a73f
Use `Vector*` component-wise `min/max/clamp` functions where applicable 2024-03-20 13:47:42 +01:00
bruvzg 92d69da7a6
Do not apply "force_native" to the edited scene windows. 2024-03-19 12:39:50 +02:00
bruvzg cfdb968848
[Window] Allow to override viewport and project settings and force use of native window. 2024-03-04 23:06:27 +02:00
Rémi Verschelde 3ce9ae71fc
Merge pull request #84906 from /fix-some-defvals 2024-02-23 11:29:22 +01:00
Raul Santos 5ba92e5a57
Fix some DEFVALs to use the right type
- Use `StringName()` in DEFVAL for StringNames.
- Use `Variant()` in DEFVAL for Variants.
2024-02-23 01:50:18 +01:00
Michael Alexsander 584a6aeeb7
Revert "Fix `NOTIFICATION_WM_SIZE_CHANGED` firing if the size hasn't changed"
This reverts commit 957378a69e, reversing
changes made to 0d88840e81.
2024-02-21 15:37:53 -03:00
Rémi Verschelde dfcecb77bd
Merge pull request #79617 from sepTN/add-screensize-check-popup
Add size check to prevent popup bigger than the screen itself
2024-02-19 00:07:01 +01:00
Septian 34210e812a Add screen size check on `popup` 2024-02-19 00:25:02 +07:00
Michael Alexsander 7b42c24550
Make auto translation inheritable 2024-02-15 16:51:19 -03:00
bruvzg 0d88aadd53
Automatically set viewport background to transparent when window flag is set. 2024-02-02 10:40:26 +02:00
A Thousand Ships 15369fdb1d
Remove unnecessary `this->` expressions 2024-01-29 09:59:18 +01:00
Rémi Verschelde 03767fbf3b
Merge pull request #86446 from reduz/transient-to-focused
Implement a `transient_to_focused` Window mode
2024-01-15 13:25:00 +01:00
Juan Linietsky 15144c24bd Implement a transient_to_focused mode
This intends to be the correct way to handle non-child windows becoming covered by the current window when becoming focused.
Enabling this property on select windows, they will become transient to the currently focused one when becoming visible.

This deprecates the "unparent_when_invisible" function introduced by #76025.
2024-01-14 18:51:44 +01:00
Jakub Marcowski 06534f8ad5 Add deprecation notice to a duplicate method of class `Window` 2024-01-12 18:18:28 +01:00
kobewi 0e8f90f4c8 Update deferred calls to use Callables 2024-01-09 16:11:47 +01:00
Rémi Verschelde 957378a69e
Merge pull request #84151 from YeldhamDev/that_was_not_a_resize_you_dunce
Fix `NOTIFICATION_WM_SIZE_CHANGED` firing if the size hasn't changed
2024-01-02 15:08:46 +01:00
Yuri Sizov 02d4579fa2 Merge pull request #85000 from bruvzg/ed_ui_direction
[Editor] Add option to override editor UI layout direction.
2023-12-19 13:01:35 +01:00
Yuri Sizov 8a9aa30348 Merge pull request #81243 from Sauermann/fix-window-events
Fix internal events not being delivered to some Window types
2023-12-19 13:01:00 +01:00
bruvzg f9c42d9fff
Limit window size updates on title translation change. 2023-12-06 10:51:27 +02:00
Rémi Verschelde 36e033bce8
Merge pull request #85312 from YuriSizov/window-and-the-case-of-an-unexpected-shrinkage
Make sure `Window`'s title is respected before we compute the size
2023-12-05 13:05:23 +01:00
bruvzg 5dd11e8eee
Limit window size updates on title change. 2023-11-30 16:04:00 +02:00
bruvzg bf19ced15d
Fix crash on late mouse enter/exit event arrival. 2023-11-27 08:47:43 +02:00
Yuri Sizov d9677be0ca Make sure `Window`'s title is respected before we compute the size
Also removes some suspicious and outdated code that forced this particular
dialog to change size when the warning message changed.
2023-11-24 16:31:41 +01:00
bruvzg 932174fedf
[Editor] Add option to override editor UI layout direction. 2023-11-17 14:56:45 +02:00
Markus Sauermann 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
Michael Alexsander 62ab9bf1c4
Fix `NOTIFICATION_WM_SIZE_CHANGED` firing if the size hasn't changed 2023-10-31 22:58:12 -03:00
A Thousand Ships f18aa00e85 Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-10-08 17:23:33 +02:00
bruvzg 72e2e47059
[DisplayServer] Add method to estimate window title bar size. 2023-10-03 16:13:52 +03:00
Yuri Sizov 53172d9860 Add more context to some `Window` errors 2023-09-30 21:44:05 +02:00
Yuri Sizov fe000277ea Bind remaining theme properties to their respective classes
This adds binds for GraphEdit/GraphElement/GraphNode, which were
skipped before due to a rework. This also adds binds for Window,
which was skipped before due to a complicated code organization.

Also adds theme cache entries/direct cache access to a few places
that previously missed it. Some theme properties are now exposed
to other classes via friendships or public getters for convenience.

This removes all string-based theme access from scene/ classes.
2023-09-13 19:31:35 +02:00
Yuri Sizov 2924bfd4d3 Register theme properties with ThemeDB 2023-09-11 13:45:23 +02:00
Yuri Sizov 58126e479c Introduce the concept of global theme contexts
This commit adds the default theme context, which replaces
the need to manually check the project and the default theme
all the time; simplifies related code.

It also adds framework for custom theme contexts, to be used
by the editor. Custom contexts can be attached to any node,
and not necessarily a GUI/Window node. Contexts do no break
theme inheritance and only define which global themes a node
uses as a fallback.

Contexts propagate NOTIFICATION_THEME_CHANGED when one of their
global themes changes. This ensures that global themes act just
like themes assigned to individual nodes and can be previewed
live in the editor.
2023-09-06 19:40:43 +02:00
kobewi 6de34fde27 Add EditorStringNames singleton 2023-09-03 19:58:18 +02:00
Jordyfel 9819ffb166 Implement window center function. 2023-08-26 21:34:21 +03:00
Rémi Verschelde a7dc4c22a9
Merge pull request #80334 from Sauermann/fix-window-out-of-viewport-events
Fix nodes receiving mouse events in black bars of `Window`
2023-08-16 09:12:42 +02:00
Rémi Verschelde 33198d0df0
Merge pull request #75784 from Riteo/int-scale
Add content scale stretch modes, implement integer scaling
2023-08-11 10:32:11 +02:00
Riteo 87cfc415a3 Add content scale stretch modes, implement integer scaling
Integer scaling is achieved (after aspect expansion) by "lying" to the
stretching code about the window's size, telling it that it's always an
integer multiple of the viewport so that it only gets stretched to an
integer factor.

This approach works with all stretch and aspect modes and doesn't
require handling for each, only requiring to "loosen up" some
self-excluding conditions (in other words, replacing some `else if`s
with just `if`s) regarding viewport offset and margin calculation (black
bars).

Includes a tiny usability change that adds a range hint for the content
scale factor between 0.5 to 8.0.

Co-Authored-By: Hugo Locurcio <hugo.locurcio@hugo.pro>
2023-08-10 19:45:47 +02:00
Markus Sauermann 59c13fea5d Fix nodes receiving mouse events in black bars of `Window`
Previously for InputEvents there was no distinction between
Window-area and Viewport-area.
This was problematic in cases where stretching was used and the Window
contained black bars at the sides of the Viewport.
This PR separates the area of Window and Viewport regarding InputEvents.
2023-08-09 12:34:22 +02:00
Rémi Verschelde af722e2bab
Merge pull request #80187 from Sauermann/fix-mouseover-error-handling
Handle potential platform-specific `Window` mouse-enter/exit bugs gracefully
2023-08-08 16:57:09 +02:00
Markus Sauermann 2f8673dc07 Handle potential platform-specific `Window` mouse-enter/exit bugs gracefully
Also replace `DEV_ASSERT` by `WARN_PRINT_ONCE`.
2023-08-08 13:05:18 +02:00
Michael Alexsander 6d2453425b
Improve `Window._get_contents_minimum_size()`'s code 2023-08-03 10:25:05 -03:00
Michael Alexsander f270163ab0
Expose `Window`'s `_get_contents_minimum_size()` to scripting 2023-08-02 14:40:38 -03:00
Markus Sauermann 8c1ce404d7 Fix crash on Windows when closing `Window`
Send `WINDOW_EVENT_MOUSE_EXIT` when a window is destroyed.

Ensure, that on Windows, the event_callback is still valid during
destroying the `Window`.
2023-08-02 00:17:25 +02:00
Markus Sauermann 1c3c17c608 Refactor mouse_entered and mouse_exited notifications
The previous implementation for signals mouse_entered and mouse_exited
had shortcomings that relate to focused windows and pressed mouse buttons.
For example a Control can be hovered by mouse, even if it is occluded by
an embedded window.

This patch changes the behavior, so that Control and Viewport send
their mouse-enter/exit-notifications based solely on mouse position,
visible area, and input restrictions and not on which window has
focus or which mouse buttons are pressed. This implicitly also
changes when the mouse_entered and mouse_exited signals are sent.

This functionality can not be implemented as a part of
Viewport::_gui_input_event, because of its interplay with Windows and
because Viewport::_gui_input_event is based on input and not on
visibility.
2023-08-01 13:28:49 +02:00
kobewi de4a3fa151 Unify and streamline connecting to Resource changes 2023-07-17 19:35:57 +02:00