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

MouseSettings: Add option to reverse buttons

Add option to reverse primary and secondary buttons in Mouse Settings.
- WindowServer.ini: add default entry
- switch-mouse-buttons.png: new icon for settings entry
- Mouse.gml/MouseWidget.*: new settings dialog
- ClientConnection/WindowManager/Server: window message for settings
- EventLoop.cpp: swap buttons 1 and 2 if settings are on
This commit is contained in:
Andrew Pardoe 2021-10-24 19:47:33 -07:00 committed by Idan Horowitz
parent 5599d22744
commit 0e68550c05
11 changed files with 90 additions and 0 deletions

View file

@ -71,6 +71,7 @@ void WindowManager::reload_config()
apply_virtual_desktop_settings(virtual_desktop_rows, virtual_desktop_columns, false);
m_double_click_speed = m_config->read_num_entry("Input", "DoubleClickSpeed", 250);
m_buttons_switched = m_config->read_bool_entry("Mouse", "ButtonsSwitched", false);
apply_cursor_theme(m_config->read_entry("Mouse", "CursorTheme", "Default"));
auto reload_graphic = [&](RefPtr<MultiScaleBitmaps>& bitmap, String const& name) {
@ -274,6 +275,19 @@ int WindowManager::double_click_speed() const
return m_double_click_speed;
}
void WindowManager::set_buttons_switched(bool switched)
{
m_buttons_switched = switched;
dbgln("Saving mouse buttons switched state {} to config file at {}", switched, m_config->filename());
m_config->write_bool_entry("Mouse", "ButtonsSwitched", switched);
m_config->sync();
}
bool WindowManager::get_buttons_switched() const
{
return m_buttons_switched;
}
WindowStack& WindowManager::window_stack_for_window(Window& window)
{
if (is_stationary_window_type(window.type()))