Commit Graph

685 Commits

Author SHA1 Message Date
Rémi Verschelde 74b03edf1e
Merge pull request #82800 from Sauermann/fix-screen-mousemotion
Add screen-related attributes to mouse input events
2024-02-09 18:08:58 +01:00
Rémi Verschelde 03c8a0d089
SCons: Use r-strings for wayland-scanner builder command
Silences a Python 3.12 warning.
2024-02-09 15:52:20 +01:00
Rémi Verschelde 11964fb569
Merge pull request #87464 from bruvzg/pck_section
[Linux] Add support for PCK embedding section with non GNU-ld linkers.
2024-02-08 10:53:36 +01:00
Rémi Verschelde 7223c5b54a
Fix various typos with codespell
Using 2.2.7.dev115+g0eb441d6.

Had to add `cancelled` to the ignore list, as it's a Wayland signal which
we're handling in our code, so we don't want codespell to fix that "typo".

Also includes the typo fix from #87927.

Co-authored-by: Divyanshu Shekhar <61140213+divshekhar@users.noreply.github.com>
2024-02-07 11:09:34 +01:00
Rémi Verschelde c9c2b12637
Merge pull request #88028 from Calinou/wayland-silence-scanner-check
Silence wayland-scanner check in buildsystem
2024-02-07 11:06:00 +01:00
Rémi Verschelde 3b6f2e0525
Merge pull request #87977 from Chubercik/wayland-1.22.0
wayland: Update to 1.22.0
2024-02-07 11:02:05 +01:00
Rémi Verschelde 4f478a55cc
Merge pull request #86843 from RandomShaper/fix_null_ptr
Avoid several null-dereferences of ApiContextRD
2024-02-07 10:58:01 +01:00
Pedro J. Estébanez d5a5dd52e8 Avoid several null-dereferences of ApiContextRD 2024-02-06 19:55:01 +01:00
Hugo Locurcio 7b0f2a5f53
Silence wayland-scanner check in buildsystem
This prevents a wayland-scanner message from appearing every build
when `wayland=yes` is used (the default). The error message when
wayland-scanner is still printed as it's not printed by
wayland-scanner itself.
2024-02-06 19:49:34 +01:00
Jakub Marcowski 292df42c3f wayland: Update to 1.22.0 2024-02-06 10:23:42 +01:00
Dalton Lang 8a2e4409e6 [X11] Partial Fix Godot Editor and Project Manager steals focus on a window manager on Linux
This is a workaround for the most critical portion of the WM focus bug
described in #68305. On some specific X11 WM configurations, the
editor's main window and any popups it creates will fight for focus,
which causes a total system lockup due to mouse and keyboard input being
stolen as well. Getting out of this infinite loop requires force
restarting the system.

It can be tested with the following shell script:

```bash
	!#/bin/sh

	godot4 &
	sleep 30
	pkill -x godot4
```

The workaround identified in #68305 is to remove the call to
XSetInputFocus in the ConfigureNotify event handler, so I have removed
the conditional block that calls this as well as the setup code above it
since there is no need to allocate the memory for the variables if they
won't be used in that call anymore.

This is just a hack and is not a complete fix for #68305. Multiple
developers are collaborating on a proper fix in the discussion in that
issue, but time is a valuable resource that no one has enough of, so I
am committing this workaround as a stop-gap to prevent the most critical
problem while we work on a full solution for the underlying cause.
2024-02-05 17:00:24 -06:00
Markus Sauermann 2235a1cbd0 Add screen-related attributes to mouse input events 2024-02-05 23:30:15 +01:00
Riteo 7739940202 Core: Implement a XOR operator for BitField 2024-02-01 20:44:40 +01:00
Rémi Verschelde 9adb7c7d13
Merge pull request #87764 from Riteo/wayland-native-handle
Wayland: Implement `window_get_native_handle`
2024-01-31 14:01:59 +01:00
Rémi Verschelde f23fda39d3
Merge pull request #87776 from bruvzg/wl_nfd
[Wayland] Add support for native file dialogs.
2024-01-31 14:00:30 +01:00
bruvzg edb21e0573
[Wayland] Add support for native file dialogs. 2024-01-31 14:13:19 +02:00
Riteo d8658df94e Wayland: implement `window_get_native_handle`
This will be the most useful for stuff like OpenXR, although we'd need a
way to eventually also expose the EGL handles.
2024-01-31 11:57:05 +01:00
Riteo c3d6cc57be Wayland: disable backend at build-time if wayland-scanner is missing
This allows previous X11-only setups to still build Godot with default
settings. Note that compilation will still abort if wayland-scanner is
present but not the various Wayland libraries.
2024-01-31 02:08:33 +01:00
Riteo 7e0f7d3abd Add Wayland support
Not everything is yet implemented, either for Godot or personal
limitations (I don't have all hardware in the world). A brief list of
the most important issues follows:

- Single-window only: the `DisplayServer` API doesn't expose enough
information for properly creating XDG shell windows.

- Very dumb rendering loop: this is very complicated, just know that
the low consumption mode is forced to 2000 Hz and some clever hacks are
in place to overcome a specific Wayland limitation. This will be
improved to the extent possible both downstream and upstream.

- Features to implement yet: IME, touch input, native file dialog,
drawing tablet (commented out due to a refactor), screen recording.

- Mouse passthrough can't be implement through a poly API, we need a
rect-based one.

- The cursor doesn't yet support fractional scaling.

- Auto scale is rounded up when using fractional scaling as we don't
have a per-window scale query API (basically we need
`DisplayServer::window_get_scale`).

- Building with `x11=no wayland=yes opengl=yes openxr=yes` fails.

This also adds a new project property and editor setting for selecting the
default DisplayServer to start, to allow this backend to start first in
exported projects (X11 is still the default for now). The editor setting
always overrides the project setting.

Special thanks to Drew Devault, toger5, Sebastian Krzyszkowiak, Leandro
Benedet Garcia, Subhransu, Yury Zhuravlev and Mara Huldra.
2024-01-30 16:44:47 +01:00
Rémi Verschelde f220d46cdc
Merge pull request #80231 from romlok/input-key-location
Support detecting and mapping ctrl/alt/shift/meta by their left/right physical location
2024-01-29 13:15:42 +01:00
Mel Collins 8406e60522 Add InputEventKey.location to tell left from right
This adds a new enum `KeyLocation` and associated property
`InputEventKey.location`, which indicates the left/right location of key
events which may come from one of two physical keys, eg. Shift, Ctrl.

It also adds simulation of missing Shift KEYUP events for Windows.
When multiple Shifts are held down at the same time, Windows natively
only sends a KEYUP for the last one to be released.
2024-01-26 14:42:28 +01:00
bruvzg a8f521bcad
[Native File Dialog] Add support for adding custom options to the dialogs.
Add support for adding custom options (checkboxes and optionboxes) to the dialogs (both native and built-in).
2024-01-24 15:00:31 +02:00
bruvzg 625c4bdace
[Linux] Add support for PCK embedding section with non GNU-ld linkers. 2024-01-24 12:21:05 +02:00
David Snopek 64a52e08fe [X11] Don't re-set input focus if the given window already has it 2024-01-18 08:52:03 -06:00
Rémi Verschelde 4aff0ab5d5
Merge pull request #86441 from dsnopek/mequam-x11-focus-grab
[X11] Fix Godot stealing focus on alternative window managers
2024-01-18 09:34:18 +01:00
Yuri Sizov 95b27fe8c7 Reorganize code related to editor theming
This change introduces a new EditorThemeManager class
to abstract theme generatio and its subroutines.

Logic related to EditorTheme, EditorColorMap, and editor
icons has been extracted into their respective files with
includes cleaned up.

All related files have been moved to a separate folder to
better scope them in the project. This includes relevant
generated files as well.
2024-01-16 11:57:45 +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
kobewi 0e8f90f4c8 Update deferred calls to use Callables 2024-01-09 16:11:47 +01:00
mequam 40d69c25d5 [X11] Fix Godot stealing focus on alternative Window Managers 2024-01-09 08:58:59 -06:00
Rémi Verschelde 6c390b620d
Merge pull request #84445 from Rubonnek/add-const-references-clang-tidy
Add const references detected by clang-tidy
2024-01-04 14:25:33 +01:00
Rémi Verschelde d36903860c
Merge pull request #86160 from gregdebonis/gregdebonis/issue86156
Fix key mapping for `XK_KP_Delete` key
2024-01-03 15:44:32 +01:00
jsjtxietian 078bfae6a4 Add RD_ENABLED when VULKAN_ENABLED or D3D12_ENABLED is added 2023-12-25 11:13:01 +08:00
Yuri Sizov 3a8524dd92
Merge pull request #83452 from RandomShaper/rd_common
Split `RenderingDevice` into API-agnostic and `RenderingDeviceDriver` parts
2023-12-20 20:09:18 +01:00
Pedro J. Estébanez 12a519bae2 Split RenderingDevice into API-agnostic and RenderingDeviceDriver parts
Credit and thanks to @bruzvg for multiple build fixes, update of 3rd-party items and MinGW support.

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2023-12-20 19:18:08 +01:00
Yuri Sizov aee8a3bada Merge pull request #75489 from bruvzg/init_pos_usable
[DisplayServer] Use screen "usable rect" instead of full rect to calculate initial window rect.
2023-12-19 20:32:10 +01:00
Wilson E. Alvarez a3cb1b096f
Add const references detected by clang-tidy 2023-12-16 13:36:44 -05:00
Gregory De Bonis 95bcf93849 Wrong key mapping for XK_KP_Delete key
Fixes #86156
2023-12-14 10:39:15 -03:00
Yuri Sizov 773b4d7764 Ensure more export errors are reported to users
Also fixes the timing issue when exporting all
presets at the same time, where the error report
would try to appear while the progress dialog
was still visible.
2023-12-06 15:26:07 +01:00
bruvzg b02cf351f3
[DisplayServer] Use screen "usable rect" instead of full rect to calculate initial window rect. 2023-12-04 07:56:33 +02:00
HolonProduction bf45d3ae24 X11: Send IME update notification deferred 2023-11-24 13:18:50 +01:00
Rémi Verschelde 15b8185c68
Don't use TTR/RTR for ERR/WARN prints
We don't translate those, only editor strings are translated.
2023-11-12 12:00:55 +01:00
bruvzg f3d4f5a77e
[X11] Add fallback from desktop GL to GLES, suppress PRIME detector error spam. 2023-11-06 12:40:44 +02:00
Rémi Verschelde 63153c9d36
Linux: Remove hardcoded lib path for x86 cross-compilation
This breaks the build with our updated i686 Linux SDK which doesn't contain
this path, and may not be needed at all.

This might need further work to be robust, and there's an open PR already
adding -march flags for all supported architectures, but for now we're
playing it safe for 4.2.
2023-11-01 14:14:01 +01:00
thfrwn a0253e593c TTS_Linux: Fix size_t template issue on OpenBSD by using int consistently 2023-10-27 12:23:39 -04:00
Setadokalo 1d9ec3caa3 Fix freeze when requesting clipboard image from our own window 2023-10-25 18:32:40 -05:00
Brayden Harlon 085255bd0e Improved X11 screen_get_refresh_rate performance 2023-10-24 11:25:51 -07:00
Rémi Verschelde 2f33c2b20e
Merge pull request #81439 from Setadokalo/clipboard_image
Implement `clipboard_get`/`has_image` for X11
2023-10-20 15:06:42 +02:00
Setadokalo 3b5a9e31bb Implement clipboard_get/has_image for X11 2023-10-20 02:59:10 -05:00
bruvzg b52826bf55
Add error messages to the native menu and file dialogs callback. 2023-10-14 18:10:39 +03:00
Kacper Gibas 8eb32f9aad Fix unused variables warning when `touch` is disabled 2023-10-13 16:04:08 +02:00
A Thousand Ships f18aa00e85 Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-10-08 17:23:33 +02:00
kobewi 09b30be86d Add vararg call() method to C++ Callable 2023-10-05 11:35:29 +02:00
Rémi Verschelde d8ab953442
Merge pull request #82163 from naelstrof/master
Made signal handling more uniform during crashes.
2023-10-05 10:08:09 +02:00
Rémi Verschelde 03ff9fedb6
Merge pull request #82101 from bruvzg/x11_gles
[X11] Add support for using EGL/GLES instead of GLX.
2023-10-04 15:35:05 +02:00
bruvzg af00c4a54a
[X11] Add support for using EGL/GLES instead of GLX. 2023-10-04 14:15:36 +03:00
bruvzg 43e4708dff
[Native File Dialogs] Improve filter list handling, add selected filter to the callback. 2023-10-03 19:26:16 +03:00
Rémi Verschelde 31dbbc2c5a
Merge pull request #80952 from bruvzg/nfdlg_refocus
[Native File Dialogs] Refocus last focused window on close.
2023-10-03 17:13:58 +02:00
Rémi Verschelde 48bee5c8ef
Merge pull request #82221 from Riteo/linux-ogl-no-vsync-override
Linux/OpenGL: Don't force vsync in the editor
2023-09-26 13:45:12 +02:00
Mario Liebisch 426e18fd37
Updated compiler version detection
This fixes multiple issues/inconsistencies around  `get_compiler_version()`:
* With no shell allocated, launching the compiler could fail even
  with proper paths being set.
* The return value was described as "an array of version numbers as ints",
  but the function actually returned a `Dictionary` (or `None`).
* Not all calls were properly handling a `None` return value in case of errors.
  On Windows this broke compiling for me since #81869 with default settings.
* Some calls defined inconsistent defaults/fallbacks (`0` or `-1`).
2023-09-25 21:17:20 +02:00
Rémi Verschelde b362976504
SCons: Fix Python 3.12 SyntaxError with regex escape sequences 2023-09-25 10:39:30 +02:00
Riteo 4fd6777cf4 Linux/OpenGL: don't force vsync in the editor
I couldn't tell whether this has an actual purpose and it feels more
like a debug remnant.

We also need to be able to disable vsync in the editor for the WIP
Wayland backend (in the EGL driver) as it does manual frame throttling.
2023-09-24 04:36:58 +02:00
naelstrof b49e9c9896 Made signal handling more uniform. Fixes #82102 2023-09-22 20:06:58 -06:00
bruvzg 1887a9df19
[macOS/Windows] Add optional ANGLE backed OpenGL renderer support. Add EGL_ANDROID_blob_cache caching.
Co-authored-by: Riteo <riteo@posteo.net>
2023-09-21 14:21:00 +03:00
A Thousand Ships 3565d1bf7e [Drivers,Platform] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-09-12 20:13:32 +02:00
kobewi 6de34fde27 Add EditorStringNames singleton 2023-09-03 19:58:18 +02:00
bruvzg 2e1f48ff6e
[Native File Dialogs] Refocus last focused window on close. 2023-08-24 09:34:58 +03:00
Rémi Verschelde c72b851dfb
Merge pull request #80104 from bruvzg/freedesktop_native_file_dialog
[Linux/Freedesktop] Implement native file selection dialog support.
2023-08-17 11:23:00 +02:00
Rémi Verschelde 9a48b14a2d
Merge pull request #80036 from PorkrollPosadist/fix-wayland-window-behavior
Use EWMH for `DisplayServerX11::_window_minimize_check()` implementation
2023-08-17 11:22:36 +02:00
bruvzg 6cc314e0fa
[Linux/Freedesktop] Implement native file selection dialog support. 2023-08-17 10:56:16 +03:00
Rémi Verschelde efdff9cbc2
Fix GCC -Wmaybe-uninitialized warnings 2023-08-14 14:35:35 +02:00
Rémi Verschelde 49f0d8cee3
Merge pull request #80279 from Sauermann/fix-x11-mouse-window-event-crash
Track hovered `Window` in `DisplayServerX11`
2023-08-10 00:43:00 +02:00
Markus Sauermann a7c5849f98 Track hovered `Window` in `DisplayServerX11`
Send mouse-entered/exited window-events only when necessary
2023-08-09 12:20:23 +02:00
Rémi Verschelde 6a0410bbc2
Merge pull request #80240 from bruvzg/x11_ext_checks
[X11] Do not fail DisplayServer init if non-essential extensions are missing.
2023-08-07 14:50:47 +02:00
bruvzg e26a6c36c8 Fix native popups auto-closing when interacting with non-client area. 2023-08-07 10:01:48 +03:00
bruvzg acff87ffda
[X11] Do not fail DisplayServer init if non-essential extensions are missing. 2023-08-04 10:58:14 +03:00
Yuri Sizov 1610fc2ae7 Merge pull request #78539 from EIREXE/input-info
Add the ability to get per-platform information for joypads
2023-08-03 22:37:45 +02:00
Álex Román Núñez 3aa340d081 Add the ability to get per-platform information for joypads.
This adds the ability for games to obtain platform-specific information about joypads such as their vendor/product ID, their XInput gamepad index or the real name of the device before it gets swapped out by the gamecontrollerdb's name.

This PR also includes a rebased version of #76045, this is because this PR is intended to be mainly to help people implementing Steam Input, as having the gamepad index is essential.
2023-08-02 22:30:30 +02: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
PorkrollPosadist 5666656d42 Use EWMH for DisplayServerX11::_window_minimize_check() implementation 2023-07-31 16:35:18 -04:00
Hendrik Brucker 7e21eb7e00 Extract and reorganize texture resource classes 2023-07-14 20:04:21 +02:00
Yuri Sizov 1da09fd477 Merge pull request #79062 from MewPurPur/svg-optimizations
Optimize SVG icons and remove unused Transpose icon
2023-07-12 21:02:53 +02:00
Yuri Sizov ff689003a5 Merge pull request #77993 from bruvzg/key_lbl_from_p
Implement DisplayServer.keyboard_get_label_from_physical method.
2023-07-12 21:02:37 +02:00
Yuri Sizov 55b74c7cdf Merge pull request #76045 from Eoin-ONeill-Yokai/steaminput-fix
Prevent double input events on gamepad when running through steam input
2023-07-12 17:16:36 +02:00
Yuri Sizov 661c3954a6 Merge pull request #73443 from akien-mga/unbundle-openxr
Allow unbundling OpenXR (for Linux distros)
2023-07-12 17:15:25 +02:00
Yuri Sizov 2b47f6715e Merge pull request #78437 from bruvzg/set_icon
Add error checks and harmonize behavior of the `set_icon` method.
2023-07-12 15:09:14 +02:00
Yuri Sizov 6960a1d0e8 Merge pull request #78248 from felaugmar/load-svg-adjustable-scale
Added `Image::load_svg_from_(buffer|string)`
2023-07-12 15:09:03 +02:00
Rémi Verschelde 5dbbdaf27b
Merge pull request #79284 from akien-mga/fix-linux-os-move_to_trash
Fix Linux `move_to_trash` wrongly reporting files as not found
2023-07-11 11:30:21 +02:00
Rémi Verschelde a6e75f3971
Fix Linux `move_to_trash` wrongly reporting files as not found
We can't rely on the error code from `gio` or `kioclient5`, in my
rudimentary testing they return `1` for both missing files and other
situations like not having a Trash can on the mounted volume.

Fixes #79108.
2023-07-11 09:55:27 +02:00
Eoin O'Neill 8de98dbf21 Prevent double input events on gamepad when running through steam input
During GDC and general testing on Steam Deck units, we found that single
gamepads would often register inputs twice under certain circumstances.
This was caused by SteamInput creating a new virtual device, which Godot
registers as a second gamepad. This resulted in two gamepad devices
reporting the same button presses, often leading to buggy input response
on games with no multi-device logic and other-wise could cause intended
Steam rebindings to not work as intended (for example, swapping o and x
on a playstation pad if that feature isn't supported by the game.)

SDL gets around this by taking in a list of devices that are to be
ignored. When valve sees a controller that wants to be rebound via
SteamInput, they push a new VID/PID entry onto the environment
variable `SDL_GAMECONTROLLER_IGNORE_DEVICES` for the original gamepad
so that all game inputs can be read from the virtual gamepad instead.

This leverages the same logic as we are already using SDL gamepad
related HID mappings.
2023-07-10 15:26:33 -07:00
Rémi Verschelde dcd16a5750
Linux: Fix build with `use_sowrap=no` and various warnings/errors 2023-07-10 14:34:01 +02:00
Rémi Verschelde 79b31a8357
Merge pull request #79105 from akien-mga/linux-libsquish-lacks-pkgconfig
Linux: Link libsquish directly when unbundling, .pc file unreliable
2023-07-08 18:22:18 +02:00
MewPurPur fe194f8db0 Optimize SVG icons and remove unused Transpose icon 2023-07-07 17:58:15 +03:00
Rémi Verschelde f1e63b808a
Merge pull request #79101 from akien-mga/linux-unbundle-brotli
Linux: Allow unbundling brotli to use system library
2023-07-07 08:35:44 +02:00
Rémi Verschelde b3b4f4c1c9
Linux: Link libsquish directly when unbundling, .pc file unreliable 2023-07-06 15:32:42 +02:00
Rémi Verschelde 153c4a4c4f
Linux: Allow unbundling brotli to use system library 2023-07-06 15:26:38 +02:00
Rémi Verschelde 81064cc239
Doctool: Remove version attribute from XML header
We don't use that info for anything, and it generates unnecessary diffs
every time we bump the minor version (and CI failures if we forget to
sync some files from opt-in modules (mono, text_server_fb).
2023-07-06 10:08:21 +02:00
Rémi Verschelde 346f1ab86b
Bump version to 4.2-dev
Keep on waitin'
2023-07-05 22:07:03 +02:00
bruvzg 9c5a0c6c10
Add error checks and harmonize behavior of the set_icon method. 2023-07-03 13:48:28 +03:00
Felipe Augusto Marques 26eb3db234 Added Image's `load_svg_from_(buffer|string)`
No core dependency to the svg module.
2023-06-23 00:43:43 -03:00