Commit Graph

160 Commits

Author SHA1 Message Date
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
e3e9da78e8 Remove Viewport::_get_input_pre_xform
This function is only relevant for `Window`. So this PR moves
the functionality to the `Window`-class.
2023-02-02 22:03:52 +01:00
6743ac34d3 Simplify Viewport::_set_size
`Viewport.to_screen_rect` is used only in a single location to compare it
to `Rect2i()`.

When called from `SubViewport`, `to_screen_rect` is always equal to `Rect2i()`.
When called from `Window`, `to_screen_rect` is always different from `Rect2i()`.

So the comparison `to_screen_rect != Rect2i()` can be replaced by
`Object::cast_to<Window>(this)`.

This allows the removal of `Viewport.to_screen_rect` and the simplification of
`Viewport::_set_size`.
2023-02-02 19:09:14 +01:00
8182f29d40 Fix stretch transform when resizing SubViewports
Move calculation of stretch transform from outside to inside
of `Viewport::_set_size` function.
2023-02-01 08:34:40 +01:00
b342dcdf04 Remove some unused signals
Part of #37604.
2023-01-31 18:54:04 +01:00
2b710bc336 Fix MSVC shadow local warning 2023-01-31 18:06:21 +01:00
1c42e141d0 Merge pull request #59310 from Sauermann/proposal-event-transform
Calculate window input event transform only on window change
2023-01-31 15:57:07 +01:00
aae96945fa Merge pull request #71470 from YeldhamDev/window_fixes
Fix some small bugs in the `Window` node
2023-01-27 19:26:31 +01:00
13e20fed99 Merge pull request #68627 from Sauermann/fix-tooltip-position
Fix position of Tooltips
2023-01-26 16:00:14 +01:00
c4ed247f5f Fix position of Tooltips
CanvasItem::get_screen_transform returns a transform from the CanvasItem
to the coordinate system, where a Popup - created as a child of the
CanvasItem - should be opened.
get_screen_transform makes some simplifications, that work well, when used
in the editor, but not in general cases.

Since Popups like Tooltips are now used more commonly in projects,
it becomes necessary to correct these simplifications.

This solution introduces Viewport::get_popup_base_transform, which makes
the necessary calculations.
2023-01-26 15:15:14 +01:00
aade5abd4f Reorganize main and sub-window initial position properties. 2023-01-19 13:44:06 +02:00
52b077ca28 Fix some small bugs in the Window node 2023-01-18 21:20:49 -03:00
34b34b104c Add WINDOW_FLAG_MOUSE_PASSTHROUGH flag and enabled it for tooltips. Expose window_set_mouse_passthrough to Window. 2023-01-16 11:42:49 +02:00
2718a7b7d3 Add support for the custom initial screen for the main window, fix primary screen detection. 2023-01-07 11:14:35 +02: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
f7955633de Improve window_set_current_screen and fix secondary window initial mode and positions. 2022-12-29 09:43:39 +02:00
29cc86fa6c Copy local theme overrides from Control to Window 2022-12-07 20:50:51 +03:00
edf13eb5a6 Rename window_get_real_size to window_get_size_with_decorations, add window_get_position_with_decorations. 2022-12-07 11:07:30 +02:00
3b14f0334c Remove redundant Variant-types initializations 2022-11-14 19:35:19 +01:00
8fd92ed867 Merge pull request #64710 from MinusKube/window-size-crash
Prevent windows from having a size greater than device limit
2022-10-27 10:02:44 -07:00
15b68f7601 Merge pull request #67232 from bruvzg/popup_edit
Improve Popup / Window behavior in the edited scene tree.
2022-10-12 14:45:14 +02:00
d7e9b8af9a Set window size after setting new limits
Otherwise this can fail as the size may not fit
into current limits. This is problematic at least
on X11.
2022-10-11 17:16:20 +02: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
2237df6273 Fix invalid popup position for embedded popups 2022-10-03 21:23:32 +02:00
2bf2217b1a Calculate window input event transform only on window change 2022-10-01 09:54:38 +02:00
e3464c8fc8 Merge pull request #58995 from Sauermann/fix-mouse-cursor-change-2
Update mouse cursor shape after changes
2022-09-28 20:50:05 +02:00
a4c3551dc6 Force window position if spawned outside screen 2022-09-26 13:44:25 +02:00
0dab11afa4 [macOS extend-to-title] Add scene/project name to the editor title, fix incorrect window button position/order when system primary language is RTL. 2022-09-22 23:09:56 +03:00
52da6f1a44 Update mouse cursor shape after changes
This fixes some cases where the mouse cursor shape did not change automatically, but instead required a MouseMove to update.
2022-09-18 17:15:38 +02:00
d79040e7eb Merge pull request #65496 from MinusKube/popup-capture-mouse-bug
Fix MOUSE_MODE_CAPTURED not working correctly with popups
2022-09-16 09:23:40 +02:00
00e153f85a Use embedding viewport instead of parent viewport to determine popup rect 2022-09-09 01:22:46 +02:00
06b86fad0d Fix MOUSE_MODE_CAPTURED not working correctly with popups 2022-09-07 19:31:57 +02:00
f5a808192b Prevent windows from having a size greater than device limit 2022-09-04 22:48:54 +02:00
41eabca0fb Un-defer the initial theme changed notification in Window 2022-09-03 14:55:13 +03:00
8b128081e8 Un-defer the initial theme changed notification
Co-authored-by: Rindbee <idleman@yeah.net>
2022-09-02 23:44:23 +03:00
ddc55ef746 Add ThemeOwner type for managing theme propagation and lookup 2022-09-02 23:44:23 +03:00
15fd025f90 Add dumb and manual theme caching systems to Window 2022-09-01 16:05:02 +03:00
409613ba7b Allow to change the Stop shortcut used at runtime 2022-08-30 14:14:15 +02:00
e60086f98b Merge pull request #64119 from YuriSizov/theme-init-database 2022-08-29 14:02:21 +02:00
4f60fd0480 Merge pull request #64777 from bruvzg/extend_to_title
[macOS] Extend editor contents to the window title bar for better space usage.
2022-08-26 23:03:31 +02:00
6320a0fc18 Add ThemeDB, expose previously static Theme methods 2022-08-26 19:23:05 +03:00
bc4ba6cb78 [macOS] Extend editor contents to the window titlebar for better space usage. 2022-08-26 15:12:43 +03:00
ff612b6916 Merge pull request #64574 from Begah/fix_transient_window_wrap_mouse 2022-08-26 13:54:23 +02:00
74eb2a70bd Refactor and remove excessive calls of NOTIFICATION_THEME_CHANGED 2022-08-25 14:50:49 -06:00
5ac5c8bc06 Fix warp_mouse for transient windows, smoother mouse positioning when releasing mouse for spinbox 2022-08-25 11:30:49 +02:00
910efbff03 Avoid warnings about cursor shape change not supported 2022-08-23 11:14:07 +02:00
1a24c9e14b Make _validate_property a multilevel method 2022-08-22 18:35:11 +03:00
2b86c458bf Fix some bugs with Windows 2022-08-05 02:25:15 -03:00
2bf9e6090c rename translate(d) to translate(d)_local in Transform 2D/3D 2022-07-16 11:47:54 +02:00