Avoid bug on Linux/X11

This commit is contained in:
Gregor Parzefall 2024-05-15 21:40:18 +02:00
parent 3ed2e2ccbf
commit b5c7d942c9
1 changed files with 13 additions and 0 deletions

View File

@ -104,7 +104,20 @@ void set_default_settings()
// Client
settings->setDefault("address", "");
settings->setDefault("enable_sound", "true");
#if defined(__linux__) && !defined (__ANDROID__)
// On Linux+X11 (not Linux+Wayland or Linux+XWayland), I've encountered a bug
// where fake mouse events were generated from touch events if in relative
// mouse mode, resulting in the touchscreen controls being instantly disabled
// again and thus making them unusable.
// => We can't switch based on the last input method used.
// => Fall back to hardware detection.
settings->setDefault("touch_controls", bool_to_cstr(has_touch));
#else
settings->setDefault("touch_controls", "auto");
#endif
// Since GUI scaling shouldn't suddenly change during a session, we use
// hardware detection here instead of switching based on the last input
// method used.
settings->setDefault("gui_touch", bool_to_cstr(has_touch));
settings->setDefault("sound_volume", "0.8");
settings->setDefault("sound_volume_unfocused", "0.3");