1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

WindowServer: Add "Natural scrolling" support

Also commonly referred to as "reverse scrolling" or "inverted
scrolling".
This commit is contained in:
Filiph Sandström 2022-11-30 13:45:35 +01:00 committed by Linus Groh
parent bef9ad4e44
commit 5a083c03a6
7 changed files with 39 additions and 1 deletions

View file

@ -83,6 +83,7 @@ void WindowManager::reload_config()
m_double_click_speed = m_config->read_num_entry("Input", "DoubleClickSpeed", 250);
m_buttons_switched = m_config->read_bool_entry("Mouse", "ButtonsSwitched", false);
m_natural_scroll = m_config->read_bool_entry("Mouse", "NaturalScroll", false);
m_cursor_highlight_radius = m_config->read_num_entry("Mouse", "CursorHighlightRadius", 25);
Color default_highlight_color = Color::NamedColor::Red;
default_highlight_color.set_alpha(110);
@ -305,6 +306,19 @@ bool WindowManager::get_buttons_switched() const
return m_buttons_switched;
}
void WindowManager::set_natural_scroll(bool inverted)
{
m_natural_scroll = inverted;
dbgln("Saving scroll inverted state {} to config file at {}", inverted, m_config->filename());
m_config->write_bool_entry("Mouse", "NaturalScroll", inverted);
sync_config_to_disk();
}
bool WindowManager::is_natural_scroll() const
{
return m_natural_scroll;
}
WindowStack& WindowManager::window_stack_for_window(Window& window)
{
if (is_stationary_window_type(window.type()))