mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 21:17:44 +00:00
Userland: Update IPC calls to use proxies
This updates all existing code to use the auto-generated client methods instead of post_message/send_sync.
This commit is contained in:
parent
78803ce384
commit
5bb79ea0a7
63 changed files with 303 additions and 316 deletions
|
@ -264,9 +264,9 @@ void DisplaySettingsWidget::send_settings_to_window_server()
|
|||
}
|
||||
|
||||
if (current_resolution != m_monitor_widget->desktop_resolution() || current_scale_factor != m_monitor_widget->desktop_scale_factor()) {
|
||||
auto result = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetResolution>(m_monitor_widget->desktop_resolution(), m_monitor_widget->desktop_scale_factor());
|
||||
if (!result->success()) {
|
||||
GUI::MessageBox::show(nullptr, String::formatted("Reverting to resolution {}x{} @ {}x", result->resolution().width(), result->resolution().height(), result->scale_factor()),
|
||||
auto result = GUI::WindowServerConnection::the().set_resolution(m_monitor_widget->desktop_resolution(), m_monitor_widget->desktop_scale_factor());
|
||||
if (!result.success()) {
|
||||
GUI::MessageBox::show(nullptr, String::formatted("Reverting to resolution {}x{} @ {}x", result.resolution().width(), result.resolution().height(), result.scale_factor()),
|
||||
"Unable to set resolution", GUI::MessageBox::Type::Error);
|
||||
} else {
|
||||
auto box = GUI::MessageBox::construct(window(), String::formatted("Do you want to keep the new settings? They will be reverted after 10 seconds."),
|
||||
|
@ -282,9 +282,9 @@ void DisplaySettingsWidget::send_settings_to_window_server()
|
|||
|
||||
// If the user selects "No", closes the window or the window gets closed by the 10 seconds timer, revert the changes.
|
||||
if (box->exec() != GUI::MessageBox::ExecYes) {
|
||||
result = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetResolution>(current_resolution, current_scale_factor);
|
||||
if (!result->success()) {
|
||||
GUI::MessageBox::show(nullptr, String::formatted("Reverting to resolution {}x{} @ {}x", result->resolution().width(), result->resolution().height(), result->scale_factor()),
|
||||
result = GUI::WindowServerConnection::the().set_resolution(current_resolution, current_scale_factor);
|
||||
if (!result.success()) {
|
||||
GUI::MessageBox::show(nullptr, String::formatted("Reverting to resolution {}x{} @ {}x", result.resolution().width(), result.resolution().height(), result.scale_factor()),
|
||||
"Unable to set resolution", GUI::MessageBox::Type::Error);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@ constexpr int double_click_speed_default = 250;
|
|||
void MouseSettingsWindow::update_window_server()
|
||||
{
|
||||
const float factor = m_speed_slider->value() / speed_slider_scale;
|
||||
GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetMouseAcceleration>(factor);
|
||||
GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetScrollStepSize>(m_scroll_length_spinbox->value());
|
||||
GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetDoubleClickSpeed>(m_double_click_speed_slider->value());
|
||||
GUI::WindowServerConnection::the().set_mouse_acceleration(factor);
|
||||
GUI::WindowServerConnection::the().set_scroll_step_size(m_scroll_length_spinbox->value());
|
||||
GUI::WindowServerConnection::the().set_double_click_speed(m_double_click_speed_slider->value());
|
||||
}
|
||||
|
||||
void MouseSettingsWindow::reset_default_values()
|
||||
|
@ -48,12 +48,12 @@ MouseSettingsWindow::MouseSettingsWindow()
|
|||
m_speed_slider->on_change = [&](const int value) {
|
||||
m_speed_label->set_text(String::formatted("{} %", value));
|
||||
};
|
||||
const int slider_value = float { speed_slider_scale } * GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::GetMouseAcceleration>()->factor();
|
||||
const int slider_value = float { speed_slider_scale } * GUI::WindowServerConnection::the().get_mouse_acceleration().factor();
|
||||
m_speed_slider->set_value(slider_value);
|
||||
|
||||
m_scroll_length_spinbox = *main_widget.find_descendant_of_type_named<GUI::SpinBox>("scroll_length_spinbox");
|
||||
m_scroll_length_spinbox->set_min(WindowServer::scroll_step_size_min);
|
||||
m_scroll_length_spinbox->set_value(GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::GetScrollStepSize>()->step_size());
|
||||
m_scroll_length_spinbox->set_value(GUI::WindowServerConnection::the().get_scroll_step_size().step_size());
|
||||
|
||||
m_double_click_speed_label = *main_widget.find_descendant_of_type_named<GUI::Label>("double_click_speed_label");
|
||||
m_double_click_speed_slider = *main_widget.find_descendant_of_type_named<GUI::HorizontalSlider>("double_click_speed_slider");
|
||||
|
@ -62,7 +62,7 @@ MouseSettingsWindow::MouseSettingsWindow()
|
|||
m_double_click_speed_slider->on_change = [&](const int value) {
|
||||
m_double_click_speed_label->set_text(String::formatted("{} ms", value));
|
||||
};
|
||||
m_double_click_speed_slider->set_value(GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::GetDoubleClickSpeed>()->speed());
|
||||
m_double_click_speed_slider->set_value(GUI::WindowServerConnection::the().get_double_click_speed().speed());
|
||||
|
||||
m_ok_button = *main_widget.find_descendant_of_type_named<GUI::Button>("ok_button");
|
||||
m_ok_button->on_click = [this](auto) {
|
||||
|
|
|
@ -316,7 +316,7 @@ void TreeMapWidget::mousewheel_event(GUI::MouseEvent& event)
|
|||
{
|
||||
int delta = event.wheel_delta();
|
||||
// FIXME: The wheel_delta is premultiplied in the window server, we actually want a raw value here.
|
||||
int step_size = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::GetScrollStepSize>()->step_size();
|
||||
int step_size = GUI::WindowServerConnection::the().get_scroll_step_size().step_size();
|
||||
if (delta > 0) {
|
||||
size_t step_back = delta / step_size;
|
||||
if (step_back > m_viewpoint)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue