Skip to content

Commit

Permalink
Userland: Rename WindowServerConnection=>ConnectionToWindowServer
Browse files Browse the repository at this point in the history
This was done with CLion's automatic rename feature.
  • Loading branch information
itamar8910 authored and awesomekling committed Feb 25, 2022
1 parent af132fd commit 935d023
Show file tree
Hide file tree
Showing 43 changed files with 201 additions and 201 deletions.
2 changes: 1 addition & 1 deletion Documentation/Patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ErrorOr<NonnullRefPtr<Menu>> Window::try_add_menu(String name)
auto menu = TRY(m_menubar->try_add_menu({}, move(name)));
if (m_window_id) {
menu->realize_menu_if_needed();
WindowServerConnection::the().async_add_menu(m_window_id, menu->menu_id());
ConnectionToWindowServer::the().async_add_menu(m_window_id, menu->menu_id());
}
return menu;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
#include <LibGUI/Button.h>
#include <LibGUI/Clipboard.h>
#include <LibGUI/ComboBox.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Desktop.h>
#include <LibGUI/FilePicker.h>
#include <LibGUI/FileSystemModel.h>
#include <LibGUI/IconView.h>
#include <LibGUI/ItemListModel.h>
#include <LibGUI/MessageBox.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Palette.h>
#include <LibGfx/SystemTheme.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
#include "DesktopSettingsWidget.h"
#include <Applications/DisplaySettings/DesktopSettingsGML.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Desktop.h>
#include <LibGUI/Label.h>
#include <LibGUI/MessageBox.h>
#include <LibGUI/SpinBox.h>
#include <LibGUI/WindowServerConnection.h>

namespace DisplaySettings {

Expand Down Expand Up @@ -42,7 +42,7 @@ void DesktopSettingsWidget::apply_settings()
auto workspace_columns = (unsigned)m_workspace_columns_spinbox->value();
auto& desktop = GUI::Desktop::the();
if (workspace_rows != desktop.workspace_rows() || workspace_columns != desktop.workspace_columns()) {
if (!GUI::WindowServerConnection::the().apply_workspace_settings(workspace_rows, workspace_columns, true)) {
if (!GUI::ConnectionToWindowServer::the().apply_workspace_settings(workspace_rows, workspace_columns, true)) {
GUI::MessageBox::show(window(), String::formatted("Error applying workspace settings"),
"Workspace settings", GUI::MessageBox::Type::Error);
}
Expand Down
4 changes: 2 additions & 2 deletions Userland/Applications/DisplaySettings/FontSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include "FontSettingsWidget.h"
#include <Applications/DisplaySettings/FontSettingsGML.h>
#include <LibGUI/Button.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/FontPicker.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/FontDatabase.h>

namespace DisplaySettings {
Expand Down Expand Up @@ -54,7 +54,7 @@ static void update_label_with_font(GUI::Label& label, Gfx::Font const& font)

void FontSettingsWidget::apply_settings()
{
GUI::WindowServerConnection::the().set_system_fonts(m_default_font_label->font().qualified_name(), m_fixed_width_font_label->font().qualified_name());
GUI::ConnectionToWindowServer::the().set_system_fonts(m_default_font_label->font().qualified_name(), m_fixed_width_font_label->font().qualified_name());
}

}
14 changes: 7 additions & 7 deletions Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
#include <LibGUI/ComboBox.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/ItemListModel.h>
#include <LibGUI/Label.h>
#include <LibGUI/MessageBox.h>
#include <LibGUI/RadioButton.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/SystemTheme.h>

namespace DisplaySettings {
Expand Down Expand Up @@ -140,7 +140,7 @@ static String display_name_from_edid(EDID::Parser const& edid)

void MonitorSettingsWidget::load_current_settings()
{
m_screen_layout = GUI::WindowServerConnection::the().get_screen_layout();
m_screen_layout = GUI::ConnectionToWindowServer::the().get_screen_layout();

m_screens.clear();
m_screen_edids.clear();
Expand Down Expand Up @@ -214,9 +214,9 @@ void MonitorSettingsWidget::apply_settings()
{
// Fetch the latest configuration again, in case it has been changed by someone else.
// This isn't technically race free, but if the user automates changing settings we can't help...
auto current_layout = GUI::WindowServerConnection::the().get_screen_layout();
auto current_layout = GUI::ConnectionToWindowServer::the().get_screen_layout();
if (m_screen_layout != current_layout) {
auto result = GUI::WindowServerConnection::the().set_screen_layout(m_screen_layout, false);
auto result = GUI::ConnectionToWindowServer::the().set_screen_layout(m_screen_layout, false);
if (result.success()) {
load_current_settings(); // Refresh

Expand All @@ -243,13 +243,13 @@ void MonitorSettingsWidget::apply_settings()

// 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) {
auto save_result = GUI::WindowServerConnection::the().save_screen_layout();
auto save_result = GUI::ConnectionToWindowServer::the().save_screen_layout();
if (!save_result.success()) {
GUI::MessageBox::show(window(), String::formatted("Error saving settings: {}", save_result.error_msg()),
"Unable to save setting", GUI::MessageBox::Type::Error);
}
} else {
auto restore_result = GUI::WindowServerConnection::the().set_screen_layout(current_layout, false);
auto restore_result = GUI::ConnectionToWindowServer::the().set_screen_layout(current_layout, false);
if (!restore_result.success()) {
GUI::MessageBox::show(window(), String::formatted("Error restoring settings: {}", restore_result.error_msg()),
"Unable to restore setting", GUI::MessageBox::Type::Error);
Expand All @@ -269,7 +269,7 @@ void MonitorSettingsWidget::show_screen_numbers(bool show)
if (m_showing_screen_numbers == show)
return;
m_showing_screen_numbers = show;
GUI::WindowServerConnection::the().async_show_screen_numbers(show);
GUI::ConnectionToWindowServer::the().async_show_screen_numbers(show);
}

void MonitorSettingsWidget::show_event(GUI::ShowEvent&)
Expand Down
4 changes: 2 additions & 2 deletions Userland/Applications/Magnifier/MagnifierWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*/

#include "MagnifierWidget.h"
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/DisplayLink.h>
#include <LibGUI/Painter.h>
#include <LibGUI/Window.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Rect.h>

MagnifierWidget::MagnifierWidget()
Expand Down Expand Up @@ -53,7 +53,7 @@ void MagnifierWidget::sync()

auto size = frame_inner_rect().size();
Gfx::IntSize grab_size { size.width() / m_scale_factor, size.height() / m_scale_factor };
m_grabbed_bitmap = GUI::WindowServerConnection::the().get_screen_bitmap_around_cursor(grab_size).bitmap();
m_grabbed_bitmap = GUI::ConnectionToWindowServer::the().get_screen_bitmap_around_cursor(grab_size).bitmap();
m_grabbed_bitmaps.enqueue(m_grabbed_bitmap);
update();
}
Expand Down
18 changes: 9 additions & 9 deletions Userland/Applications/MouseSettings/MouseWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#include "MouseWidget.h"

#include <Applications/MouseSettings/MouseWidgetGML.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Label.h>
#include <LibGUI/Slider.h>
#include <LibGUI/SpinBox.h>
#include <LibGUI/WindowServerConnection.h>
#include <WindowServer/Screen.h>
#include <WindowServer/WindowManager.h>

Expand All @@ -28,12 +28,12 @@ MouseWidget::MouseWidget()
m_speed_slider->on_change = [&](int value) {
m_speed_label->set_text(String::formatted("{} %", value));
};
int const slider_value = float { speed_slider_scale } * GUI::WindowServerConnection::the().get_mouse_acceleration();
int const slider_value = float { speed_slider_scale } * GUI::ConnectionToWindowServer::the().get_mouse_acceleration();
m_speed_slider->set_value(slider_value);

m_scroll_length_spinbox = *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().get_scroll_step_size());
m_scroll_length_spinbox->set_value(GUI::ConnectionToWindowServer::the().get_scroll_step_size());

m_double_click_arrow_widget = *find_descendant_of_type_named<MouseSettings::DoubleClickArrowWidget>("double_click_arrow_widget");
m_double_click_speed_label = *find_descendant_of_type_named<GUI::Label>("double_click_speed_label");
Expand All @@ -44,18 +44,18 @@ MouseWidget::MouseWidget()
m_double_click_arrow_widget->set_double_click_speed(speed);
m_double_click_speed_label->set_text(String::formatted("{} ms", speed));
};
m_double_click_speed_slider->set_value(GUI::WindowServerConnection::the().get_double_click_speed());
m_double_click_speed_slider->set_value(GUI::ConnectionToWindowServer::the().get_double_click_speed());
m_switch_buttons_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("switch_buttons_input");
m_switch_buttons_checkbox->set_checked(GUI::WindowServerConnection::the().get_buttons_switched());
m_switch_buttons_checkbox->set_checked(GUI::ConnectionToWindowServer::the().get_buttons_switched());
}

void MouseWidget::apply_settings()
{
float const factor = m_speed_slider->value() / speed_slider_scale;
GUI::WindowServerConnection::the().async_set_mouse_acceleration(factor);
GUI::WindowServerConnection::the().async_set_scroll_step_size(m_scroll_length_spinbox->value());
GUI::WindowServerConnection::the().async_set_double_click_speed(m_double_click_speed_slider->value());
GUI::WindowServerConnection::the().async_set_buttons_switched(m_switch_buttons_checkbox->is_checked());
GUI::ConnectionToWindowServer::the().async_set_mouse_acceleration(factor);
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_buttons_switched(m_switch_buttons_checkbox->is_checked());
}

void MouseWidget::reset_default_values()
Expand Down
6 changes: 3 additions & 3 deletions Userland/Applications/MouseSettings/ThemeWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include <LibCore/DirIterator.h>
#include <LibGUI/Button.h>
#include <LibGUI/ComboBox.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/SortingProxyModel.h>
#include <LibGUI/TableView.h>
#include <LibGUI/WindowServerConnection.h>

String MouseCursorModel::column_name(int column_index) const
{
Expand Down Expand Up @@ -115,7 +115,7 @@ ThemeWidget::ThemeWidget()
m_cursors_tableview->set_column_width(0, 25);
m_cursors_tableview->model()->invalidate();

m_theme_name = GUI::WindowServerConnection::the().get_cursor_theme();
m_theme_name = GUI::ConnectionToWindowServer::the().get_cursor_theme();
mouse_cursor_model->change_theme(m_theme_name);

m_theme_name_box = find_descendant_of_type_named<GUI::ComboBox>("theme_name_box");
Expand All @@ -130,7 +130,7 @@ ThemeWidget::ThemeWidget()

void ThemeWidget::apply_settings()
{
GUI::WindowServerConnection::the().async_apply_cursor_theme(m_theme_name_box->text());
GUI::ConnectionToWindowServer::the().async_apply_cursor_theme(m_theme_name_box->text());
}

void ThemeWidget::reset_default_values()
Expand Down
4 changes: 2 additions & 2 deletions Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

#include "TreeMapWidget.h"
#include <AK/NumberFormat.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Painter.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Font.h>
#include <WindowServer/WindowManager.h>

Expand Down Expand Up @@ -309,7 +309,7 @@ void TreeMapWidget::mousewheel_event(GUI::MouseEvent& event)
{
int delta = event.wheel_delta_y();
// FIXME: The wheel_delta_y is premultiplied in the window server, we actually want a raw value here.
int step_size = GUI::WindowServerConnection::the().get_scroll_step_size();
int step_size = GUI::ConnectionToWindowServer::the().get_scroll_step_size();
if (delta > 0) {
size_t step_back = delta / step_size;
if (step_back > m_viewpoint)
Expand Down
2 changes: 1 addition & 1 deletion Userland/Applications/TerminalSettings/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "TerminalSettingsWidget.h"
#include <LibCore/System.h>
#include <LibGUI/Application.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/SettingsWindow.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibMain/Main.h>

// Including this after to avoid LibIPC errors
Expand Down
4 changes: 2 additions & 2 deletions Userland/Demos/Mouse/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Frame.h>
#include <LibGUI/Icon.h>
#include <LibGUI/Menu.h>
#include <LibGUI/Menubar.h>
#include <LibGUI/Painter.h>
#include <LibGUI/Widget.h>
#include <LibGUI/Window.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/Path.h>
#include <LibMain/Main.h>
Expand Down Expand Up @@ -74,7 +74,7 @@ class MainFrame final : public GUI::Frame {

painter.stroke_path(path, Color::Black, 1);

auto primary_secondary_switched = GUI::WindowServerConnection::the().get_buttons_switched();
auto primary_secondary_switched = GUI::ConnectionToWindowServer::the().get_buttons_switched();
auto primary_pressed = m_buttons & GUI::MouseButton::Primary;
auto secondary_pressed = m_buttons & GUI::MouseButton::Secondary;

Expand Down
4 changes: 2 additions & 2 deletions Userland/Demos/WidgetGallery/GalleryModels.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include <AK/NonnullRefPtr.h>
#include <AK/Vector.h>
#include <LibCore/DirIterator.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Model.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/CursorParams.h>

class MouseCursorModel final : public GUI::Model {
Expand Down Expand Up @@ -60,7 +60,7 @@ class MouseCursorModel final : public GUI::Model {
{
m_cursors.clear();

Core::DirIterator iterator(String::formatted("/res/cursor-themes/{}", GUI::WindowServerConnection::the().get_cursor_theme()), Core::DirIterator::Flags::SkipDots);
Core::DirIterator iterator(String::formatted("/res/cursor-themes/{}", GUI::ConnectionToWindowServer::the().get_cursor_theme()), Core::DirIterator::Flags::SkipDots);

while (iterator.has_next()) {
auto path = iterator.next_full_path();
Expand Down
26 changes: 13 additions & 13 deletions Userland/Libraries/LibFileSystemAccessClient/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// FIXME: LibIPC Decoder and Encoder are sensitive to include order here
// clang-format off
#include <LibGUI/WindowServerConnection.h>
#include <LibGUI/ConnectionToWindowServer.h>
// clang-format on
#include <AK/LexicalPath.h>
#include <LibCore/File.h>
Expand All @@ -31,14 +31,14 @@ Result Client::try_request_file_read_only_approved(GUI::Window* parent_window, S
m_promise = Core::Promise<Result>::construct();
m_parent_window = parent_window;

auto parent_window_server_client_id = GUI::WindowServerConnection::the().expose_client_id();
auto parent_window_server_client_id = GUI::ConnectionToWindowServer::the().expose_client_id();
auto child_window_server_client_id = expose_window_server_client_id();
auto parent_window_id = parent_window->window_id();

GUI::WindowServerConnection::the().async_add_window_stealing_for_client(child_window_server_client_id, parent_window_id);
GUI::ConnectionToWindowServer::the().async_add_window_stealing_for_client(child_window_server_client_id, parent_window_id);

ScopeGuard guard([parent_window_id, child_window_server_client_id] {
GUI::WindowServerConnection::the().async_remove_window_stealing_for_client(child_window_server_client_id, parent_window_id);
GUI::ConnectionToWindowServer::the().async_remove_window_stealing_for_client(child_window_server_client_id, parent_window_id);
});

if (path.starts_with('/')) {
Expand All @@ -56,14 +56,14 @@ Result Client::try_request_file(GUI::Window* parent_window, String const& path,
m_promise = Core::Promise<Result>::construct();
m_parent_window = parent_window;

auto parent_window_server_client_id = GUI::WindowServerConnection::the().expose_client_id();
auto parent_window_server_client_id = GUI::ConnectionToWindowServer::the().expose_client_id();
auto child_window_server_client_id = expose_window_server_client_id();
auto parent_window_id = parent_window->window_id();

GUI::WindowServerConnection::the().async_add_window_stealing_for_client(child_window_server_client_id, parent_window_id);
GUI::ConnectionToWindowServer::the().async_add_window_stealing_for_client(child_window_server_client_id, parent_window_id);

ScopeGuard guard([parent_window_id, child_window_server_client_id] {
GUI::WindowServerConnection::the().async_remove_window_stealing_for_client(child_window_server_client_id, parent_window_id);
GUI::ConnectionToWindowServer::the().async_remove_window_stealing_for_client(child_window_server_client_id, parent_window_id);
});

if (path.starts_with('/')) {
Expand All @@ -81,14 +81,14 @@ Result Client::try_open_file(GUI::Window* parent_window, String const& window_ti
m_promise = Core::Promise<Result>::construct();
m_parent_window = parent_window;

auto parent_window_server_client_id = GUI::WindowServerConnection::the().expose_client_id();
auto parent_window_server_client_id = GUI::ConnectionToWindowServer::the().expose_client_id();
auto child_window_server_client_id = expose_window_server_client_id();
auto parent_window_id = parent_window->window_id();

GUI::WindowServerConnection::the().async_add_window_stealing_for_client(child_window_server_client_id, parent_window_id);
GUI::ConnectionToWindowServer::the().async_add_window_stealing_for_client(child_window_server_client_id, parent_window_id);

ScopeGuard guard([parent_window_id, child_window_server_client_id] {
GUI::WindowServerConnection::the().async_remove_window_stealing_for_client(child_window_server_client_id, parent_window_id);
GUI::ConnectionToWindowServer::the().async_remove_window_stealing_for_client(child_window_server_client_id, parent_window_id);
});

async_prompt_open_file(parent_window_server_client_id, parent_window_id, window_title, path, requested_access);
Expand All @@ -101,14 +101,14 @@ Result Client::try_save_file(GUI::Window* parent_window, String const& name, Str
m_promise = Core::Promise<Result>::construct();
m_parent_window = parent_window;

auto parent_window_server_client_id = GUI::WindowServerConnection::the().expose_client_id();
auto parent_window_server_client_id = GUI::ConnectionToWindowServer::the().expose_client_id();
auto child_window_server_client_id = expose_window_server_client_id();
auto parent_window_id = parent_window->window_id();

GUI::WindowServerConnection::the().async_add_window_stealing_for_client(child_window_server_client_id, parent_window_id);
GUI::ConnectionToWindowServer::the().async_add_window_stealing_for_client(child_window_server_client_id, parent_window_id);

ScopeGuard guard([parent_window_id, child_window_server_client_id] {
GUI::WindowServerConnection::the().async_remove_window_stealing_for_client(child_window_server_client_id, parent_window_id);
GUI::ConnectionToWindowServer::the().async_remove_window_stealing_for_client(child_window_server_client_id, parent_window_id);
});

async_prompt_save_file(parent_window_server_client_id, parent_window_id, name.is_null() ? "Untitled" : name, ext.is_null() ? "txt" : ext, Core::StandardPaths::home_directory(), requested_access);
Expand Down
Loading

0 comments on commit 935d023

Please sign in to comment.