Commit graph

179 commits

Author SHA1 Message Date
Hugo Locurcio 064ca9adae
Remove debugging prints in the Linux DisplayServer
Some Vulkan debugging prints were also changed to be printed only
in verbose mode.
2021-05-08 19:07:50 +02:00
Lightning_A 97fecd1b69 Rename "Control" key to "Ctrl" and add "_pressed" suffix to all InputEventWithModifiers properties/methods 2021-05-07 14:00:50 -06:00
Rémi Verschelde dfbabcdaeb
Merge pull request #48453 from JFonS/improve_raycast_module_scsub
Port changes to the "raycast" module build files from 3.x
2021-05-04 17:55:25 +02:00
jfons 575543ce53 Port changes to the "raycast" module build files from 3.x 2021-05-04 17:21:41 +02:00
Aaron Franke 0de9a7d803
Rename doubleclick to double_click 2021-05-04 04:38:08 -04:00
Rémi Verschelde aa15ad72ee
Linux: Remove use_static_cpp override on x86_32
After further testing it seems to work fine now when building binaries with GCC 5
on Ubuntu 16.04 (previously we were using GCC 9 on Ubuntu 14.04).

Follow-up to #45629.
2021-04-26 13:34:55 +02:00
bruvzg a79cc0d772
Fix macOS build with all sanitizers enabled. 2021-04-16 08:27:00 +03:00
Rafał Mikrut f827bcd2f3 Add more sanitizer flags to shows more bugs 2021-04-15 20:16:28 +02:00
Rémi Verschelde d83761ba80
Style: Apply clang-tidy's readability-braces-around-statements 2021-04-05 14:09:59 +02:00
Rémi Verschelde 9bbe51dc27
Style: Apply clang-tidy's modernize-use-nullptr 2021-04-05 14:05:07 +02:00
Marcel Admiraal fd30c36985 Rename Texture.get_data() to get_image() 2021-03-28 13:00:46 +01:00
Aaron Franke a5324787c8
Rename some more global enums (Key, Joy, MIDI) 2021-03-23 07:13:23 -04:00
Aaron Franke 10d7fccb54
Rename ButtonList enum and members to MouseButton 2021-03-23 07:13:23 -04:00
Rafał Mikrut 0b298d201e Allow to not optimize release build 2021-03-14 15:51:05 +01:00
Rémi Verschelde ae850177a3 Linux: Fix PRIME detection on Steam
To avoid trying to do PRIME detection on fake `libGL.so` as used by e.g.
Renderdoc or Primus, we skip detection if there's a `libGL.so` in
`LD_LIBRARY_PATH`... and our luck is that Steam defines it and includes
system paths too, thus the actual system `libGL`... 🤦

So if we detect Steam, we skip this check.

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-03-08 15:51:14 +01:00
Jordan Schidlowsky da35cd2f00 add msan sanitizer option for linus/bsd, lsan option for osx 2021-03-02 11:10:16 -06:00
Pedro Rodrigues 1cb21b6937 Fix out of bounds array access on DisplayServerX11 code
The problem happened on methods `screen_get_position`,
`screen_get_usable_rect` and `window_set_current_screen` when they were
passed a negative screen value.

Fixes:
- #46184
- #46185
- #46186
2021-02-28 16:43:46 +00:00
Hein-Pieter van Braam-Stewart 0dc368f9f9 Allow static linking with libatomic using clang
When using use_static_cpp we want to statically link with atomic as well
to make sure we don't incur any new runtime dependencies.

Scons doesn't quite support this so we do this little trick.
2021-02-23 14:51:44 +01:00
Hein-Pieter van Braam d4d7535524
Merge pull request #46256 from hpvb/dri-prime-amd-master
Add 'AMD' GPU vendor name to PRIME detector
2021-02-20 17:18:46 +01:00
Hein-Pieter van Braam-Stewart e6a5899646 Add 'AMD' GPU vendor name to PRIME detector
Apparently some recent Mesa version also changed AMD's vendor string. In
addition I found a small uninitialized variable that's corrected now.
2021-02-20 16:49:06 +01:00
Hein-Pieter van Braam-Stewart c9b3a00a63 Use -latomic when linking whe using clang on Linux
According to the LLVM documentation when using GNU's libstdc++ clang
will not automatically link with -latomic. This is necessary since we
merged c++11 atomics support.

This fixes linking using Clang on Linux
2021-02-20 16:40:55 +01:00
Hein-Pieter van Braam-Stewart 5233d78f49 An update to the dylibloader for older inttypes
This #define's older inttypes to their newer versions and #includes
<stdint.h> in the generated files. This will help with older
glibc/compiler versions using headers generated on newer systems.

This closes #46223
2021-02-20 01:24:30 +01:00
Pedro J. Estébanez 8e128726f0 Modernize atomics
- Based on C++11's `atomic`
- Reworked `SafeRefCount` (based on the rewrite by @hpvb)
- Replaced free atomic functions by the new `SafeNumeric<T>`
- Replaced wrong cases of `volatile bool` by the new `SafeFlag`
- Platform-specific implementations no longer needed

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-18 17:12:46 +01:00
Rémi Verschelde e26a1f807b
Linux: Fix fallback logic when udev fails creating a context
Thanks to Noshyaar for pointing out the bug.
2021-02-18 10:28:37 +01:00
Hein-Pieter van Braam-Stewart 8d36b17343 Don't clobber original library symbols
It appears that we can get a fun circle dependency on a shared object on
some system configurations causing issues with our 'fake' function
pointer names. This can lead to a crash.

The new wrapper generator renames all the symbols so this can't happen
anymore. See https://github.com/hpvb/dynload-wrapper/commit/704135e

This closes #46140
2021-02-18 00:21:10 +01:00
Rémi Verschelde a10c259c1d
Dynamically load libudev.so.1 on Linux if udev=yes
This makes it possibly to run Linux binaries compiled with udev support on
Linux systems which do not provide udev (typically systemd-less distros).

If udev is missing, we fall back to parsing `/dev/input` like when compiled
without udev support (`udev=no`).

Also adding some verbose debug statements to know which method we're using
when debugging Linux joypad issues.

The libudev so wrappers were generated on Mageia 8 with libudev 246.9 using
https://github.com/hpvb/dynload-wrapper:
```
./generate-wrapper.py --include /usr/include/libudev.h --sys-include '<libudev.h>' \
  --soname libudev.so.1 --init-name libudev --omit-prefix gnu_ \
  --output-header libudev-so_wrap.h --output-implementation libudev-so_wrap.c
```
2021-02-17 13:14:59 +01:00
Hein-Pieter van Braam-Stewart 09f82fa6ea Dynamically load libpulse.so.0 and libasound.so.1 on Linux
By generating stubs using https://github.com/hpvb/dynload-wrapper we
can dynamically load libpulse and libasound on systems where it is available.
Both are still a build-time requirement but no longer a run-time dependency.

For maintenance purposes the wrappers should not need to be re-generated
unless we want to bump pulse or asound to an incompatible version. It is
unlikely we will want to do this any time soon.

This closes #20978
2021-02-16 20:31:49 +01:00
Rémi Verschelde 849c090343
SCons: Fix debug_symbols tests after switch to BoolVariable
Bug introduced in #45679.

Fixes part of #45816.
2021-02-08 08:53:16 +01:00
Rémi Verschelde db26871210 SCons: Add production=yes option to use production defaults
This is meant for users making custom builds to match the options used on
optimized, official builds.

This enables, on the platforms which support them:
- `use_static_cpp=yes` (portable binaries for Linux and Windows)
- `use_lto=yes` (link time optimizations - note: requires a lot of RAM!)
- `debug_symbols=no` (no debug symbols, smaller binaries)

Also abort when using MSVC with `production=yes`, as:
- It cannot optimize the GDScript VM like GCC or Clang do, leading to
  significant performance drops.
- Its LTO support is unreliable, at least used to trigger crashes last
  we tried it extensively.

All options can still be overridden if specified, and the `dev=yes` option
was changed to also support overrides.
2021-02-03 11:48:17 +01:00
Rémi Verschelde 0f4e2cd40c
Merge pull request #45630 from akien-mga/linux-enable-udev
Linux: Enable udev support by default
2021-02-01 16:00:34 +01:00
Rémi Verschelde 1ebd66daff
Linux: Build with use_static_cpp=yes by default for x86_64
This enables `-static-libgcc -static-libstdc++` which help make custom Linux
builds more portable (official builds have been using this option for years).

For some obscure reason Ubuntu 18.04 i386 crashes when using the option for
i386 builds, so let's play it safe and enable for x86_64 only for now.
2021-02-01 14:56:35 +01:00
Rémi Verschelde e8b69fccbe
Linux: Enable udev support by default
This has been enabled for years in official binaries, and users making custom builds
may end up not enabling it unknowingly, so it's best if we default to the same as
what official builds do.

The original reason for having it opt-in was likely the addition of a dependency on
libudev, but that should be fairly ubiquitous by now.
2021-02-01 14:40:15 +01:00
Rémi Verschelde 5525cd85c6
Merge pull request #45315 from RandomShaper/modernize_thread
Modernize Thread
2021-01-31 15:24:56 +01:00
Pedro J. Estébanez 99fe462452 Modernize Thread
- Based on C++11's `thread` and `thread_local`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed (except for the few cases of non-portable functions)
- Simpler for `NO_THREADS`
- Thread ids are now the same across platforms (main is 1; others follow)
2021-01-29 12:02:13 +01:00
Aaron Franke e829b7aee4
Unify URI encoding/decoding and add to C#
http_escape and percent_encode have been unified into uri_encode, and http_unescape and percent_decode have been unified into uri_decode.
2021-01-28 07:45:01 -05:00
Jari Ronkainen 01c030f9b7 Go through all event devices, not just event[0-32]
There are no guarantees that joypads are in event0-event32
range.  Some devices, such as laptops with detachable keyboards
and wacom can reserve events all the way up to 32.

Some udev rules with e.g. custom controller firmwares may
load the device as /dev/input/eventX, where X is greater than
32.

This patch uses POSIX dirent to enumerate the event devices, so
entries outside 0-32 range are not skipped.
2021-01-27 20:05:31 +02:00
Marcel Admiraal 2a74b388d0 Split OS::execute into two methods
1. execute(): Executes a command and returns the results.
2. create_process(): Creates a new process and returns the new process' id.
2021-01-09 10:03:23 +00:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Rémi Verschelde e4c0572385
Merge pull request #44593 from madmiraal/rename-mainloop-methods
Rename MainLoop methods to match Node methods
2020-12-28 14:44:28 +01:00
Marcel Admiraal 5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
Marcel Admiraal d9e9eb8d04 Rename MainLoop methods to match Node methods 2020-12-22 12:34:57 +00:00
Marcel Admiraal fa435a550a Add override keywords to core/os.h derived classes. 2020-12-17 18:02:31 +00:00
Rémi Verschelde 0f84d8dc49
SCons: Add only selected platform's opts to env
Otherwise we can get situations where platform-specific opts with the same name
can override each other depending on the order at which platforms are parsed,
as was the case with `use_static_cpp` in Linux/Windows.

Fixes #44304.

This also has the added benefit that the `scons --help` output will now only
include the options which are relevant for the selected (or detected) platform.
2020-12-16 16:31:19 +01:00
Marcel Admiraal f9b83e90b2 Fix named anonymous struct warning 2020-12-16 07:42:16 +00:00
Rémi Verschelde 90bdba576a
Merge pull request #43742 from qarmin/editor_modules_default_values
Initialize class/struct variables with default values in platform/ and editor/
2020-12-08 15:53:42 +01:00
Rémi Verschelde efc2104096
Merge pull request #44021 from dakennedyd/personal
Fix implementation of move_to_trash() on Linux
2020-12-07 21:06:10 +01:00
David Kennedy 8b68c6808d Fixes move_to_trash() on Linux
Fixes #42840 OS move_to_trash() on Linux is not compliant with the Freedesktop specification
2020-12-07 16:40:56 -03:00
reduz 2787ad65be RenderingServer reorganization 2020-12-04 18:39:46 -03:00
reduz e93b2242c2 Reorganize rendering server.
-Made RenderingServerScene abstract, allowing reimplementation
-RenderingServerRaster -> RenderingServerDefault, but this class is going away soon.
2020-12-03 19:01:01 -03:00
Rafał Mikrut e1811b689b Initialize class/struct variables with default values in platform/ and editor/ 2020-12-02 16:09:11 +01:00
Rémi Verschelde f1a9de9c59
X11: Include limits.h for LONG_MAX
Fixes #44030.
2020-12-02 15:43:29 +01:00
Rémi Verschelde a6751e6c58
Merge pull request #41100 from bruvzg/ctl_text_server_interface
[Complex Text Layouts] Implement TextServer interface.
2020-11-28 09:03:15 +01:00
PouleyKetchoupp 6b97901d4d Implement INCR mechanism for Linux clipboard
Allows pasting from x11 clipboard to receive data incrementally, which
is required when handling data size > 256KB.
2020-11-27 10:00:09 -07:00
bruvzg b9f441e81e
[Complex Text Layouts] Add third-party TextServer dependencies (ICU, HarfBuzz, Graphite). 2020-11-26 13:55:27 +02:00
Rémi Verschelde a4e04cdd47
Merge pull request #42652 from nekomatata/x11-clipboard-save-targets
Implement SAVE_TARGETS mechanism for Linux clipboard
2020-11-26 09:34:18 +01:00
Rémi Verschelde 09f3053450
SCons: Do not define TYPED_METHOD_BIND on Linux/clang
It's now only needed for MSVC.
2020-11-25 19:27:30 +01:00
Rémi Verschelde 2e4bff1cfe
SCons: Remove unnecessary $LINK overrides
As of SCons 4.0.1, the default value for $LINK is $SMARTLINK, which itself
is a function that will use $CXX as linker for C++:

https://github.com/SCons/scons/blob/4.0.1/SCons/Tool/link.py#L327-L328
https://github.com/SCons/scons/blob/4.0.1/SCons/Tool/link.py#L54-L76

So we don't need to manually specify the same value as $CXX for $LINK.
2020-11-19 16:48:03 +01:00
Aaron Franke 02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
Rémi Verschelde 7610945b4a
Merge pull request #43461 from ccl2of4/fix-linux-joypad-dpad-zeroing
Fix for linux joypad D-pad zeroing
2020-11-16 14:46:43 +01:00
bruvzg 319bc5ffda
Add XChangeProperty Atoms validity checks. 2020-11-15 22:20:14 +02:00
bruvzg f09a37a8d5
Fixes crash if Vulkan presentation surface is not available. 2020-11-14 13:41:13 +02:00
bruvzg fed776c64c
Add X11 Atom validity checks. 2020-11-12 16:10:17 +02:00
Connor Lirot dd021099ff Fix for linux joypad D-pad zeroing
Some controllers (notably those made by 8bitdo) do not always emit an event to zero out a D-pad axis before flipping direction. For example, when rolling around aggressively the D-pad of an 8bitdo SN30 Pro/Pro+, the following may be observed:

```
ABS_HAT0X : -1
ABS_HAT0Y : -1
ABS_HAT0Y : 0
ABS_HAT0Y : 1
ABS_HAT0X : 1
```

Notable here is that no event for `ABS_HAT0X: 0` is emitted between the events for `ABS_HAT0X: -1` and `ABS_HAT0X: 1`. Consequently, the game engine believes that both the negative _and_ positive x-axis directions of the D-pad are activated simultaneously (i.e `is_joy_button_pressed()` returns `true` for both `JOY_BUTTON_DPAD_LEFT` and `JOY_BUTTON_DPAD_RIGHT`), which should be impossible.

This issue is _not_ reproducible on all controllers. The Xbox One controller in particular will not exhibit this problem (it always emits zeroing out events for an axis before flipping direction).

The fix is to always zero out the opposite direction on the D-pad axis in question when processing an event with a nonzero value. This unfortunately wastes a small number of CPU cycles on controllers that behave nicely.

**I have verified this issue is also reproducible in the stable 3.2 branch**
2020-11-11 13:54:46 -06:00
Hugo Locurcio ff1f0d2cb5
Remove debug_symbols=full in favor of debug_symbols=yes
`debug_symbols=yes` will now behave like `debug_symbols=full` did
before. The difference in compressed file sizes is not that large,
which means there isn't much point in having two different values.

This helps make the buildsystem easier to understand.
2020-11-09 15:48:30 +01:00
reduz 127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
Ev1lbl0w 9e57a395cf
Changed shell_open behaviour 2020-10-26 13:26:39 +00:00
PouleyKetchoupp 96e8b904cf Implement SAVE_TARGETS mechanism for Linux clipboard
Allows sending the clipboard content to the clipboard manager on exit to
keep the content when using a clipboard manager that doesn't
automatically makes a backup when copying.

MULTIPLE selection mechanism also had to be implemented, because in this
case, the clipboard manager might request multiple selection targets at
once.

Known use case: Ubuntu with XFCE4
2020-10-09 21:12:56 +02:00
PouleyKetchoupp 48a0d44e67 Fix x11 display server crash when deleting popup window when unfocused
On FocusOut events, the window could be destroyed while propagating
WINDOW_EVENT_FOCUS_OUT event, which causes the WindowData to be
invalidated, and still used for calls to XUnsetICFocus.

This change moves calls to XUnsetICFocus, and also XSetICFocus in
FocusIn events, before propagating the change of focus event to the
engine, to be safe in any case.

Also setting xic member to nullptr after all calls to XDestroyIC to keep
things clean and consistent.

Fixes #42645
2020-10-08 17:22:03 +02:00
PouleyKetchoupp 5a0376f969 Fix delay to process clipboard content from Godot in other programs
When pasting clipboard content from Godot to other applications,
multiple SelectionRequest events are sent to Godot in order to access
the data. It could take a long time before the data is ready for the
other app because events were processed one by one on the main thread,
especially when Godot is unfocused and runs at low frequency.

With this change, SelectionRequest events are directly handled on the
separate event polling thread to minimize this delay.

This change also replaces clipboard_get() calls in SelectionRequest with
a direct access to internal_clipboard, since in this case we know Godot
is the owner of the clipboard content and it's not necessary to query
the x server for it.
2020-09-25 16:40:04 +02:00
PouleyKetchoupp 2c4d64102a Fix general keyboard input lag on X11 display server
This change makes keyboard inputs more responsive on Linux, especially
when the FPS is lower on slower configurations.

Polling events from the x server is done on a separate thread to avoid a
frame delay with inputs, due to first sending the event to the input
manager with XFilterEvent then processing the new event only on the next
frame.

Calls to Input Manager functions like XSetICFocus, XUnsetICFocus and
XSetICValues use a mutex, because they are polling events internally and
would otherwise interfere with our own thread process for polling events
which can cause a deadlock in some cases.

XUnsetICFocus is called instead of XSetICFocus on FocusOut events,
so the input manager can be properly notified of focus changes.

clipboard_get now uses a blocking call to poll for a specific event type
when waiting for a SelectionNotify event, instead of polling all events
and filtering them afterwards.
2020-09-24 16:01:41 +02:00
Rémi Verschelde 413ff7938d
X11: Try to load libXrandr.so.3 if libXrandr.so.2 isn't found
All Linux distros, and FreeBSD and OpenBSD seem to have libXrandr.so.2,
but for some reason recent NetBSD versions seem to have libXrandr.so.3 now.
2020-09-18 11:55:12 +02:00
Rémi Verschelde 5f4d64f4f3
Linux/BSD: Fix support for NetBSD
Add __NetBSD__ to `platform_config.h` so that it can find `alloca`
and use the proper `pthread_setname_np` format.

Rename RANDOM_MAX to avoid conflict with NetBSD stdlib.

Fixes #42145.
2020-09-18 10:27:55 +02:00
bruvzg 6a14c72b12
Add window click-through support. 2020-09-17 12:36:18 +03:00
bruvzg 80b8eff6aa
[Complex Test Layouts] Change String to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
PouleyKetchoupp eeebe6914e Fix drag and drop between windows in X11 display server
Proper implementation for get_window_at_screen_position:
Now getting the topmost last active window when overlapping.

Mouse drag & release events:
They are now propagated through the current focused window, in order to
make it consistent with the engine expectations and the Windows display
server implementation.
2020-09-03 10:31:03 +02:00
PouleyKetchoupp 5315bff002 Fix menu popups delay and focus in X11 display server
Now using override_redirect for menu & tooltip popups to prevent the WM from
interfering with them, so we have more control over focus management
and avoid a delay before they show up.
2020-08-26 18:14:07 +02:00
PouleyKetchoupp 2b49cb0b73 Re-apply "Fixes for windows in X11 tiling WMs"
From PR #38727 which was reverted in #41373 because of regressions in Ubuntu
with Gnome.

Co-authored-by: Lorenzo Cerqua <lorenzocerqua@tutanota.com>
2020-08-22 18:42:42 +02:00
Juan Linietsky 9c5c1635b2
Revert "Fixes for windows in X11 tiling WMs" 2020-08-19 12:37:59 -03:00
Andrii Doroshenko (Xrayez) 6f426c3360 Port ClassDB tests to use doctest
Extracted the most minimal core initialization functionality from
`setup()` and `setup2()` so that `ClassDB` could be tested properly
(input, audio, rendering, physics etc, are excluded).

Display and rendering servers/singletons are not initialized at all.

Due to the fact that most subsystems are disabled, fixed various crashes in the
process (in order):
- `AcceptDialog` OK/cancel swap behavior (used `DisplayServer` while
  `register_scene_types()`);
- `make_default_theme` which depends on `RenderingServer`;
- `XRServer` singleton access while calling `register_modules_types()`;
- hidden bug in a way joypads are cleaned up (MacOS and Linux only).

Removed manual `ClassDB` init/cleanup calls from `test_validate_testing.h`.

ClassDB tests:

Co-authored-by: Ignacio Etcheverry <ignalfonsore@gmail.com>
2020-08-16 16:41:02 +03:00
Rémi Verschelde 33b2070d2e Remove obsolete GLES2 backend code
This code currently isn't compiled (and cannot compile).

We plan to re-add OpenGL ES-based renderer(s) in Godot 4.0 alongside Vulkan
(probably ES 3.0, possibly also a low-end ES 2.0), but the code will be quite
different so it's not relevant to keep this old Godot 3.2 code.

The `drivers/gles2` code from the `3.2` branch can be used as a reference for
a potential new implementation.
2020-08-13 10:04:53 +02:00
opl- a31b164071 Fix losing X11 window normal size hint properties
This was caused by `XSetWMNormalHints` being called multiple times, each time with different values. Calling the method replaces the old data completely, resulting in some of the settings being lost.

Since the method was called 3 times before the window was mapped, this resulted in the position hint being lost and the window always getting opened at a position determined by the WM.
2020-07-31 17:32:46 +02:00
Rémi Verschelde 1cee89467b
Merge pull request #40591 from madmiraal/fix-24526
Update Linux gamepad detection to match SDL.
2020-07-31 13:02:35 +02:00
Rémi Verschelde 3842e8c465
Merge pull request #38727 from Riteo/tiling-wm-issues-tests
Fixes for windows in X11 tiling WMs
2020-07-26 17:41:28 +02:00
RevoluPowered 579342810f t Add unit testing to Godot using DocTest and added to GitHub Actions CI
Implements exit codes into the engine so tests can return their statuses.
Ideally we don't do this, and we use FIXUP logic to 'begin' and 'end' the engine execution for tests specifically.

Since realistically we're initialising the engine here we don't want to do that, since String should not require an engine startup to test a single header.

This lowers the complexity of running the unit tests and even for
physics should be possible to implement such a fix.
2020-07-24 13:05:33 +01:00
Rémi Verschelde dcf902df85 SCons: Remove unused DEBUG_MEMORY_ENABLED define
Its last use was removed in Godot 3.0, so it no longer makes sense to define.

Also removed `D3D_DEBUG_INFO` for Windows as it's likely a left over from a
long time ago pre-opensourcing when Godot had some form of Direct3D 9 support?
2020-07-23 09:39:10 +02:00
Lorenzo Cerqua d670a49612 DisplayServer: separate window showing into another function
When creating a window, Godot would first register it to the WM(show it) and then set its flags.
This works fine on a floating WM, but on tiling WMs as soon as a window gets registered
the WM immediately acts on the window by scaling it up and treating it as a generic window,
being registered without any special flags.

This commit separates the showing of the window into another function and calls it after the most important flags are set,
making windows with special flags(eg. all popups) work again on tiling WMs.

Fixes #37930
2020-07-23 07:58:10 +02:00
Marcel Admiraal 8fe2ecf565 Update Linux gamepad detection to match SDL. 2020-07-22 10:17:39 +01:00
Andy Maloney 4dda62f591 Fix spelling & grammar in comments, docs, and messages 2020-07-21 15:17:23 -04:00
bruvzg 996910b627
Add error messages if Vulkan init failed, prevent Vulkan context freeing uninitialized device and instance. 2020-07-13 19:24:21 +03:00
Rémi Verschelde 9828fcc01a
Merge pull request #40105 from Logharaa/master
Stop looping as soon as the first window that has focus is found
2020-07-04 09:57:14 +02:00
Gaël 6c76639c40 Break loop when the first focused window is found 2020-07-04 01:57:16 +02:00
Juan Linietsky 14263d3d0d Improve the situation of DND on X11 2020-07-03 12:09:22 -03:00
Juan Linietsky 0b7bc83fe3 Add a focus out timeout for X11 to less events of this type are received 2020-07-01 16:14:46 -03:00
Juan Linietsky 239942cfef Ensure embedded mode works again
Also implemented application in/out notifications in X11.
2020-07-01 09:27:43 -03:00
Rémi Verschelde 524f061c01 X11: Ensure XGetWindowProperty data gets freed
And cleanup includes a bit.
2020-06-29 13:32:21 +02:00
bruvzg 92352b1c23
Add keyboard layout enumeration / set / get functions (macOS, Windows, Linux/X11), remove latin variant function. 2020-06-13 11:02:00 +03:00
Rémi Verschelde 0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde 07bc4e2f96 Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
  -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
  -o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```

This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.

This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde 1f6f364a56 Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.

Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
2020-05-14 10:01:56 +02:00