mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-04 08:36:12 +00:00
WindowServer: Reset mouse acceleration if out of range
Before if the mouse acceleration was out of range the WindowServer would crash, this could happen if the config had an out of range or non double vaule.
This commit is contained in:
parent
1ab6cb1ee9
commit
97dc1585b1
Notes:
sideshowbarker
2024-07-17 08:37:36 +09:00
Author: https://github.com/davidot
Commit: 97dc1585b1
Pull-request: https://github.com/SerenityOS/serenity/pull/15377
Issue: https://github.com/SerenityOS/serenity/issues/14691
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/linusg
1 changed files with 7 additions and 1 deletions
|
@ -128,7 +128,13 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
|
||||
auto& screen_input = WindowServer::ScreenInput::the();
|
||||
screen_input.set_cursor_location(WindowServer::Screen::main().rect().center());
|
||||
screen_input.set_acceleration_factor(atof(wm_config->read_entry("Mouse", "AccelerationFactor", "1.0").characters()));
|
||||
double f = atof(wm_config->read_entry("Mouse", "AccelerationFactor", "1.0").characters());
|
||||
if (f < WindowServer::mouse_accel_min || f > WindowServer::mouse_accel_max) {
|
||||
dbgln("Mouse.AccelerationFactor out of range resetting to 1.0");
|
||||
f = 1.0;
|
||||
wm_config->write_entry("Mouse", "AccelerationFactor", "1.0");
|
||||
}
|
||||
screen_input.set_acceleration_factor(f);
|
||||
screen_input.set_scroll_step_size(wm_config->read_num_entry("Mouse", "ScrollStepSize", 4));
|
||||
|
||||
WindowServer::Compositor::the();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue