Commit graph

640 commits

Author SHA1 Message Date
Michele Valente
51f9042a5b add option to use ThinLTO
This adds ThinLTO support when using Clang and the LLD Linker, it's
turned off by
default.
For now only support for Linux added as ThinLTO support on other
platforms may still be buggy.
2019-04-25 19:20:12 +02:00
Rémi Verschelde
c2a669a9f0 SCons: Review uses of CCFLAGS, CXXFLAGS and CPPFLAGS
Many contributors (me included) did not fully understand what CCFLAGS,
CXXFLAGS and CPPFLAGS refer to exactly, and were thus not using them
in the way they are intended to be.

As per the SCons manual: https://www.scons.org/doc/HTML/scons-user/apa.html

- CCFLAGS: General options that are passed to the C and C++ compilers.
- CFLAGS: General options that are passed to the C compiler (C only;
  not C++).
- CXXFLAGS: General options that are passed to the C++ compiler. By
  default, this includes the value of $CCFLAGS, so that setting
  $CCFLAGS affects both C and C++ compilation.
- CPPFLAGS: User-specified C preprocessor options. These will be
  included in any command that uses the C preprocessor, including not
  just compilation of C and C++ source files [...], but also [...]
  Fortran [...] and [...] assembly language source file[s].

TL;DR: Compiler options go to CCFLAGS, unless they must be restricted
to either C (CFLAGS) or C++ (CXXFLAGS). Preprocessor defines go to
CPPFLAGS.
2019-04-24 16:57:58 +02:00
Hein-Pieter van Braam
01f7166d09
Merge pull request #26961 from ibrahn/fix-x11setcontext-access-freed
fixed an access after free in OS_X11::set_context. (long version)
2019-04-23 06:14:49 +03:00
Hein-Pieter van Braam
a76d59cba9
Merge pull request #27208 from Calinou/add-lld-linker
Add support for linking using LLD on X11
2019-04-23 06:11:48 +03:00
Ibrahn Sahir
9d0b3b300c fixed an access after free in OS_X11::set_context.
Added constructor and assignment operator for CharString
from const char* to simplify memory management when working with
utf8/ascii strings for APIs taking char*.
Reworked OS_X11::set_context to use CharString and avoid some manual
memory management.
2019-04-22 13:34:17 +01:00
Rémi Verschelde
a342131eba
Merge pull request #27673 from qarmin/small_fixes
Small fixes, mostly duplicated code
2019-04-22 12:00:34 +02:00
Guilherme Felipe
1bae73d7d0 Add Input::get_current_cursor_shape
[Clean up] Removed unused/unnecessary methods.
2019-04-15 15:22:09 -03:00
Fabio Alessandrelli
0bcf0314f7 Fix jump over uninitialized value in OS Unix/X11 2019-04-09 15:12:55 +02:00
qarmin
856a8226a5 Small fixes, mostly dupicated code 2019-04-08 11:03:37 +02:00
Rémi Verschelde
c562a7d149
Merge pull request #27067 from shartte/remove-context-gl
Remove ContextGL
2019-04-07 12:38:55 +02:00
Hendrikto
49a81308c0 Remove unused imports 2019-04-06 18:05:05 +02:00
Sebastian Hartte
3a8c6db513 Remove ContextGL since as an abstraction it's unused. 2019-04-06 17:52:52 +02:00
Rémi Verschelde
e4a96164b6 SCons: add methods.using_clang to check used compiler
Also rename `use_gcc` to `using_gcc` to make it clear that it returns
a config but does not alter it.
2019-04-05 12:51:15 +02:00
qarmin
8460d0678c Small fixes to static analyzer bugs 2019-04-04 22:00:16 +02:00
Rémi Verschelde
44f1b390a3 SCons: Fix python3 compat for builtin_bullet=no 2019-04-03 11:25:01 +02:00
Pedro J. Estébanez
9c3ddf05cb Revert accidental commits
This reverts commit fb37284c02.
This reverts commit 4db0f51b9a.
2019-03-20 21:43:55 +01:00
Pedro J. Estébanez
fb37284c02 Create class for shared memory blocks [wip] 2019-03-20 20:44:43 +01:00
Hugo Locurcio
fd7f253649
Add support for linking using LLD on X11
LLD is often faster than GNU ld and gold, resulting in a better
development experience.

This closes #15364.
2019-03-18 16:52:00 +01:00
bruvzg
85cc435103
[X11] Fix get_window_position to return absolute coordinates, change set_window_position to take window decorations into account. 2019-03-12 19:09:16 +02:00
Ibrahn Sahir
7822cc9329 fix for access after free in OS_X11::set_context. 2019-03-12 13:41:02 +00:00
Rémi Verschelde
b4d5c1ab5b
Merge pull request #26633 from akien-mga/driver-fallback-etc
Disable driver fallback to GLES2 by default
2019-03-06 00:57:49 +01:00
marxin
f0d2f079c4 Replace usage of __bswap_16 with BSWAP16 (#25714). 2019-03-05 22:17:20 +01:00
Rémi Verschelde
b0f782a0e3 Disable driver fallback to GLES2 by default
GLES2 is not designed to be a drop-in replacement for the GLES3 backend,
so the fallback mode has to be used knowingly. It *can* make sense for
simple projects which make sure to handle the differences between both
rendering backends, but most users should stick to one supported backend.

By making it opt-in, we can now use this parameter to define whether to
export ETC textures to Android and iOS when using GLES3 + Fallback.

When using GLES3 without Fallback on Android, set the proper min GLES
version in the AndroidManifest.

Also made the option boolean and renamed it for clarity and to avoid
conflict with the previous String option (which would always evaluate as
"true" otherwise).

Fixes #26569.
2019-03-05 16:36:46 +01:00
Juan Linietsky
a1e73dcc94 Add support for event accumlation (off by default, on for editor), fixes #26536 2019-03-03 19:53:13 -03:00
Rémi Verschelde
c77c4ef3b1 SCons: Reduce spam from x11:can_build
When cross-compiling for non-X11 on Linux, it used to be quite spammy.
Now it will only print errors if you miss more than just pkg-config and x11.
2019-03-02 10:39:20 +01:00
Rémi Verschelde
1e266d874d X11: Fix drag and drop from non-latin paths
Fixes #25826.

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2019-02-28 12:32:39 +01:00
marxin
e5f665c718 Fix -Wsign-compare warnings.
I decided to modify code in a defensive way. Ideally functions
like size() or length() should return an unsigned type.
2019-02-27 07:45:57 +01:00
Juan Linietsky
5eeb06ffd1 -Remove harcoded opengl extension testing from OS, ask rasterizer instead.
-Fixed a bug where etc textures were imported broken
2019-02-26 11:58:47 -03:00
marxin
0d2a105e6b Come up with use_gcc.
Add new method. Fix wrong version condition for -fpie.
2019-02-23 09:17:11 +01:00
marxin
7de7f0ef17 Fix all -Wtype-limits warnings. 2019-02-21 19:34:35 +01:00
marxin
8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00
Rémi Verschelde
89eb79aef1
Merge pull request #25879 from hpvb/fix-25629
Detect when primusrun/optirun is in use
2019-02-14 17:06:20 +01:00
Hein-Pieter van Braam
84627140d7 Detect when primusrun/optirun is in use
It seems that bumblebee doesn't like us creating multiple GL contexts
to avoid this we now detect whether we're running with this software
and don't do anything.
2019-02-14 15:50:47 +00:00
Hein-Pieter van Braam
e3aa67792c Don't crash if there's no application name
This fixes #25852
2019-02-14 14:55:51 +00:00
Rémi Verschelde
bc26d0d6cd Platform: Ensure classes match their header filename
Also drop some unused files.

Renamed:
- `platform/iphone/sem_iphone.h` -> `semaphore_iphone.h`
  (same for `osx`)
- `platform/uwp/gl_context_egl.h` -> `context_egl_uwp.h`
- in `platform/windows`: `context_gl_win.h`, `crash_handler_win.h`,
  `godot_win.cpp`, `joypad.h` and `key_mapping_win.h` all renamed to
  use `windows`. Some classes renamed accordingly too.
- `EditorExportAndroid` and `EditorExportUWP` renamed to
  `EditorExportPlatformAndroid` and `EditorExportPlatformUWP`
- `power_android` and `power_osx` renamed to `PowerAndroid` and
  `PowerOSX`
- `OSUWP` renamed to `OS_UWP`

Dropped:
- `platform/windows/ctxgl_procaddr.h`
2019-02-12 16:56:25 +01:00
Rémi Verschelde
75dae1b9a9 Drivers, main, servers: Ensure classes match their header filename
Renamed:
- `drivers/alsamidi/alsa_midi.h` -> `midi_driver_alsamidi.h`
  (same for `coremidi` and `winmidi`)
- `main/timer_sync.h` -> `main_timer_sync.h`
- `servers/visual/visual_server_global.h` -> `visual_server_globals.h`
2019-02-12 14:39:47 +01:00
Hein-Pieter van Braam
d308eb091a Fix many asan and ubsan reported issues
This allows most demos to run without any ubsan or asan errors. There
are still some things in thirdpart/ and some things in AudioServer that
needs a look but this fixes a lot of issues. This should help debug less
obvious issues, hopefully.

This fixes #25217 and fixes #25218
2019-01-30 06:43:56 +01:00
Hein-Pieter van Braam
9c308023bb Properly detect when to use DRI_PRIME
We fork off twice once with and once without DIR_PRIME=1 set. We
then use the vendor string to determine what GPU to use.

We prefer (in order)
1) AMDGPU/AMDGPU-PRO/NVidia non-free driver
2) Intel driver
3) Nouveau
4) Software rendering

If a driver can't be detected it will default to DRI_PRIME=0
2019-01-28 16:21:07 +00:00
marxin
e558773e21 Rename sanitizer option names.
Make the sanitizer names more explicit (use_ubsan, use_asan, use_lsan).
Comment has been adjusted to include GCC as supported compiler for these
and exclude -fno-omit-frame-pointer option (should not cause any
problems).
2019-01-21 08:10:15 +01:00
Hein-Pieter van Braam
e5b335d367 Don't use -ffast-math or other unsafe math optimizations
Godot supports many different compilers and for production releases we
have to support 3 currently: GCC8, Clang6, and MSVC2017. These compilers
all do slightly different things with -ffast-math and it is causing
issues now. See #24841, #24540, #10758, #10070. And probably other
complaints about physics differences between release and release_debug
builds.

I've done some performance comparisons on Linux x86_64. All tests are
ran 20 times.

Bunnymark: (higher is better)
(bunnies)    min    max  stdev average
fast-math   7332   7597    71     7432
this pr     7379   7779   108     7621 (102%)

FPBench (gdscript port http://fpbench.org/) (lower is better)
(ms)
fast-math  15441  16127   192    15764
this pr    15671  16855   326    16001  (99%)

Float_add (adding floats in a tight loop) (lower is better)
(sec)
fast-math   5.49   5.78  0.07     5.65
this pr     5.65   5.90  0.06     5.76  (98%)

Float_div (dividing floats in a tight loop) (lower is better)
(sec)
fast-math  11.70  12.36  0.18    11.99
this pr    11.92  12.32  0.12    12.12  (99%)

Float_mul (multiplying floats in a tight loop) (lower is better)
(sec)
fast-math  11.72  12.17  0.12    11.93
this pr    12.01  12.62  0.17    12.26  (97%)

I have also looked at FPS numbers for tps-demo, 3d platformer, 2d
platformer, and sponza and could not find any measurable difference.

I believe that given the issues and oft-reported (physics) glitches on
release builds I believe that the couple of percent of tight-loop
floating point performance regression is well worth it.

This fixes #24540 and fixes #24841
2019-01-09 02:06:13 +01:00
Hein-Pieter van Braam
b1e3215f3a
Merge pull request #24477 from lupoDharkael/nouveau
Don't enable DRI_PRIME if nouveau is loaded
2019-01-03 23:35:47 +01:00
Rémi Verschelde
b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Lee Pugh
b3ff366467 Fix missed captured mouse events on x11 2018-12-21 14:12:47 -06:00
lupoDharkael
bfade869f3 Don't enable DRI_PRIME if nouveau is loaded 2018-12-20 11:51:26 +01:00
Mikko Mustonen
9974f6c56f switch middle and secondary mouse buttons order 2018-12-15 15:10:06 +02:00
Cosmic Chip Socket
cf124b1415 Use XInput2 RawMotion to generate MouseMotion events
The current system for capturing the mouse and generating motion events on X11
has issues with inaccurate and lopsided input. This is because both
XQueryPointer and XWarpPointer work in terms of integer coordinates when the
underlying X11 input driver may be tracking the mouse using subpixel
coordinates. When warping the pointer, the fractional part of the pointer
position is discarded.

To work around this issue, the fix uses raw motion events from XInput 2. These
events report relative motion and are not affected by pointer warping.
Additionally, this means Godot is able to detect motion at a higher resolution
under X11. Because this is raw mouse input, it is not affected by the user's
pointer speed and acceleration settings. This is the same system as SDL2 uses
for its relative motion.

Multitouch input on X requires XInput 2.2. Raw motion events require
XInput 2.0. Since 2.0 is old enough, this is now the minimum requirement to
use Godot on X.
2018-12-14 23:51:20 +01:00
Rémi Verschelde
5f32fc8208
Merge pull request #20385 from moiman100/unify-double-clicking
Added double clicking to all buttons on Linux and Javascript
2018-12-14 23:47:03 +01:00
Rémi Verschelde
57c3f6a94b
Merge pull request #20063 from moiman100/fix-button-mask
Unified button mask behavior across platforms
2018-12-14 23:31:52 +01:00
Rémi Verschelde
dc2fadc14d
Merge pull request #22733 from guilhermefelipecgs/fix_wm_class
[x11] Use "application/config/name" for WM_CLASS
2018-12-07 22:35:17 +01:00
Marcelo Fernandez
385832ed30 Fix X11 running a project with fullscreen setting on and resizable off with multiple screens 2018-11-18 23:03:54 -03:00
Ibrahn Sahir
4c90a66e74 Fix gcc version check when running scons in python 3. 2018-11-14 12:25:50 +00:00
Marcelo Fernandez
8705c01f5a Fix compile recent compile issues with gcc 5.5 2018-11-12 10:24:44 -03:00
Rémi Verschelde
06c42d151c
Merge pull request #23542 from marcelofg55/no_pie
Fix binaries incorrectly detected as shared libraries on some linux distros
2018-11-09 16:12:16 +01:00
Marcelo Fernandez
34e2d2f4f7 Fix binaries incorrectly detected as shared libraries on some linux distros 2018-11-07 12:39:15 -03:00
Hein-Pieter van Braam
0aad11a6a7 Set DRI_PRIME=1 by default on X11 if not already set
This mirrors behavior on Windows and MacOSX where Godot tries to default
to a dGPU if it exists. This doesn't work for Nvidia optimus yet but
this can maybe be added later.
2018-11-06 22:31:35 +01:00
Rémi Verschelde
8ac1bcfd3d Fix init of VisualServerRaster
Contrarily to what #23434 assumed, this is not a memory leak,
the VisualServerRaster instance is passed as a parameter to
VisualServerWrapMT's constructor.

Fixes #23437.
2018-11-01 19:23:12 +01:00
George Marques
4c9d734a75 Fix initialization of visual server in all platforms
Avoid leaking an extra instance when using threads. Also fix threaded
loading issues on Android and iOS.
2018-11-01 10:27:04 -03:00
M. Huri
b46ba24e3b Repaired mistyped of 'its' on several files. 2018-10-25 07:19:21 +07:00
Fabio Alessandrelli
f8020bc976 Check getcwd return in X11 platform main. 2018-10-07 14:50:14 +02:00
Aaron Franke
4f7b33cdcf Remove redundant "== false" code
Some of this code has been re-organized.
f
2018-10-06 16:20:41 -04:00
Aaron Franke
37386f112b Remove redundant "== true" code
If it can be compared to a boolean, it can be evaluated as one in-place.
2018-10-06 16:12:36 -04:00
Guilherme Felipe
f402253939 [x11] Use "application/config/name" for WM_CLASS 2018-10-05 17:18:10 -03:00
Rémi Verschelde
c026e3957a Fix warnings on virtual methods [-Woverloaded-virtual] [-Wdelete-non-virtual-dtor]
Fixes the following Clang 7 warnings:
```
editor/editor_help.h:123:7: warning: 'EditorHelpIndex::popup' hides overloaded virtual function [-Woverloaded-virtual]
editor/editor_help.h:95:7: warning: 'EditorHelpSearch::popup' hides overloaded virtual function [-Woverloaded-virtual]
editor/editor_help.h:96:7: warning: 'EditorHelpSearch::popup' hides overloaded virtual function [-Woverloaded-virtual]
editor/plugins/curve_editor_plugin.h:141:15: warning: 'CurvePreviewGenerator::generate' hides overloaded virtual function [-Woverloaded-virtual]
editor/plugins/script_editor_plugin.h:70:7: warning: 'ScriptEditorQuickOpen::popup' hides overloaded virtual function [-Woverloaded-virtual]
editor/quick_open.h:69:7: warning: 'EditorQuickOpen::popup' hides overloaded virtual function [-Woverloaded-virtual]
main/tests/test_io.cpp:53:15: warning: 'TestIO::TestMainLoop::input_event' hides overloaded virtual function [-Woverloaded-virtual]
servers/audio/effects/audio_effect_record.h:69:15: warning: 'AudioEffectRecordInstance::process_silence' hides overloaded virtual function [-Woverloaded-virtual]

core/os/memory.h:119:2: warning: destructor called on non-final 'ContextGL_X11' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
core/os/memory.h:119:2: warning: destructor called on non-final 'EditorScriptCodeCompletionCache' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
core/os/memory.h:119:2: warning: destructor called on non-final 'Engine' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
core/os/memory.h:119:2: warning: destructor called on non-final 'PhysicalBone::JointData' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
core/os/memory.h:119:2: warning: destructor called on non-final 'VisualServerScene' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
core/os/memory.h:119:2: warning: destructor called on non-final 'VisualServerViewport' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
```
2018-10-02 13:40:17 +02:00
LikeLakers2
5515c303f8 Changed the comment where reduz yells at the X11 API to a less explicitive one 2018-10-01 19:09:03 -04:00
Rémi Verschelde
b1b625f4f5 Fix various Clang 7 warnings about unused stuff
Namely:
[-Wunneeded-internal-declaration]
[-Wunused-comparison]
[-Wunused-const-variable]
[-Wunused-function]
[-Wunused-private-fields]

Fixes the following Clang 7 warnings:
```
editor/plugins/script_editor_plugin.cpp:1417:20: warning: function '_find_node_with_script' is not needed and will not be emitted [-Wunneeded-internal-declaration]
editor/scene_tree_dock.cpp:1859:14: warning: function '_find_last_visible' is not needed and will not be emitted [-Wunneeded-internal-declaration]

modules/gdscript/gdscript_parser.cpp:7838:19: warning: equality comparison result unused [-Wunused-comparison]

scene/resources/mesh.cpp:549:35: warning: unused variable '_array_types' [-Wunused-const-variable]
scene/resources/mesh.cpp:563:18: warning: unused variable '_format_translate' [-Wunused-const-variable]

drivers/gles3/rasterizer_scene_gles3.cpp:54:28: warning: unused function 'store_transform2d' [-Wunused-function]

core/io/file_access_network.h:50:6: warning: private field 'ml' is not used [-Wunused-private-field]
core/io/file_access_zip.h:93:14: warning: private field 'archive' is not used [-Wunused-private-field]
core/io/resource_format_binary.h:122:6: warning: private field 'bin_meta_idx' is not used [-Wunused-private-field]
core/message_queue.h:47:9: warning: private field 'mutex' is not used [-Wunused-private-field]
main/tests/test_gui.cpp:63:11: warning: private field 'control' is not used [-Wunused-private-field]
modules/gdscript/gdscript_parser.h:558:7: warning: private field 'completion_static' is not used [-Wunused-private-field]
platform/x11/os_x11.h:148:11: warning: private field 'ip_unix' is not used [-Wunused-private-field]
platform/x11/os_x11.h:180:7: warning: private field 'net_wm_icon' is not used [-Wunused-private-field]
platform/x11/os_x11.h:189:6: warning: private field 'audio_driver_index' is not used [-Wunused-private-field]
platform/x11/os_x11.h:190:15: warning: private field 'capture_idle' is not used [-Wunused-private-field]
servers/physics/body_pair_sw.h:79:6: warning: private field 'cc' is not used [-Wunused-private-field]
servers/visual/visual_server_raster.h:62:7: warning: private field 'draw_extra_frame' is not used [-Wunused-private-field]
```
2018-10-01 17:32:12 +02:00
Rémi Verschelde
6bfb7944d9 SCons: Remove avoidable defines from main env's CPPPATH
Also finally move freetype to its own env and disable warnings for it.
Still needs some work to fix the awkward situation of the freetype and
svg modules used in scene/ and editor/ respectively.
2018-10-01 11:59:22 +02:00
Rémi Verschelde
3a2ca68af3 SCons: Build thirdparty code in own env, disable warnings
Also remove unnecessary `Export('env')` in other SCsubs,
Export should only be used when exporting *new* objects.
2018-09-28 14:07:39 +02:00
Rémi Verschelde
5adf7aa6b7 SCons: Fix checks for clang in env['CXX']
They would match the whole path instead of only the filename.
2018-09-25 11:15:25 +02:00
Ibrahn Sahir
653b832422 Fixed hang when segfaulting after OS object destroyed (OSX and X11)
The two POSIX style crash handlers (OSX and X11) now remove their signal
handlers when they are destroyed.
Additonally if they are called while no OS singleton is set, they will
simply abort(). This should not happen now that they remove themselves,
but if a future change seperates OS object and crash handler lifetimes,
this may be easier to report/debug than hanging on SIGSEGV.
2018-09-24 22:21:05 +01:00
Rémi Verschelde
0274ded34c
Merge pull request #22070 from capnm/fix_Input.set_default_cursor_shape_take2
Fix set_default_cursor_shape interaction with Control nodes
2018-09-19 09:26:21 +02:00
Guilherme Felipe
360204e532 Fix Input::set_custom_mouse_cursor showing cursor when it's invisible 2018-09-17 11:37:54 -03:00
Martin Capitanio
64cecf9d61 Fix set_default_cursor_shape interaction with Control nodes
Do not call `set_cursor_shape` when the cursor is inside the `Control` node.

Make it work for x11 in MOUSE_MODE_CONFINED.
2018-09-15 20:54:22 +02:00
Guilherme Felipe
04aef23585 Fix set_custom_mouse_cursor changing to incorrect cursor shape
[Docs] Add class ref for Input::set_default_cursor_shape
2018-09-13 15:13:57 -03:00
Rémi Verschelde
fe78aa0c30
Merge pull request #21753 from guilhermefelipecgs/fix_confined_mode
Fixes to mouse mode confined and captured
2018-09-12 21:37:30 +02:00
Rémi Verschelde
143f522adb
Merge pull request #21914 from hpvb/fix-21720
When resizing an X11 window wait for the WM to process our request
2018-09-12 14:36:57 +02:00
Rémi Verschelde
a4958bb867
Merge pull request #21910 from hpvb/fix-8145-x11
Update X11 global mouse position at startup
2018-09-12 11:03:36 +02:00
Rémi Verschelde
277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Hein-Pieter van Braam
9a1deedb84 When resizing an X11 window wait for the WM to process our request
On X11 when we send an XResizeWindow request to the X server it is happy
to say it is done when the request has been handed over to the window
manager. The window manager itself may however take some time to
actually do the resize. Godot expects that a resize request is
immediate. To work around this issue we could implement the whole
_NET_WM_SYNC_REQUEST protocol. However this protocol does not fit very
well with the way we currently process X events and would when
implemented in the current framework still cause a 1 frame delay between
a resize request and the actual resize happening.

This fixes #21720
2018-09-10 00:12:23 +02:00
Hein-Pieter van Braam
4b92ca1cce Update X11 global mouse position at startup
When we start the engine we haven't yet gotten any X11 motion events so
we don't yet know where our mouse cursor is located. Instead we now
query the X server for this information when we start and update the
appropriate values.

In addition when we move the window we also update the mouse position
based off of X server knowledge as we will also not have received any
mouse motion events.

this fixes #8145 (for X11 only)
2018-09-09 22:17:27 +02:00
Guilherme Felipe
7d6364d431 Fixes to mouse mode confined and captured
These modes will work on Linux in the same way as Windows.
2018-09-05 11:24:06 -03:00
Martin Capitanio
bcee65284e Really fix the custom cursor hotspot
Add check for negative values.

Fixes #21721
2018-09-04 04:42:23 +02:00
Guilherme Felipe
e5470cfa70 Fix custom cursor hotspot
Cursor hotspot must be inside image on Linux. Adding validation for all
platforms for consistency.
2018-09-03 09:57:07 -03:00
Rémi Verschelde
c1f687c681
Merge pull request #21387 from hpvb/fix-15324
Fall back to GLES2 if GLES3 is not working
2018-08-27 16:54:22 +02:00
Hein-Pieter van Braam
3d4b7c6c5f When setting an X11 icon fails, try halving the size
When setting an icon that is too large previously Godot would die with a
X Error of failed request:  BadLength error. To avoid this we install an
error handler right before we set an icon. If the error handler triggers
we halve the icon size until it works or until we've reached a 0 size on
either width or height.

We print a warning when this happens to alert developers.

This fixes #19716
2018-08-27 01:28:11 +02:00
Hein-Pieter van Braam
08f452d1a9 Fall back to GLES2 if GLES3 is not working
This adds a static is_viable() method to all rasterizers which has to be
called before initializing the rasterizer. This allows us to check what
rasterizer to use in OS::initialize together with the GL context
initialization.

This commit also adds a new project setting
"rendering/quality/driver/driver_fallback" which allows the creator of a
project to specify whether or not fallback to GLES2 is allowed. This
setting is ignored for the editor so the editor will always open even if
the project itself cannot run. This will hopefully reduce confusion for
users downloading projects from the internet.

We also no longer crash when GLES3 is not functioning on a platform.

This fixes #15324
2018-08-26 16:40:46 +02:00
Hein-Pieter van Braam
c8464eb69f Support more X11 dialogs for X11::alert()
Modern distributions such as Fedora do not ship 'xdialog' with their
default deployment. This commit adds support for Gnome's Zenity as well
as KDE's kdialog.
2018-08-25 00:53:45 +02:00
Juan Linietsky
c6b340ea98
Merge pull request #20712 from marcelofg55/midi_open_close
Add OS::open_midi_inputs and OS::close_midi_inputs
2018-08-24 12:17:14 -03:00
Rémi Verschelde
52466d57e9 Make some debug prints verbose-only, remove others 2018-08-24 14:59:01 +02:00
Rémi Verschelde
de59fe04e7 Add print_verbose to print to stdout only in verbose mode
Equivalent of the cumbersome:
if (OS::get_singleton()->is_stdout_verbose())
	print_line(msg);
2018-08-24 09:23:20 +02:00
elasota
35f6ba5c5d BPTC support 2018-08-21 22:56:04 -04:00
Hein-Pieter van Braam
827cadafc8 Replace XRaiseWindow with a _NET_ACTIVE_WINDOW ClientRequest
This fixes the editor on X11 not getting put on the foreground when a
debugged project hits an error or breakpoint.
2018-08-16 21:36:37 +02:00
Mikko Mustonen
51fa23a52a Added double clicking to all buttons 2018-08-12 12:41:31 +03:00
Marcelo Fernandez
05fc12ddb6 Add OS::open_midi_inputs and OS::close_midi_inputs 2018-08-04 10:07:46 -03:00
Viktor Ferenczi
c5bd0c37ce Running builder (content generator) functions in subprocesses on Windows
- Refactored all builder (make_*) functions into separate Python modules along to the build tree
- Introduced utility function to wrap all invocations on Windows, but does not change it elsewhere
- Introduced stub to use the builders module as a stand alone script and invoke a selected function

There is a problem with file handles related to writing generated content (*.gen.h and *.gen.cpp)
on Windows, which randomly causes a SHARING VIOLATION error to the compiler resulting in flaky
builds. Running all such content generators in a new subprocess instead of directly inside the
build script works around the issue.

Yes, I tried the multiprocessing module. It did not work due to conflict with SCons on cPickle.
Suggested workaround did not fully work either.

Using the run_in_subprocess wrapper on osx and x11 platforms as well for consistency. In case of
running a cross-compilation on Windows they would still be used, but likely it will not happen
in practice. What counts is that the build itself is running on which platform, not the target
platform.

Some generated files are written directly in an SConstruct or SCsub file, before the parallel build starts. They don't need to be written in a subprocess, apparently, so I left them as is.
2018-07-27 21:37:55 +02:00
Hein-Pieter van Braam
0e29f7974b Reduce unnecessary COW on Vector by make writing explicit
This commit makes operator[] on Vector const and adds a write proxy to it.  From
now on writes to Vectors need to happen through the .write proxy. So for
instance:

Vector<int> vec;
vec.push_back(10);
std::cout << vec[0] << std::endl;
vec.write[0] = 20;

Failing to use the .write proxy will cause a compilation error.

In addition COWable datatypes can now embed a CowData pointer to their data.
This means that String, CharString, and VMap no longer use or derive from
Vector.

_ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug
builds. This is a lot faster for Vector in the editor and while running tests.
The reason why this difference used to exist is because force-inlined methods
used to give a bad debugging experience. After extensive testing with modern
compilers this is no longer the case.
2018-07-26 00:54:16 +02:00
Rémi Verschelde
a501678ba1
Merge pull request #20154 from marcelofg55/midi_driver
Added a new MIDIDriver class
2018-07-25 01:17:57 +02:00
Rémi Verschelde
8e4de57e56 SCons: Add "execinfo" option to force linking libexecinfo
Fixes #20035.
2018-07-22 19:03:52 +02:00
Juan Linietsky
2b9902db06 -Fix disable_3d flag
-Add extra flag optimize=[size,speed] to be able to prioritize size
2018-07-21 17:26:49 -03:00
Marcelo Fernandez
7a5f9fc08e Added a new MIDIDriver class 2018-07-21 09:09:42 -03:00
Rémi Verschelde
814fdd3985 Fix some more build issues after c69de2ba4
Fixes #20301.
2018-07-20 11:56:18 +02:00
Juan Linietsky
c69de2ba46 -Project/Editor settings now use new inspector
-Project/Editor settings now show tooltips properly
-Settings thar require restart now will show a restart warning
-Video driver is now visible all the time, can be changed easily
-Added function to request current video driver
2018-07-19 19:02:04 -03:00
Rémi Verschelde
7c9f7452f4 Style: Format code with clang-format 6.0.1 2018-07-18 16:27:03 +02:00
mm
bd9c592c52 Fixed button mask behavior 2018-07-11 01:15:03 +03:00
Marcelo Fernandez
deebeb2742 Add a new notification to detect crashes on native scripts 2018-07-02 16:18:58 -03:00
Hugo Locurcio
53e94a1ce1
Optimize images losslessly using oxipng -o6 --strip all --zopfli 2018-06-28 19:17:41 +02:00
Rémi Verschelde
74bd1bf1c2
Merge pull request #19718 from thduynguyen/bug_fixes
bugfix: correct #ifdef for TOUCH_ENABLED and OPENGL_ENABLED
2018-06-25 16:10:40 +02:00
Duy-Nguyen Ta
25ad5f8a35 bugfix: correct #ifdef for TOUCH_ENABLED and OPENGL_ENABLED 2018-06-22 10:42:28 -04:00
Saracen
c5bdb5b1d8 IME context detection. 2018-06-11 17:22:11 +01:00
Hugo Locurcio
d54b5da940
Tweak some help texts in the build system
This also removes `unix_global_settings_path` from SConstruct
since it is no longer used.
2018-06-07 21:40:54 +02:00
Rémi Verschelde
7d392cd6f4 SCons: Allow unbundling libwebsockets and miniupnpc 2018-06-07 10:42:30 +02:00
Guilherme Felipe
c8e0ec0580 Change position of validation in set_custom_mouse_cursor 2018-05-28 09:36:30 -03:00
Max Hilbrunner
856d945248
Merge pull request #19210 from guilhermefelipecgs/fix_invalid_image
Add validation in set_custom_mouse_cursor
2018-05-28 12:52:10 +02:00
Guilherme Felipe
aad6bdad94 Add validation in set_custom_mouse_cursor
Check if the image is valid.
2018-05-27 20:55:05 -03:00
Guilherme Felipe
aa174d963d Fix memory leak in set_custom_mouse_cursor 2018-05-26 15:56:35 -03:00
Guilherme Felipe
8c17d8e6fe More fixes to set_borderless_window
[x11] Preserve window size when calling this method.
[osx] Make sure it don't make the window resizable if it's not needed.
[windows] clean up the code.
2018-05-23 17:42:31 -03:00
Guilherme Felipe
28d24c4f66 Fix #19033
- Fix a bug when mouse is confined don't update the cursor shape.
- Don't let the mouse leave the window when resizing to a smaller
resolution when MOUSE_MODE_CONFINED.
- Fix set_borderless_window to preserve the actual video_mode.widht/height.
2018-05-20 20:53:04 -03:00
Guilherme Felipe
50a0220d2d Reset the cursor with Input.set_custom_mouse_cursor(null) 2018-05-10 20:02:12 -03:00
Guilherme Felipe
8ead09342d Add support for atlas texture on set_custom_mouse_cursor 2018-05-09 12:44:43 +00:00
Hein-Pieter van Braam
e668757aa9
Merge pull request #14622 from bruvzg/non-rectangular-windows
Experimental support for windows with per-pixel transparency.
2018-05-08 16:44:35 +02:00
Pedro J. Estébanez
de9d40a953 Implement universal translation of touch to mouse
Now generating mouse events from touch is optional (on by default) and it's performed by `InputDefault` instead of having each OS abstraction doing it. (*)

The translation algorithm waits for a touch index to be pressed and tracks it translating its events to mouse events until it is raised, while ignoring other pointers.

Furthermore, to avoid an stuck "touch mouse", since not all platforms may report touches raised when the window is unfocused, it checks if touches are still down by the time it's focused again and if so it resets the state of the emulated mouse.

*: In the case of Windows, since it already provides touch-to-mouse translation by itself, "echo" mouse events are filtered out to have it working like the rest.

On X11 a little hack has been needed to avoid a case of a spurious mouse motion event that is generated during touch interaction.

Plus: Improve/fix tracking of current mouse position.

** Summary of changes to settings: **

- `display/window/handheld/emulate_touchscreen` becomes `input/pointing_devices/emulate_touch_from_mouse`
- New setting: `input/pointing_devices/emulate_mouse_from_touch`
2018-04-30 19:03:38 +02:00
Guilherme Felipe
62b835a2cd Fix custom cursor when it's hidden
[Linux] Ensures that the custom cursor will be used when changing to
MOUSE_MODE_VISIBLE. Fix #3086

[Windows] Fix cursor flickering when MOUSE_MODE_HIDDEN.

[Mac] Fix possible cursor flicker when MOUSE_MODE_HIDDEN.
2018-04-09 10:28:20 -03:00
Juan Linietsky
1570a72eee
Merge pull request #17742 from marcelofg55/audio_device_list
Added new audio device functions to set/get the audio device
2018-04-07 16:40:47 -03:00
bruvzg
ddae098dee
Experimental support for windows with per-pixel transparency (macOS, X11 and Windows). 2018-04-07 17:11:45 +03:00
Guilherme Felipe
dc57632d66 Remove size restriction for mouse cursor 2018-04-05 15:41:09 -03:00
Marcelo Fernandez
ecc1b34cbc Added new audio device functions to set/get the audio device 2018-03-26 17:41:05 -03:00
bruvzg
ad67911f1a
Explicitly set OpenGL profile to core (X11, Windows).
Enable GLES2 on Windows.
2018-03-06 15:53:30 +02:00
Marcelo Fernandez
d780d774aa Clean and expose get_audio/video_driver_* funcs on OS class 2018-03-04 14:18:05 -03:00
bruvzg
f0d24de960
Fix --help output, allow renderer override from command line (--video-driver). 2018-03-02 10:05:14 +02:00
karroffel
eac4c984df add GLES 2 renderer for 2D
This commit adds a new rendering backend, GLES2, and adds a
project setting to enable it.

Currently this backend can only be used on the X11 platform,
but integrating into other platforms is planned.
2018-03-01 15:12:30 +01:00
Fabio Alessandrelli
8f9914bd94 Fix server build on FreeBSD 2018-03-01 02:16:52 +01:00
Hein-Pieter van Braam
d702d7b335 Fix various valgrind reported uninitialized variable uses 2018-02-28 21:55:13 +01:00
luz.paz
612ab4bbc6 Fix typos with codespell
Found via `codespell -q 3 --skip="./thirdparty,./editor/translations" -I ../godot-word-whitelist.txt`
Whitelist consists of:
```
ang
doubleclick
lod
nd
que
te
unselect
```
2018-02-21 19:46:06 +01:00
Rémi Verschelde
2b7037b148
Merge pull request #16675 from Iskustvo/improved_error_detectioin_in_move-to-trash_for_Linux
[X11] Improving error detection in move_to_trash
2018-02-19 20:50:58 +01:00
Rémi Verschelde
3925e6a543
Merge pull request #16696 from BTaskaya/master
PEP3101 applied with changing old type string formatting as new ones
2018-02-19 20:38:37 +01:00
Iskustvo
268d7c7c5b [X11] Improving error detection in move_to_trash 2018-02-18 17:02:19 +01:00
Pedro J. Estébanez
935a99e758 Remove window decorations for fullscreen on X11 2018-02-16 22:09:17 +01:00
Rémi Verschelde
b526088ae2 X11: Link libgcc statically with use_static_cpp option
We were already linking libstdc++ statically for official binaries,
protecting us against most portability issues. But apparently since
we started using GCC 7 for official builds, we also need to link
libgcc statically for at least 32-bit builds to be portable.

Fixes #16409.
2018-02-16 18:48:11 +01:00
BTaskaya
78dba05fc0 PEP3101 applied with changing old type string formatting as new ones 2018-02-14 19:29:25 +03:00
Rémi Verschelde
e0f43e0678
Merge pull request #15564 from RandomShaper/adpod-topmost
Add new window setting: always on top
2018-02-14 16:43:40 +01:00
Rémi Verschelde
7d7f8d9e54
Merge pull request #15864 from GodotExplorer/pr-get_unique_id-desktop-impl
Implement more methods for OS on Desktop platforms
2018-02-14 16:11:53 +01:00
Fabio Alessandrelli
bd3c27ba78 Allow building with system wide mbedtls on X11
Using builtin_mbedtls=yes is still the default as many distributions
do not ship with mbedtls included.
2018-02-14 01:34:25 +01:00
Fabio Alessandrelli
6fcc8b7e1f Deleting OpenSSL module and library 2018-02-14 01:26:34 +01:00
Marcelo Fernandez
ea1d726a46 Added OS::center_window to center the window precisely on desktop platforms 2018-02-12 15:45:41 -03:00
Paolo Perkovic
08d4bfacaf Fix inconsistencies and typos in argument names 2018-02-01 16:47:20 +01:00
geequlim
df1c16d0fe X11: implement OS.get_unique_id 2018-01-31 09:40:33 +08:00
Hein-Pieter van Braam
fb60f2dbe6 Fix Copy/Paste problems on X11
The target of the TARGETS type should be XA_ATOM and not XA_TARGETS when
requested. Since we are sending a number of ATOMS the size should be set
to the integer size and not the char size.

The size field of the atoms is also the number of atoms and not the size
of the array. This caused some clients to wrongly interpret the data and
read garbage in the X11 packet.

I also add the more modern representation for UTF-8 and clarify the
error message if a client attempts to request a type we don't know
about.

This fixes #10431
2018-01-29 18:38:04 +01:00
Hein-Pieter van Braam
c6d9a7665a Make separate debug symbols opt-in
This adds a separate_debug_symbols option to the x11, windows, and osx
targets. This will default to adding normal debugging symbols to the
artifacts and only splits them when separate_debug_symbols=yes on the
Scons command line.
2018-01-26 20:46:56 +01:00
Rémi Verschelde
9ba5fb87f0 Bullet: allow unbundling only if > 2.87
Looks like we are using cutting edge methods which are not even
if the current stable 2.87.
2018-01-26 19:17:24 +01:00
Rémi Verschelde
94f315df01 Silence verbose stderr info message on X11 2018-01-24 21:49:11 +01:00
Rémi Verschelde
e141845bfb SCons: Allow unbundling bullet on Linux (only 2.87+) 2018-01-13 15:16:22 +01:00