Commit graph

640 commits

Author SHA1 Message Date
Pedro J. Estébanez
0642f3efeb Ignore query to maximize/minimize window on Windows and X11
This makes these platform behave as MacOS in that regard and also fixes the editor window appearing in some cases even when --no-window has been passed.
2020-11-18 00:33:39 +01:00
Connor Lirot
1e01963d29
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**

(cherry picked from commit dd021099ff)
2020-11-17 12:07:01 +01:00
Hugo Locurcio
4907911bf8
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.

(cherry picked from commit ff1f0d2cb5)
2020-11-11 15:12:01 +01:00
Pedro J. Estébanez
3ec62c82a3 Implement no-window mode for X11 and MacOS
Bonus: Homogeinize and improve OS::alert() for no-window mode
2020-11-09 20:56:12 +01:00
Ev1lbl0w
f41cc7d644
Changed shell_open behaviour
(cherry picked from commit 9e57a395cf)
2020-10-28 14:05:41 +01:00
Rémi Verschelde
04fb41a0f3
Merge pull request #42531 from BastiaanOlij/add_get_native_handle
Add get native handle
2020-10-20 13:27:07 +02:00
Bastiaan Olij
1ea7358405 Add get_native_handle to OS 2020-10-20 20:23:37 +11:00
lawnjelly
c2290dbedd Unified GLES2 / GLES3 Batching
Batching is mostly separated into a common template which can be used with multiple backends (GLES2 and GLES3 here). Only necessary specifics are in the backend files.

Batching is extended to cover more primitives.
2020-10-16 10:34:47 +01:00
Rémi Verschelde
1815a90796
Merge pull request #42466 from nekomatata/x11-events-mutex-leak
[3.2] Fix leak with events mutex in OS_X11
2020-10-01 19:10:30 +02:00
PouleyKetchoupp
936c701838 Fix leak with events mutex in x11 Display Server 2020-10-01 16:16:23 +02:00
Rémi Verschelde
4ad74609ce
Merge pull request #40205 from bruvzg/click-through-3
[3.2] Add mouse event pass-through support for window.
2020-10-01 13:58:24 +02:00
Rémi Verschelde
0c3e0ab194
Merge pull request #40994 from qarmin/sanitization32
[3.2] Added Linux sanitizer with xvfb to github workspace
2020-10-01 13:56:09 +02:00
Rémi Verschelde
904773149d
Merge pull request #42341 from nekomatata/x11-events-thread-3.2
[3.2] Fix issues related to delay when processing events on Linux
2020-09-30 16:39:55 +02:00
PouleyKetchoupp
f725d9cb73 Fix issues related to delay when processing events on Linux
3.2 backport of PR #41910:
Fix general keyboard input lag on X11 display server
Fix delay to process clipboard content from Godot in other programs
2020-09-26 15:32:40 +02:00
Rémi Verschelde
8b5061aae7
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.

(cherry picked from commit 413ff7938d)
2020-09-18 11:56:42 +02:00
Rémi Verschelde
cb78a5d7ae
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.

(cherry picked from commit 5f4d64f4f3)
2020-09-18 10:29:52 +02:00
bruvzg
e51fed9d1b
[3.2] Add window click-through support. 2020-09-17 12:36:01 +03:00
Rafał Mikrut
abd7c1833e Added Linux sanitizer with xvfb to github workspace 2020-08-14 12:15:58 +02:00
Rémi Verschelde
f1cdb91f34 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?

(cherry picked from commit dcf902df85)
2020-07-24 10:31:57 +02:00
Rémi Verschelde
08ee1de535 X11: Ensure XGetWindowProperty data gets freed
Fixes a small memory leak reported by lsan:
```
Direct leak of 73 byte(s) in 1 object(s) allocated from:
    #0 0x7f29825f3e70 in malloc (/lib64/liblsan.so.0+0xee70)
    #1 0x7f29824a5729 in XGetWindowProperty (/lib64/libX11.so.6+0x29729)
```
2020-06-29 13:05:24 +02:00
bruvzg
2256946f79
[3.2] Add keyboard layout enumeration / set / get functions (macOS, Windows, Linux/X11). 2020-06-13 11:01:49 +03:00
Rémi Verschelde
7bf9787921 SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.

psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:

- Manually wrapped strings will be reflowed, so by using a line length
  of 120 for the sake of preserving readability for our long command
  calls, it also means that some manually wrapped strings are back on
  the same line and should be manually merged again.

- Code generators using string concatenation extensively look awful,
  since black puts each operand on a single line. We need to refactor
  these generators to use more pythonic string formatting, for which
  many options are available (`%`, `format` or f-strings).

- CI checks and a pre-commit hook will be added to ensure that future
  buildsystem changes are well-formatted.

(cherry picked from commit cd4e46ee65)
2020-06-10 15:30:52 +02:00
Technohacker
0456311be3
Don't force borderless mode when using per-pixel transparency 2020-05-10 21:05:37 +05:30
bruvzg
da2ca9e22a [Linux/Windows] Set pressure to 1.0f when primary button is pressed and device is not pressure sensitive.
(cherry picked from commit 0128947894)
2020-05-05 13:41:29 +02:00
Marcel Admiraal
a286edb821 Fix X11 pressure and tilt values.
(cherry picked from commit a2ad0878ed)
2020-05-05 13:41:29 +02:00
Marcel Admiraal
b4ab045444 Fix loss of precision in X11 device info.
(cherry picked from commit 9369b37f1f)
2020-04-16 12:47:19 +02:00
Rémi Verschelde
acd14e645a Remove unused classes and stray headers
Found by reviewing headers with 1 or less matching includes:
```
find -name thirdparty -prune -o -name "*.h" -exec basename {} \; | sort -u > headers
for header in $(cat headers); do echo "$header: "; rg -l "#include \"(.*/)?$header\"" | wc -l; done > list-includes
```

(cherry picked from commit 9d24541597)
2020-03-25 11:38:54 +01:00
Rajat Goswami
19e71f94d8 Adding missing include guards to header files identified by LGTM.
This addresses the issue godotengine/godot#37143

(cherry picked from commit 2ecf928ae3)
2020-03-25 11:38:54 +01:00
m6c7l
dec7014ca8 issue-37239 add relaxation to conditions in the joystick check routine for being identified as joystick
(cherry picked from commit 36293f4256)
2020-03-25 11:38:54 +01:00
Rémi Verschelde
ec752f7c9b Linux: Add Mesa 20 "Intel" to prime detection
Diff in `glxinfo` between Mesa 19.3.4 and 20.0.1:
```diff
-OpenGL vendor string: Intel Open Source Technology Center
-OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 630 (Kaby Lake GT2)
-OpenGL core profile version string: 4.6 (Core Profile) Mesa 19.3.4
+OpenGL vendor string: Intel
+OpenGL renderer string: Mesa Intel(R) HD Graphics 630 (KBL GT2)
+OpenGL core profile version string: 4.6 (Core Profile) Mesa 20.0.1
```

(cherry picked from commit db28e7ef69)
2020-03-25 11:38:53 +01:00
Rémi Verschelde
98d0bf7d7a assimp: Clean and document buildsystem, prepare for unbundling
- Improve the SCsub to allow unbundling and remove unnecessary code.
- Move files around to match upstream source.
- Re-sync with upstream commit 308db73d0b3c2d1870cd3e465eaa283692a4cf23
  to ensure we don't have local modifications.
- Doesn't actually build against current version 5.0.1 due to the lack
  of the new ArmaturePopulate API that Gordon authored. We'll have to
  wait for a public release with that API (5.1?) to enable unbundling.

(cherry picked from commit 9d8a9ea826)
2020-03-06 23:53:23 +01:00
Rémi Verschelde
75164169c4 SCons: Fix get_compiler_version() to return ints
Otherwise comparisons would fail for compiler versions above 10.
Also simplified code somewhat to avoid using subprocess too much
needlessly.

(cherry picked from commits c7dc5142b5
and df7ecfc4a7)
2020-03-04 14:40:12 +01:00
bruvzg
a7ff22ea6d Fix pressure / tilt ranges on Linux.
(cherry picked from commit d552f93f8b)
2020-02-14 15:58:15 +01:00
Yuri Roubinsky
e8474435e5 Restores correct window position after fullscreen toggling off on Linux
(cherry picked from commit 90f00c0813)
2020-02-06 13:02:07 +01:00
Yuri Roubinsky
8c689f7d4a Fix restoring window from fullscreen to normal on Linux
(cherry picked from commit 8737269275)
2020-02-06 13:02:07 +01:00
Rémi Verschelde
05fc26de1c
Merge pull request #35444 from RandomShaper/fix_link_bsd
Fix error with linkers other than GNU ld
2020-01-23 07:57:02 +01:00
Pedro J. Estébanez
35dd36ca35 Fix error with linkers other than GNU ld 2020-01-22 22:38:08 +01:00
Eric Rybicki
67261b1e87 Remove buggy check if key was already released for accumulated input
Fixes #27104
2020-01-22 17:03:33 +01:00
Rémi Verschelde
6b64c60b0e
Merge pull request #35209 from RandomShaper/fix_pck_embed_linux
Fix error exporting to X11 with embedded PCK
2020-01-16 18:45:20 +01:00
Pedro J. Estébanez
4eeae59293 Fix error exporting to X11 with embedded PCK
Fixes #32513.
2020-01-16 17:47:37 +01:00
Rémi Verschelde
c7b701dfd2 Image: Include S3TC compression via Squish in non-tools build
We already build Squish in templates build for S3TC decompression,
so we can as well expose the compression feature.

Fixes #25640.
2020-01-13 15:58:49 +01:00
Rémi Verschelde
3f8c93dffe Fix warning in Linux crash handler on 32-bit 2020-01-10 14:28:21 +01:00
Rémi Verschelde
8454804972
Merge pull request #33967 from Calinou/add-os-is-window-focused
Add an `OS.is_window_focused()` getter
2020-01-06 11:39:18 +01:00
Rémi Verschelde
a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
bruvzg
2ef8c5fac5
iOS modular build and export implementation. 2019-12-01 21:57:18 +02:00
Hugo Locurcio
21a3923410
Add an OS.is_window_focused() getter
This makes it possible to know whether the window is focused
at a given time, without having to track the focus state manually
using `NOTIFICATION_WM_FOCUS_IN` and `NOTIFICATION_WM_FOCUS_OUT`.

This partially addresses #33928.
2019-11-28 16:42:51 +01:00
Rémi Verschelde
d191ffb47d X11: Fix memory leak in handle_key_event
Extracted from #27189.
2019-11-12 07:51:51 +01:00
bruvzg
f675621725
[macOS, Windows, X11] Add graphic tablet pen pressure and tilt support to InputEventMouseMotion event. 2019-10-30 14:42:21 +02:00
bruvzg
2a76fba1f6
Fix X11 modifier keys. 2019-10-12 00:09:14 +03:00
PouleyKetchoupp
5bfe32eaa4 Properly revert cursor when using set_custom_mouse_cursor with null
Fixes #32486
2019-10-03 13:02:11 +02:00