mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +00:00
MouseSettings: Add "Natural scrolling" toggle
This commit is contained in:
parent
5a083c03a6
commit
2e3efd34c3
3 changed files with 22 additions and 4 deletions
|
@ -53,7 +53,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@GUI::GroupBox {
|
@GUI::GroupBox {
|
||||||
title: "Scroll Wheel Step Size"
|
title: "Scroll Wheel"
|
||||||
fixed_height: 106
|
fixed_height: 106
|
||||||
layout: @GUI::VerticalBoxLayout {
|
layout: @GUI::VerticalBoxLayout {
|
||||||
margins: [6]
|
margins: [6]
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
|
|
||||||
@GUI::Widget {
|
@GUI::Widget {
|
||||||
layout: @GUI::HorizontalBoxLayout {
|
layout: @GUI::HorizontalBoxLayout {
|
||||||
margins: [8]
|
margins: [4, 0, 2, 8]
|
||||||
spacing: 8
|
spacing: 8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,10 +97,19 @@
|
||||||
min: 0
|
min: 0
|
||||||
max: 100
|
max: 100
|
||||||
value: 50
|
value: 50
|
||||||
fixed_width: 100
|
preferred_width: "opportunistic_grow"
|
||||||
}
|
}
|
||||||
|
|
||||||
@GUI::Layout::Spacer {}
|
@GUI::Widget {
|
||||||
|
fixed_width: 16
|
||||||
|
}
|
||||||
|
|
||||||
|
@GUI::CheckBox {
|
||||||
|
name: "natural_scroll_checkbox"
|
||||||
|
text: "Natural scrolling"
|
||||||
|
tooltip: "Content follows motion instead of the viewport,\nalso commonly referred to as \"reverse scrolling\"."
|
||||||
|
preferred_width: 108
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,12 @@ MouseWidget::MouseWidget()
|
||||||
set_modified(true);
|
set_modified(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
m_natural_scroll_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("natural_scroll_checkbox");
|
||||||
|
m_natural_scroll_checkbox->set_checked(GUI::ConnectionToWindowServer::the().is_natural_scroll(), GUI::AllowCallback::No);
|
||||||
|
m_natural_scroll_checkbox->on_checked = [&](auto) {
|
||||||
|
set_modified(true);
|
||||||
|
};
|
||||||
|
|
||||||
update_speed_label();
|
update_speed_label();
|
||||||
update_double_click_speed_label();
|
update_double_click_speed_label();
|
||||||
m_double_click_arrow_widget->set_double_click_speed(m_double_click_speed_slider->value());
|
m_double_click_arrow_widget->set_double_click_speed(m_double_click_speed_slider->value());
|
||||||
|
@ -69,6 +75,7 @@ void MouseWidget::apply_settings()
|
||||||
GUI::ConnectionToWindowServer::the().async_set_scroll_step_size(m_scroll_length_spinbox->value());
|
GUI::ConnectionToWindowServer::the().async_set_scroll_step_size(m_scroll_length_spinbox->value());
|
||||||
GUI::ConnectionToWindowServer::the().async_set_double_click_speed(m_double_click_speed_slider->value());
|
GUI::ConnectionToWindowServer::the().async_set_double_click_speed(m_double_click_speed_slider->value());
|
||||||
GUI::ConnectionToWindowServer::the().async_set_buttons_switched(m_switch_buttons_checkbox->is_checked());
|
GUI::ConnectionToWindowServer::the().async_set_buttons_switched(m_switch_buttons_checkbox->is_checked());
|
||||||
|
GUI::ConnectionToWindowServer::the().async_set_natural_scroll(m_natural_scroll_checkbox->is_checked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MouseWidget::reset_default_values()
|
void MouseWidget::reset_default_values()
|
||||||
|
@ -77,6 +84,7 @@ void MouseWidget::reset_default_values()
|
||||||
m_scroll_length_spinbox->set_value(default_scroll_length);
|
m_scroll_length_spinbox->set_value(default_scroll_length);
|
||||||
m_double_click_speed_slider->set_value(double_click_speed_default);
|
m_double_click_speed_slider->set_value(double_click_speed_default);
|
||||||
m_switch_buttons_checkbox->set_checked(false);
|
m_switch_buttons_checkbox->set_checked(false);
|
||||||
|
m_natural_scroll_checkbox->set_checked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MouseWidget::update_speed_label()
|
void MouseWidget::update_speed_label()
|
||||||
|
|
|
@ -31,5 +31,6 @@ private:
|
||||||
RefPtr<GUI::HorizontalSlider> m_double_click_speed_slider;
|
RefPtr<GUI::HorizontalSlider> m_double_click_speed_slider;
|
||||||
RefPtr<GUI::Label> m_double_click_speed_label;
|
RefPtr<GUI::Label> m_double_click_speed_label;
|
||||||
RefPtr<GUI::CheckBox> m_switch_buttons_checkbox;
|
RefPtr<GUI::CheckBox> m_switch_buttons_checkbox;
|
||||||
|
RefPtr<GUI::CheckBox> m_natural_scroll_checkbox;
|
||||||
RefPtr<MouseSettings::DoubleClickArrowWidget> m_double_click_arrow_widget;
|
RefPtr<MouseSettings::DoubleClickArrowWidget> m_double_click_arrow_widget;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue