diff options
author | Cosmic Chip Socket <34800072+cosmicchipsocket@users.noreply.github.com> | 2018-08-17 18:59:26 -0400 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2018-12-14 23:51:20 +0100 |
commit | cf124b1415c4718325514ec32794fb0587885e3b (patch) | |
tree | 871970d65029ba383f5a9d3b66054a748ab6a11f /platform/x11/detect.py | |
parent | 5f32fc82087404ac2c803770dc9d1e3711fc14fd (diff) | |
download | redot-engine-cf124b1415c4718325514ec32794fb0587885e3b.tar.gz |
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.
Diffstat (limited to 'platform/x11/detect.py')
-rw-r--r-- | platform/x11/detect.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 524c8448bc..9b6fb2f478 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -48,6 +48,11 @@ def can_build(): print("xrender not found.. x11 disabled.") return False + x11_error = os.system("pkg-config xi --modversion > /dev/null ") + if (x11_error): + print("xi not found.. Aborting.") + return False + return True def get_opts(): @@ -170,13 +175,9 @@ def configure(env): env.ParseConfig('pkg-config xinerama --cflags --libs') env.ParseConfig('pkg-config xrandr --cflags --libs') env.ParseConfig('pkg-config xrender --cflags --libs') + env.ParseConfig('pkg-config xi --cflags --libs') if (env['touch']): - x11_error = os.system("pkg-config xi --modversion > /dev/null ") - if (x11_error): - print("xi not found.. cannot build with touch. Aborting.") - sys.exit(255) - env.ParseConfig('pkg-config xi --cflags --libs') env.Append(CPPFLAGS=['-DTOUCH_ENABLED']) # FIXME: Check for existence of the libs before parsing their flags with pkg-config |