Commit graph

129 commits

Author SHA1 Message Date
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
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
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
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
Mikko Mustonen
51fa23a52a Added double clicking to all buttons 2018-08-12 12:41:31 +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
mm
bd9c592c52 Fixed button mask behavior 2018-07-11 01:15:03 +03:00
Saracen
c5bdb5b1d8 IME context detection. 2018-06-11 17:22:11 +01: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
bruvzg
ddae098dee
Experimental support for windows with per-pixel transparency (macOS, X11 and Windows). 2018-04-07 17:11:45 +03: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
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
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
Pedro J. Estébanez
ee2c31d306 Add new window setting: always on top
Implemented for Windows and Linux.
2018-01-05 21:31:04 +01:00
Rémi Verschelde
e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Emmanuel Leblond
e315c94900 Change OS::initialize signature to return Error (fix segfault on x11) 2018-01-04 15:15:55 +01:00
Rémi Verschelde
5019f5e298
Merge pull request #15092 from guilhermefelipecgs/fix_infinite_loop_on_splash_screen
Fix infinite loop on splash screen on tiling windows managers
2018-01-03 11:41:38 +01:00
Rémi Verschelde
6322b0bbb7
Merge pull request #12814 from guilhermefelipecgs/add_hardware_custom_cursor
Custom hardware-accelerated mouse cursor
2018-01-03 08:35:59 +01:00
Rémi Verschelde
b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Guilherme Silva
2a6035dff4 Fix infinite loop introduced by 6f3486c4 on tiling windows managers 2017-12-27 08:44:18 -02:00
Guilherme Silva
a392dbdbe3 Add implementation for custom hardware cursor 2017-12-17 13:40:29 -02:00
Juan Linietsky
652c98a7be Add epic hack so vsync can be toggled in run-time from script. Fixes #14458.
Call needs to be routed via visual server to reach the proper thread.
2017-12-16 17:11:02 -03:00
Rémi Verschelde
fb84b49d87 Fix type mismatch in OS::set_borderless_window
Closes #14663.
2017-12-14 19:16:20 +01:00
Juan Linietsky
f3ad14224e -Add lightmapper
-Fixes to unwrapper (remove degenerates), makes Thekla not crash
-Added optional cancel button in EditorProgress
-Added function to force processing of events (needed for cancel button)
2017-12-14 09:01:27 -03:00
Andreas Haas
94a573bb39
X11: Process entire event queue at startup.
Should fix #14336
2017-12-09 23:24:25 +01:00
Pedro J. Estébanez
6decbec461 Implement multitouch on X11 2017-12-06 23:47:09 +01:00
Rémi Verschelde
450bdda97a
Merge pull request #12387 from santouits/x1111
Fix x11 boot logo position in fullscreen and in maximized
2017-11-20 15:48:08 +01:00
Rémi Verschelde
32c12a92a5 Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).

Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
  ~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
  ~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
  ~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows

So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.

Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.

user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.

For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.

Part of #3513.
2017-11-19 20:54:24 +01:00
Juan Linietsky
d09160a8b6 Make video mode initialization more intuitive, fixes #12022 2017-11-09 13:02:26 -03:00
Juan Linietsky
7715a261d5
Merge pull request #12262 from AndreaCatania/pplug
Physics server plug
2017-11-03 23:39:44 -03:00
AndreaCatania
7a9ca08f16 Implemented physics plug
Moved init_physics

Implemented physics 2D plug

Fix clang

Fix clang

Fix static check

Fix clang

Fix static check

Moved physics server initialization

Moved physics server settings initialization
2017-11-04 03:25:51 +01:00
Marcelo Fernandez
be6ac69f75 Implemented OS get_latin_keyboard_variant on x11 2017-10-30 12:14:40 -03:00
santouits
55fae24710 Fix x11 boot logo position in fullscreen and in maximized 2017-10-26 01:06:26 +03:00
Rémi Verschelde
79e247d74e Drop unusued LEGACYGL_ENABLED check
[ci skip]
2017-10-13 00:18:04 +02:00
Marcelo Fernandez
20918587d3 FileSystemDock will now remove files/dirs to trashcan using OS::move_to_trash 2017-09-25 21:49:01 -03:00
letheed
5ad9be4c24 Rename pos to position in user facing methods and variables
Rename user facing methods and variables as well as the corresponding
C++ methods according to the folloming changes:

* pos -> position
* rot -> rotation
* loc -> location

C++ variables are left as is.
2017-09-20 13:11:10 +02:00
Rémi Verschelde
53bbc046ee Merge pull request #11252 from marcelofg55/fix_noaudio_crash
Fix crash when no audio driver is available
2017-09-17 22:48:22 +02:00
Thomas Herzog
7dffed485b Merge pull request #11230 from maxim-sheronov/fix_enum_bindings
Fix enums bindings
2017-09-15 08:43:35 +02:00
Marcelo Fernandez
7a4c0ff35e Fix crash when no audio driver is available 2017-09-13 20:54:55 -03:00
Maxim Sheronov
0fffa45158 Fix enums bindings
Add missed bindings for enums
Move some enums to class to have correct output of api.json
2017-09-13 20:57:07 +03:00