Commit graph

479 commits

Author SHA1 Message Date
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
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
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
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