Commit Graph

239 Commits

Author SHA1 Message Date
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
bruvzg
db0109b237 [Windows] Fix setting initial non-exclusive window mode. 2023-07-04 13:09:26 +03:00
Rémi Verschelde
68193bee9a
Revert "Fix that the focus-out notification got sent deferred"
This reverts commit 8cdab04d7f.

Fixes #78589.
2023-06-23 18:03:48 +02:00
jeana helver
5ec1b698d2
Fix missing enum value for Window.initial_position
Reorder the properties in a possibly more intuitive order.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-06-21 22:39:43 +02:00
Markus Sauermann
8cdab04d7f Fix that the focus-out notification got sent deferred
Currently the window receives a focus-out notification, directly after
it popup, because currently the signal is sent deferred.
The original intention was that the previously focused window must
receive a focus-out notification.
This change makes the notification more precise by only sending the
focus-out to the previously focused window.
2023-06-18 23:06:07 +02:00
bruvzg
28db3c7158 [DisplayServer] Add method to check if native window is focused. 2023-06-16 10:27:52 +03:00
Ninni Pipping
dcd2b883eb Use NULL instead of COND checks when appropriate
Restricted to scene
2023-06-10 08:56:30 +02:00
Rémi Verschelde
0cee1e0d4f
Merge pull request #77923 from Sauermann/fix-mouse-position-with-screen-transform
Fix mouse position with screen transform
2023-06-09 12:15:56 +02:00
Markus Sauermann
d1fa284e65 Fix mouse position with screen transform
When a Viewport is not directly attached to the screen, the
function `Viewport::get_mouse_position` can't rely on
`get_screen_transform`, because that function is ambiguous in
these situations.
In these cases it is necessary to use the mouse position from
the most recent mouse IputEvent.
2023-06-09 11:29:43 +02:00
bruvzg
e5b312a1e8
Use initial position property for embedded windows to center on parent window. 2023-06-06 09:29:13 +03:00
Markus Sauermann
ce10ca6979 Create a virtual mouse move event after moving child nodes
This updates mouse cursor and mouse-over-states without the need
for additional mouse movements.
2023-05-29 22:46:19 +02:00
Yuri Sizov
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