Userland: Rename WindowServerConnection=>ConnectionToWindowServer

This was done with CLion's automatic rename feature.
This commit is contained in:
Itamar 2022-02-25 12:39:33 +02:00 committed by Andreas Kling
parent af132fdbd1
commit 935d023967
Notes: sideshowbarker 2024-07-17 18:16:02 +09:00
43 changed files with 201 additions and 201 deletions

View file

@ -30,7 +30,7 @@ ErrorOr<NonnullRefPtr<Menu>> Window::try_add_menu(String name)
auto menu = TRY(m_menubar->try_add_menu({}, move(name))); auto menu = TRY(m_menubar->try_add_menu({}, move(name)));
if (m_window_id) { if (m_window_id) {
menu->realize_menu_if_needed(); 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; return menu;
} }

View file

@ -16,13 +16,13 @@
#include <LibGUI/Button.h> #include <LibGUI/Button.h>
#include <LibGUI/Clipboard.h> #include <LibGUI/Clipboard.h>
#include <LibGUI/ComboBox.h> #include <LibGUI/ComboBox.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Desktop.h> #include <LibGUI/Desktop.h>
#include <LibGUI/FilePicker.h> #include <LibGUI/FilePicker.h>
#include <LibGUI/FileSystemModel.h> #include <LibGUI/FileSystemModel.h>
#include <LibGUI/IconView.h> #include <LibGUI/IconView.h>
#include <LibGUI/ItemListModel.h> #include <LibGUI/ItemListModel.h>
#include <LibGUI/MessageBox.h> #include <LibGUI/MessageBox.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Palette.h> #include <LibGfx/Palette.h>
#include <LibGfx/SystemTheme.h> #include <LibGfx/SystemTheme.h>

View file

@ -7,11 +7,11 @@
#include "DesktopSettingsWidget.h" #include "DesktopSettingsWidget.h"
#include <Applications/DisplaySettings/DesktopSettingsGML.h> #include <Applications/DisplaySettings/DesktopSettingsGML.h>
#include <LibGUI/BoxLayout.h> #include <LibGUI/BoxLayout.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Desktop.h> #include <LibGUI/Desktop.h>
#include <LibGUI/Label.h> #include <LibGUI/Label.h>
#include <LibGUI/MessageBox.h> #include <LibGUI/MessageBox.h>
#include <LibGUI/SpinBox.h> #include <LibGUI/SpinBox.h>
#include <LibGUI/WindowServerConnection.h>
namespace DisplaySettings { namespace DisplaySettings {
@ -42,7 +42,7 @@ void DesktopSettingsWidget::apply_settings()
auto workspace_columns = (unsigned)m_workspace_columns_spinbox->value(); auto workspace_columns = (unsigned)m_workspace_columns_spinbox->value();
auto& desktop = GUI::Desktop::the(); auto& desktop = GUI::Desktop::the();
if (workspace_rows != desktop.workspace_rows() || workspace_columns != desktop.workspace_columns()) { 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"), GUI::MessageBox::show(window(), String::formatted("Error applying workspace settings"),
"Workspace settings", GUI::MessageBox::Type::Error); "Workspace settings", GUI::MessageBox::Type::Error);
} }

View file

@ -9,8 +9,8 @@
#include "FontSettingsWidget.h" #include "FontSettingsWidget.h"
#include <Applications/DisplaySettings/FontSettingsGML.h> #include <Applications/DisplaySettings/FontSettingsGML.h>
#include <LibGUI/Button.h> #include <LibGUI/Button.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/FontPicker.h> #include <LibGUI/FontPicker.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/FontDatabase.h> #include <LibGfx/FontDatabase.h>
namespace DisplaySettings { namespace DisplaySettings {
@ -54,7 +54,7 @@ static void update_label_with_font(GUI::Label& label, Gfx::Font const& font)
void FontSettingsWidget::apply_settings() 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());
} }
} }

View file

@ -10,11 +10,11 @@
#include <LibGUI/BoxLayout.h> #include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h> #include <LibGUI/Button.h>
#include <LibGUI/ComboBox.h> #include <LibGUI/ComboBox.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/ItemListModel.h> #include <LibGUI/ItemListModel.h>
#include <LibGUI/Label.h> #include <LibGUI/Label.h>
#include <LibGUI/MessageBox.h> #include <LibGUI/MessageBox.h>
#include <LibGUI/RadioButton.h> #include <LibGUI/RadioButton.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/SystemTheme.h> #include <LibGfx/SystemTheme.h>
namespace DisplaySettings { namespace DisplaySettings {
@ -140,7 +140,7 @@ static String display_name_from_edid(EDID::Parser const& edid)
void MonitorSettingsWidget::load_current_settings() 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_screens.clear();
m_screen_edids.clear(); m_screen_edids.clear();
@ -214,9 +214,9 @@ void MonitorSettingsWidget::apply_settings()
{ {
// Fetch the latest configuration again, in case it has been changed by someone else. // 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... // 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) { 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()) { if (result.success()) {
load_current_settings(); // Refresh load_current_settings(); // Refresh
@ -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 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) { 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()) { if (!save_result.success()) {
GUI::MessageBox::show(window(), String::formatted("Error saving settings: {}", save_result.error_msg()), GUI::MessageBox::show(window(), String::formatted("Error saving settings: {}", save_result.error_msg()),
"Unable to save setting", GUI::MessageBox::Type::Error); "Unable to save setting", GUI::MessageBox::Type::Error);
} }
} else { } 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()) { if (!restore_result.success()) {
GUI::MessageBox::show(window(), String::formatted("Error restoring settings: {}", restore_result.error_msg()), GUI::MessageBox::show(window(), String::formatted("Error restoring settings: {}", restore_result.error_msg()),
"Unable to restore setting", GUI::MessageBox::Type::Error); "Unable to restore setting", GUI::MessageBox::Type::Error);
@ -269,7 +269,7 @@ void MonitorSettingsWidget::show_screen_numbers(bool show)
if (m_showing_screen_numbers == show) if (m_showing_screen_numbers == show)
return; return;
m_showing_screen_numbers = show; 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&) void MonitorSettingsWidget::show_event(GUI::ShowEvent&)

View file

@ -6,10 +6,10 @@
*/ */
#include "MagnifierWidget.h" #include "MagnifierWidget.h"
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/DisplayLink.h> #include <LibGUI/DisplayLink.h>
#include <LibGUI/Painter.h> #include <LibGUI/Painter.h>
#include <LibGUI/Window.h> #include <LibGUI/Window.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Rect.h> #include <LibGfx/Rect.h>
MagnifierWidget::MagnifierWidget() MagnifierWidget::MagnifierWidget()
@ -53,7 +53,7 @@ void MagnifierWidget::sync()
auto size = frame_inner_rect().size(); auto size = frame_inner_rect().size();
Gfx::IntSize grab_size { size.width() / m_scale_factor, size.height() / m_scale_factor }; 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); m_grabbed_bitmaps.enqueue(m_grabbed_bitmap);
update(); update();
} }

View file

@ -7,10 +7,10 @@
#include "MouseWidget.h" #include "MouseWidget.h"
#include <Applications/MouseSettings/MouseWidgetGML.h> #include <Applications/MouseSettings/MouseWidgetGML.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Label.h> #include <LibGUI/Label.h>
#include <LibGUI/Slider.h> #include <LibGUI/Slider.h>
#include <LibGUI/SpinBox.h> #include <LibGUI/SpinBox.h>
#include <LibGUI/WindowServerConnection.h>
#include <WindowServer/Screen.h> #include <WindowServer/Screen.h>
#include <WindowServer/WindowManager.h> #include <WindowServer/WindowManager.h>
@ -28,12 +28,12 @@ MouseWidget::MouseWidget()
m_speed_slider->on_change = [&](int value) { m_speed_slider->on_change = [&](int value) {
m_speed_label->set_text(String::formatted("{} %", 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_speed_slider->set_value(slider_value);
m_scroll_length_spinbox = *find_descendant_of_type_named<GUI::SpinBox>("scroll_length_spinbox"); 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_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_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"); m_double_click_speed_label = *find_descendant_of_type_named<GUI::Label>("double_click_speed_label");
@ -44,18 +44,18 @@ MouseWidget::MouseWidget()
m_double_click_arrow_widget->set_double_click_speed(speed); 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_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 = *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() void MouseWidget::apply_settings()
{ {
float const factor = m_speed_slider->value() / speed_slider_scale; float const factor = m_speed_slider->value() / speed_slider_scale;
GUI::WindowServerConnection::the().async_set_mouse_acceleration(factor); GUI::ConnectionToWindowServer::the().async_set_mouse_acceleration(factor);
GUI::WindowServerConnection::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::WindowServerConnection::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::WindowServerConnection::the().async_set_buttons_switched(m_switch_buttons_checkbox->is_checked()); GUI::ConnectionToWindowServer::the().async_set_buttons_switched(m_switch_buttons_checkbox->is_checked());
} }
void MouseWidget::reset_default_values() void MouseWidget::reset_default_values()

View file

@ -11,9 +11,9 @@
#include <LibCore/DirIterator.h> #include <LibCore/DirIterator.h>
#include <LibGUI/Button.h> #include <LibGUI/Button.h>
#include <LibGUI/ComboBox.h> #include <LibGUI/ComboBox.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/SortingProxyModel.h> #include <LibGUI/SortingProxyModel.h>
#include <LibGUI/TableView.h> #include <LibGUI/TableView.h>
#include <LibGUI/WindowServerConnection.h>
String MouseCursorModel::column_name(int column_index) const String MouseCursorModel::column_name(int column_index) const
{ {
@ -115,7 +115,7 @@ ThemeWidget::ThemeWidget()
m_cursors_tableview->set_column_width(0, 25); m_cursors_tableview->set_column_width(0, 25);
m_cursors_tableview->model()->invalidate(); 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); mouse_cursor_model->change_theme(m_theme_name);
m_theme_name_box = find_descendant_of_type_named<GUI::ComboBox>("theme_name_box"); m_theme_name_box = find_descendant_of_type_named<GUI::ComboBox>("theme_name_box");
@ -130,7 +130,7 @@ ThemeWidget::ThemeWidget()
void ThemeWidget::apply_settings() 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() void ThemeWidget::reset_default_values()

View file

@ -6,8 +6,8 @@
#include "TreeMapWidget.h" #include "TreeMapWidget.h"
#include <AK/NumberFormat.h> #include <AK/NumberFormat.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Painter.h> #include <LibGUI/Painter.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Font.h> #include <LibGfx/Font.h>
#include <WindowServer/WindowManager.h> #include <WindowServer/WindowManager.h>
@ -309,7 +309,7 @@ void TreeMapWidget::mousewheel_event(GUI::MouseEvent& event)
{ {
int delta = event.wheel_delta_y(); int delta = event.wheel_delta_y();
// FIXME: The wheel_delta_y is premultiplied in the window server, we actually want a raw value here. // 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) { if (delta > 0) {
size_t step_back = delta / step_size; size_t step_back = delta / step_size;
if (step_back > m_viewpoint) if (step_back > m_viewpoint)

View file

@ -7,8 +7,8 @@
#include "TerminalSettingsWidget.h" #include "TerminalSettingsWidget.h"
#include <LibCore/System.h> #include <LibCore/System.h>
#include <LibGUI/Application.h> #include <LibGUI/Application.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/SettingsWindow.h> #include <LibGUI/SettingsWindow.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibMain/Main.h> #include <LibMain/Main.h>
// Including this after to avoid LibIPC errors // Including this after to avoid LibIPC errors

View file

@ -10,6 +10,7 @@
#include <LibGUI/Action.h> #include <LibGUI/Action.h>
#include <LibGUI/Application.h> #include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h> #include <LibGUI/BoxLayout.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Frame.h> #include <LibGUI/Frame.h>
#include <LibGUI/Icon.h> #include <LibGUI/Icon.h>
#include <LibGUI/Menu.h> #include <LibGUI/Menu.h>
@ -17,7 +18,6 @@
#include <LibGUI/Painter.h> #include <LibGUI/Painter.h>
#include <LibGUI/Widget.h> #include <LibGUI/Widget.h>
#include <LibGUI/Window.h> #include <LibGUI/Window.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Bitmap.h> #include <LibGfx/Bitmap.h>
#include <LibGfx/Path.h> #include <LibGfx/Path.h>
#include <LibMain/Main.h> #include <LibMain/Main.h>
@ -74,7 +74,7 @@ public:
painter.stroke_path(path, Color::Black, 1); 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 primary_pressed = m_buttons & GUI::MouseButton::Primary;
auto secondary_pressed = m_buttons & GUI::MouseButton::Secondary; auto secondary_pressed = m_buttons & GUI::MouseButton::Secondary;

View file

@ -10,8 +10,8 @@
#include <AK/NonnullRefPtr.h> #include <AK/NonnullRefPtr.h>
#include <AK/Vector.h> #include <AK/Vector.h>
#include <LibCore/DirIterator.h> #include <LibCore/DirIterator.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Model.h> #include <LibGUI/Model.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/CursorParams.h> #include <LibGfx/CursorParams.h>
class MouseCursorModel final : public GUI::Model { class MouseCursorModel final : public GUI::Model {
@ -60,7 +60,7 @@ public:
{ {
m_cursors.clear(); 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()) { while (iterator.has_next()) {
auto path = iterator.next_full_path(); auto path = iterator.next_full_path();

View file

@ -7,7 +7,7 @@
// FIXME: LibIPC Decoder and Encoder are sensitive to include order here // FIXME: LibIPC Decoder and Encoder are sensitive to include order here
// clang-format off // clang-format off
#include <LibGUI/WindowServerConnection.h> #include <LibGUI/ConnectionToWindowServer.h>
// clang-format on // clang-format on
#include <AK/LexicalPath.h> #include <AK/LexicalPath.h>
#include <LibCore/File.h> #include <LibCore/File.h>
@ -31,14 +31,14 @@ Result Client::try_request_file_read_only_approved(GUI::Window* parent_window, S
m_promise = Core::Promise<Result>::construct(); m_promise = Core::Promise<Result>::construct();
m_parent_window = parent_window; 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 child_window_server_client_id = expose_window_server_client_id();
auto parent_window_id = parent_window->window_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] { 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('/')) { if (path.starts_with('/')) {
@ -56,14 +56,14 @@ Result Client::try_request_file(GUI::Window* parent_window, String const& path,
m_promise = Core::Promise<Result>::construct(); m_promise = Core::Promise<Result>::construct();
m_parent_window = parent_window; 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 child_window_server_client_id = expose_window_server_client_id();
auto parent_window_id = parent_window->window_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] { 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('/')) { if (path.starts_with('/')) {
@ -81,14 +81,14 @@ Result Client::try_open_file(GUI::Window* parent_window, String const& window_ti
m_promise = Core::Promise<Result>::construct(); m_promise = Core::Promise<Result>::construct();
m_parent_window = parent_window; 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 child_window_server_client_id = expose_window_server_client_id();
auto parent_window_id = parent_window->window_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] { 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); async_prompt_open_file(parent_window_server_client_id, parent_window_id, window_title, path, requested_access);
@ -101,14 +101,14 @@ Result Client::try_save_file(GUI::Window* parent_window, String const& name, Str
m_promise = Core::Promise<Result>::construct(); m_promise = Core::Promise<Result>::construct();
m_parent_window = parent_window; 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 child_window_server_client_id = expose_window_server_client_id();
auto parent_window_id = parent_window->window_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] { 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); 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);

View file

@ -9,12 +9,12 @@
#include <LibGUI/Action.h> #include <LibGUI/Action.h>
#include <LibGUI/Application.h> #include <LibGUI/Application.h>
#include <LibGUI/Clipboard.h> #include <LibGUI/Clipboard.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Desktop.h> #include <LibGUI/Desktop.h>
#include <LibGUI/Label.h> #include <LibGUI/Label.h>
#include <LibGUI/Menubar.h> #include <LibGUI/Menubar.h>
#include <LibGUI/Painter.h> #include <LibGUI/Painter.h>
#include <LibGUI/Window.h> #include <LibGUI/Window.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Font.h> #include <LibGfx/Font.h>
#include <LibGfx/Palette.h> #include <LibGfx/Palette.h>
@ -73,7 +73,7 @@ Application::Application(int argc, char** argv, Core::EventLoop::MakeInspectable
VERIFY(!*s_the); VERIFY(!*s_the);
*s_the = *this; *s_the = *this;
m_event_loop = make<Core::EventLoop>(make_inspectable); m_event_loop = make<Core::EventLoop>(make_inspectable);
WindowServerConnection::the(); ConnectionToWindowServer::the();
Clipboard::initialize({}); Clipboard::initialize({});
if (argc > 0) if (argc > 0)
m_invoked_as = argv[0]; m_invoked_as = argv[0];
@ -222,7 +222,7 @@ void Application::request_tooltip_show()
Gfx::IntRect desktop_rect = Desktop::the().rect(); Gfx::IntRect desktop_rect = Desktop::the().rect();
const int margin = 30; const int margin = 30;
Gfx::IntPoint adjusted_pos = WindowServerConnection::the().get_global_cursor_position(); Gfx::IntPoint adjusted_pos = ConnectionToWindowServer::the().get_global_cursor_position();
adjusted_pos.translate_by(0, 18); adjusted_pos.translate_by(0, 18);
@ -293,7 +293,7 @@ void Application::set_drag_hovered_widget_impl(Widget* widget, const Gfx::IntPoi
} }
} }
void Application::notify_drag_cancelled(Badge<WindowServerConnection>) void Application::notify_drag_cancelled(Badge<ConnectionToWindowServer>)
{ {
set_drag_hovered_widget_impl(nullptr); set_drag_hovered_widget_impl(nullptr);
} }

View file

@ -79,7 +79,7 @@ public:
{ {
set_drag_hovered_widget_impl(widget, position, move(mime_types)); set_drag_hovered_widget_impl(widget, position, move(mime_types));
} }
void notify_drag_cancelled(Badge<WindowServerConnection>); void notify_drag_cancelled(Badge<ConnectionToWindowServer>);
Function<void(Action&)> on_action_enter; Function<void(Action&)> on_action_enter;
Function<void(Action&)> on_action_leave; Function<void(Action&)> on_action_leave;

View file

@ -112,7 +112,7 @@ set(SOURCES
VimEditingEngine.cpp VimEditingEngine.cpp
Widget.cpp Widget.cpp
Window.cpp Window.cpp
WindowServerConnection.cpp ConnectionToWindowServer.cpp
ConnectionToWindowMangerServer.cpp ConnectionToWindowMangerServer.cpp
Wizards/WizardDialog.cpp Wizards/WizardDialog.cpp
Wizards/AbstractWizardPage.cpp Wizards/AbstractWizardPage.cpp

View file

@ -7,13 +7,13 @@
#include <LibGUI/BoxLayout.h> #include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h> #include <LibGUI/Button.h>
#include <LibGUI/ColorPicker.h> #include <LibGUI/ColorPicker.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Frame.h> #include <LibGUI/Frame.h>
#include <LibGUI/Label.h> #include <LibGUI/Label.h>
#include <LibGUI/Painter.h> #include <LibGUI/Painter.h>
#include <LibGUI/SpinBox.h> #include <LibGUI/SpinBox.h>
#include <LibGUI/TabWidget.h> #include <LibGUI/TabWidget.h>
#include <LibGUI/TextBox.h> #include <LibGUI/TextBox.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Palette.h> #include <LibGfx/Palette.h>
namespace GUI { namespace GUI {
@ -158,7 +158,7 @@ private:
virtual void mousedown_event(GUI::MouseEvent&) override { m_event_loop->quit(1); } virtual void mousedown_event(GUI::MouseEvent&) override { m_event_loop->quit(1); }
virtual void mousemove_event(GUI::MouseEvent&) override virtual void mousemove_event(GUI::MouseEvent&) override
{ {
auto new_col = WindowServerConnection::the().get_color_under_cursor(); auto new_col = ConnectionToWindowServer::the().get_color_under_cursor();
if (!new_col.has_value()) if (!new_col.has_value())
return; return;
if (new_col == m_col) if (new_col == m_col)

View file

@ -11,6 +11,7 @@
#include <LibGUI/Action.h> #include <LibGUI/Action.h>
#include <LibGUI/Application.h> #include <LibGUI/Application.h>
#include <LibGUI/CommandPalette.h> #include <LibGUI/CommandPalette.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Desktop.h> #include <LibGUI/Desktop.h>
#include <LibGUI/DisplayLink.h> #include <LibGUI/DisplayLink.h>
#include <LibGUI/DragOperation.h> #include <LibGUI/DragOperation.h>
@ -19,7 +20,6 @@
#include <LibGUI/Menu.h> #include <LibGUI/Menu.h>
#include <LibGUI/MouseTracker.h> #include <LibGUI/MouseTracker.h>
#include <LibGUI/Window.h> #include <LibGUI/Window.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Bitmap.h> #include <LibGfx/Bitmap.h>
#include <LibGfx/FontDatabase.h> #include <LibGfx/FontDatabase.h>
#include <LibGfx/Palette.h> #include <LibGfx/Palette.h>
@ -27,11 +27,11 @@
namespace GUI { namespace GUI {
WindowServerConnection& WindowServerConnection::the() ConnectionToWindowServer& ConnectionToWindowServer::the()
{ {
static RefPtr<WindowServerConnection> s_connection = nullptr; static RefPtr<ConnectionToWindowServer> s_connection = nullptr;
if (!s_connection) if (!s_connection)
s_connection = WindowServerConnection::try_create().release_value_but_fixme_should_propagate_errors(); s_connection = ConnectionToWindowServer::try_create().release_value_but_fixme_should_propagate_errors();
return *s_connection; return *s_connection;
} }
@ -41,7 +41,7 @@ static void set_system_theme_from_anonymous_buffer(Core::AnonymousBuffer buffer)
Application::the()->set_system_palette(buffer); Application::the()->set_system_palette(buffer);
} }
WindowServerConnection::WindowServerConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket) ConnectionToWindowServer::ConnectionToWindowServer(NonnullOwnPtr<Core::Stream::LocalSocket> socket)
: IPC::ConnectionToServer<WindowClientEndpoint, WindowServerEndpoint>(*this, move(socket)) : IPC::ConnectionToServer<WindowClientEndpoint, WindowServerEndpoint>(*this, move(socket))
{ {
// NOTE: WindowServer automatically sends a "fast_greet" message to us when we connect. // NOTE: WindowServer automatically sends a "fast_greet" message to us when we connect.
@ -54,12 +54,12 @@ WindowServerConnection::WindowServerConnection(NonnullOwnPtr<Core::Stream::Local
m_client_id = message->client_id(); m_client_id = message->client_id();
} }
void WindowServerConnection::fast_greet(Vector<Gfx::IntRect> const&, u32, u32, u32, Core::AnonymousBuffer const&, String const&, String const&, i32) void ConnectionToWindowServer::fast_greet(Vector<Gfx::IntRect> const&, u32, u32, u32, Core::AnonymousBuffer const&, String const&, String const&, i32)
{ {
// NOTE: This message is handled in the constructor. // NOTE: This message is handled in the constructor.
} }
void WindowServerConnection::update_system_theme(Core::AnonymousBuffer const& theme_buffer) void ConnectionToWindowServer::update_system_theme(Core::AnonymousBuffer const& theme_buffer)
{ {
set_system_theme_from_anonymous_buffer(theme_buffer); set_system_theme_from_anonymous_buffer(theme_buffer);
Window::update_all_windows({}); Window::update_all_windows({});
@ -68,7 +68,7 @@ void WindowServerConnection::update_system_theme(Core::AnonymousBuffer const& th
}); });
} }
void WindowServerConnection::update_system_fonts(const String& default_font_query, const String& fixed_width_font_query) void ConnectionToWindowServer::update_system_fonts(const String& default_font_query, const String& fixed_width_font_query)
{ {
Gfx::FontDatabase::set_default_font_query(default_font_query); Gfx::FontDatabase::set_default_font_query(default_font_query);
Gfx::FontDatabase::set_fixed_width_font_query(fixed_width_font_query); Gfx::FontDatabase::set_fixed_width_font_query(fixed_width_font_query);
@ -78,56 +78,56 @@ void WindowServerConnection::update_system_fonts(const String& default_font_quer
}); });
} }
void WindowServerConnection::paint(i32 window_id, Gfx::IntSize const& window_size, Vector<Gfx::IntRect> const& rects) void ConnectionToWindowServer::paint(i32 window_id, Gfx::IntSize const& window_size, Vector<Gfx::IntRect> const& rects)
{ {
if (auto* window = Window::from_window_id(window_id)) if (auto* window = Window::from_window_id(window_id))
Core::EventLoop::current().post_event(*window, make<MultiPaintEvent>(rects, window_size)); Core::EventLoop::current().post_event(*window, make<MultiPaintEvent>(rects, window_size));
} }
void WindowServerConnection::window_resized(i32 window_id, Gfx::IntRect const& new_rect) void ConnectionToWindowServer::window_resized(i32 window_id, Gfx::IntRect const& new_rect)
{ {
if (auto* window = Window::from_window_id(window_id)) { if (auto* window = Window::from_window_id(window_id)) {
Core::EventLoop::current().post_event(*window, make<ResizeEvent>(new_rect.size())); Core::EventLoop::current().post_event(*window, make<ResizeEvent>(new_rect.size()));
} }
} }
void WindowServerConnection::window_activated(i32 window_id) void ConnectionToWindowServer::window_activated(i32 window_id)
{ {
if (auto* window = Window::from_window_id(window_id)) if (auto* window = Window::from_window_id(window_id))
Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowBecameActive)); Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowBecameActive));
} }
void WindowServerConnection::window_deactivated(i32 window_id) void ConnectionToWindowServer::window_deactivated(i32 window_id)
{ {
if (auto* window = Window::from_window_id(window_id)) if (auto* window = Window::from_window_id(window_id))
Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowBecameInactive)); Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowBecameInactive));
} }
void WindowServerConnection::window_input_entered(i32 window_id) void ConnectionToWindowServer::window_input_entered(i32 window_id)
{ {
if (auto* window = Window::from_window_id(window_id)) if (auto* window = Window::from_window_id(window_id))
Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowInputEntered)); Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowInputEntered));
} }
void WindowServerConnection::window_input_left(i32 window_id) void ConnectionToWindowServer::window_input_left(i32 window_id)
{ {
if (auto* window = Window::from_window_id(window_id)) if (auto* window = Window::from_window_id(window_id))
Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowInputLeft)); Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowInputLeft));
} }
void WindowServerConnection::window_close_request(i32 window_id) void ConnectionToWindowServer::window_close_request(i32 window_id)
{ {
if (auto* window = Window::from_window_id(window_id)) if (auto* window = Window::from_window_id(window_id))
Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowCloseRequest)); Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowCloseRequest));
} }
void WindowServerConnection::window_entered(i32 window_id) void ConnectionToWindowServer::window_entered(i32 window_id)
{ {
if (auto* window = Window::from_window_id(window_id)) if (auto* window = Window::from_window_id(window_id))
Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowEntered)); Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowEntered));
} }
void WindowServerConnection::window_left(i32 window_id) void ConnectionToWindowServer::window_left(i32 window_id)
{ {
if (auto* window = Window::from_window_id(window_id)) if (auto* window = Window::from_window_id(window_id))
Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowLeft)); Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowLeft));
@ -163,7 +163,7 @@ static Action* action_for_key_event(Window& window, KeyEvent const& event)
return nullptr; return nullptr;
} }
void WindowServerConnection::key_down(i32 window_id, u32 code_point, u32 key, u32 modifiers, u32 scancode) void ConnectionToWindowServer::key_down(i32 window_id, u32 code_point, u32 key, u32 modifiers, u32 scancode)
{ {
auto* window = Window::from_window_id(window_id); auto* window = Window::from_window_id(window_id);
if (!window) if (!window)
@ -215,7 +215,7 @@ void WindowServerConnection::key_down(i32 window_id, u32 code_point, u32 key, u3
Core::EventLoop::current().post_event(*window, move(key_event)); Core::EventLoop::current().post_event(*window, move(key_event));
} }
void WindowServerConnection::key_up(i32 window_id, u32 code_point, u32 key, u32 modifiers, u32 scancode) void ConnectionToWindowServer::key_up(i32 window_id, u32 code_point, u32 key, u32 modifiers, u32 scancode)
{ {
auto* window = Window::from_window_id(window_id); auto* window = Window::from_window_id(window_id);
if (!window) if (!window)
@ -246,19 +246,19 @@ static MouseButton to_mouse_button(u32 button)
} }
} }
void WindowServerConnection::mouse_down(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y) void ConnectionToWindowServer::mouse_down(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y)
{ {
if (auto* window = Window::from_window_id(window_id)) if (auto* window = Window::from_window_id(window_id))
Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseDown, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y)); Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseDown, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y));
} }
void WindowServerConnection::mouse_up(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y) void ConnectionToWindowServer::mouse_up(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y)
{ {
if (auto* window = Window::from_window_id(window_id)) if (auto* window = Window::from_window_id(window_id))
Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseUp, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y)); Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseUp, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y));
} }
void WindowServerConnection::mouse_move(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, bool is_drag, Vector<String> const& mime_types) void ConnectionToWindowServer::mouse_move(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, bool is_drag, Vector<String> const& mime_types)
{ {
if (auto* window = Window::from_window_id(window_id)) { if (auto* window = Window::from_window_id(window_id)) {
if (is_drag) if (is_drag)
@ -268,19 +268,19 @@ void WindowServerConnection::mouse_move(i32 window_id, Gfx::IntPoint const& mous
} }
} }
void WindowServerConnection::mouse_double_click(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y) void ConnectionToWindowServer::mouse_double_click(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y)
{ {
if (auto* window = Window::from_window_id(window_id)) if (auto* window = Window::from_window_id(window_id))
Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseDoubleClick, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y)); Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseDoubleClick, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y));
} }
void WindowServerConnection::mouse_wheel(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y) void ConnectionToWindowServer::mouse_wheel(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y)
{ {
if (auto* window = Window::from_window_id(window_id)) if (auto* window = Window::from_window_id(window_id))
Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseWheel, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y)); Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseWheel, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y));
} }
void WindowServerConnection::menu_visibility_did_change(i32 menu_id, bool visible) void ConnectionToWindowServer::menu_visibility_did_change(i32 menu_id, bool visible)
{ {
auto* menu = Menu::from_menu_id(menu_id); auto* menu = Menu::from_menu_id(menu_id);
if (!menu) { if (!menu) {
@ -290,7 +290,7 @@ void WindowServerConnection::menu_visibility_did_change(i32 menu_id, bool visibl
menu->visibility_did_change({}, visible); menu->visibility_did_change({}, visible);
} }
void WindowServerConnection::menu_item_activated(i32 menu_id, u32 identifier) void ConnectionToWindowServer::menu_item_activated(i32 menu_id, u32 identifier)
{ {
auto* menu = Menu::from_menu_id(menu_id); auto* menu = Menu::from_menu_id(menu_id);
if (!menu) { if (!menu) {
@ -301,11 +301,11 @@ void WindowServerConnection::menu_item_activated(i32 menu_id, u32 identifier)
action->activate(menu); action->activate(menu);
} }
void WindowServerConnection::menu_item_entered(i32 menu_id, u32 identifier) void ConnectionToWindowServer::menu_item_entered(i32 menu_id, u32 identifier)
{ {
auto* menu = Menu::from_menu_id(menu_id); auto* menu = Menu::from_menu_id(menu_id);
if (!menu) { if (!menu) {
dbgln("WindowServerConnection received MenuItemEntered for invalid menu ID {}", menu_id); dbgln("ConnectionToWindowServer received MenuItemEntered for invalid menu ID {}", menu_id);
return; return;
} }
auto* action = menu->action_at(identifier); auto* action = menu->action_at(identifier);
@ -317,11 +317,11 @@ void WindowServerConnection::menu_item_entered(i32 menu_id, u32 identifier)
Core::EventLoop::current().post_event(*app, make<ActionEvent>(GUI::Event::ActionEnter, *action)); Core::EventLoop::current().post_event(*app, make<ActionEvent>(GUI::Event::ActionEnter, *action));
} }
void WindowServerConnection::menu_item_left(i32 menu_id, u32 identifier) void ConnectionToWindowServer::menu_item_left(i32 menu_id, u32 identifier)
{ {
auto* menu = Menu::from_menu_id(menu_id); auto* menu = Menu::from_menu_id(menu_id);
if (!menu) { if (!menu) {
dbgln("WindowServerConnection received MenuItemLeft for invalid menu ID {}", menu_id); dbgln("ConnectionToWindowServer received MenuItemLeft for invalid menu ID {}", menu_id);
return; return;
} }
auto* action = menu->action_at(identifier); auto* action = menu->action_at(identifier);
@ -333,7 +333,7 @@ void WindowServerConnection::menu_item_left(i32 menu_id, u32 identifier)
Core::EventLoop::current().post_event(*app, make<ActionEvent>(GUI::Event::ActionLeave, *action)); Core::EventLoop::current().post_event(*app, make<ActionEvent>(GUI::Event::ActionLeave, *action));
} }
void WindowServerConnection::screen_rects_changed(Vector<Gfx::IntRect> const& rects, u32 main_screen_index, u32 workspace_rows, u32 workspace_columns) void ConnectionToWindowServer::screen_rects_changed(Vector<Gfx::IntRect> const& rects, u32 main_screen_index, u32 workspace_rows, u32 workspace_columns)
{ {
Desktop::the().did_receive_screen_rects({}, rects, main_screen_index, workspace_rows, workspace_columns); Desktop::the().did_receive_screen_rects({}, rects, main_screen_index, workspace_rows, workspace_columns);
Window::for_each_window({}, [&](auto& window) { Window::for_each_window({}, [&](auto& window) {
@ -341,19 +341,19 @@ void WindowServerConnection::screen_rects_changed(Vector<Gfx::IntRect> const& re
}); });
} }
void WindowServerConnection::applet_area_rect_changed(Gfx::IntRect const& rect) void ConnectionToWindowServer::applet_area_rect_changed(Gfx::IntRect const& rect)
{ {
Window::for_each_window({}, [&](auto& window) { Window::for_each_window({}, [&](auto& window) {
Core::EventLoop::current().post_event(window, make<AppletAreaRectChangeEvent>(rect)); Core::EventLoop::current().post_event(window, make<AppletAreaRectChangeEvent>(rect));
}); });
} }
void WindowServerConnection::set_wallpaper_finished(bool) void ConnectionToWindowServer::set_wallpaper_finished(bool)
{ {
// This is handled manually by Desktop::set_wallpaper(). // This is handled manually by Desktop::set_wallpaper().
} }
void WindowServerConnection::drag_dropped(i32 window_id, Gfx::IntPoint const& mouse_position, String const& text, HashMap<String, ByteBuffer> const& mime_data) void ConnectionToWindowServer::drag_dropped(i32 window_id, Gfx::IntPoint const& mouse_position, String const& text, HashMap<String, ByteBuffer> const& mime_data)
{ {
if (auto* window = Window::from_window_id(window_id)) { if (auto* window = Window::from_window_id(window_id)) {
auto mime_data_obj = Core::MimeData::construct(mime_data); auto mime_data_obj = Core::MimeData::construct(mime_data);
@ -361,24 +361,24 @@ void WindowServerConnection::drag_dropped(i32 window_id, Gfx::IntPoint const& mo
} }
} }
void WindowServerConnection::drag_accepted() void ConnectionToWindowServer::drag_accepted()
{ {
DragOperation::notify_accepted({}); DragOperation::notify_accepted({});
} }
void WindowServerConnection::drag_cancelled() void ConnectionToWindowServer::drag_cancelled()
{ {
DragOperation::notify_cancelled({}); DragOperation::notify_cancelled({});
Application::the()->notify_drag_cancelled({}); Application::the()->notify_drag_cancelled({});
} }
void WindowServerConnection::window_state_changed(i32 window_id, bool minimized, bool occluded) void ConnectionToWindowServer::window_state_changed(i32 window_id, bool minimized, bool occluded)
{ {
if (auto* window = Window::from_window_id(window_id)) if (auto* window = Window::from_window_id(window_id))
window->notify_state_changed({}, minimized, occluded); window->notify_state_changed({}, minimized, occluded);
} }
void WindowServerConnection::display_link_notification() void ConnectionToWindowServer::display_link_notification()
{ {
if (m_display_link_notification_pending) if (m_display_link_notification_pending)
return; return;
@ -390,12 +390,12 @@ void WindowServerConnection::display_link_notification()
}); });
} }
void WindowServerConnection::track_mouse_move(Gfx::IntPoint const& mouse_position) void ConnectionToWindowServer::track_mouse_move(Gfx::IntPoint const& mouse_position)
{ {
MouseTracker::track_mouse_move({}, mouse_position); MouseTracker::track_mouse_move({}, mouse_position);
} }
void WindowServerConnection::ping() void ConnectionToWindowServer::ping()
{ {
async_pong(); async_pong();
} }

View file

@ -13,16 +13,16 @@
namespace GUI { namespace GUI {
class WindowServerConnection final class ConnectionToWindowServer final
: public IPC::ConnectionToServer<WindowClientEndpoint, WindowServerEndpoint> : public IPC::ConnectionToServer<WindowClientEndpoint, WindowServerEndpoint>
, public WindowClientEndpoint { , public WindowClientEndpoint {
IPC_CLIENT_CONNECTION(WindowServerConnection, "/tmp/portal/window") IPC_CLIENT_CONNECTION(ConnectionToWindowServer, "/tmp/portal/window")
public: public:
static WindowServerConnection& the(); static ConnectionToWindowServer& the();
i32 expose_client_id() { return m_client_id; } i32 expose_client_id() { return m_client_id; }
private: private:
WindowServerConnection(NonnullOwnPtr<Core::Stream::LocalSocket>); ConnectionToWindowServer(NonnullOwnPtr<Core::Stream::LocalSocket>);
virtual void fast_greet(Vector<Gfx::IntRect> const&, u32, u32, u32, Core::AnonymousBuffer const&, String const&, String const&, i32) override; virtual void fast_greet(Vector<Gfx::IntRect> const&, u32, u32, u32, Core::AnonymousBuffer const&, String const&, String const&, i32) override;
virtual void paint(i32, Gfx::IntSize const&, Vector<Gfx::IntRect> const&) override; virtual void paint(i32, Gfx::IntSize const&, Vector<Gfx::IntRect> const&) override;

View file

@ -6,8 +6,8 @@
#include <AK/Badge.h> #include <AK/Badge.h>
#include <AK/TemporaryChange.h> #include <AK/TemporaryChange.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Desktop.h> #include <LibGUI/Desktop.h>
#include <LibGUI/WindowServerConnection.h>
#include <string.h> #include <string.h>
// Including this after to avoid LibIPC errors // Including this after to avoid LibIPC errors
@ -25,7 +25,7 @@ Desktop::Desktop()
{ {
} }
void Desktop::did_receive_screen_rects(Badge<WindowServerConnection>, const Vector<Gfx::IntRect, 4>& rects, size_t main_screen_index, unsigned workspace_rows, unsigned workspace_columns) void Desktop::did_receive_screen_rects(Badge<ConnectionToWindowServer>, const Vector<Gfx::IntRect, 4>& rects, size_t main_screen_index, unsigned workspace_rows, unsigned workspace_columns)
{ {
m_main_screen_index = main_screen_index; m_main_screen_index = main_screen_index;
m_rects = rects; m_rects = rects;
@ -46,12 +46,12 @@ void Desktop::did_receive_screen_rects(Badge<WindowServerConnection>, const Vect
void Desktop::set_background_color(StringView background_color) void Desktop::set_background_color(StringView background_color)
{ {
WindowServerConnection::the().async_set_background_color(background_color); ConnectionToWindowServer::the().async_set_background_color(background_color);
} }
void Desktop::set_wallpaper_mode(StringView mode) void Desktop::set_wallpaper_mode(StringView mode)
{ {
WindowServerConnection::the().async_set_wallpaper_mode(mode); ConnectionToWindowServer::the().async_set_wallpaper_mode(mode);
} }
String Desktop::wallpaper_path() const String Desktop::wallpaper_path() const
@ -61,7 +61,7 @@ String Desktop::wallpaper_path() const
RefPtr<Gfx::Bitmap> Desktop::wallpaper_bitmap() const RefPtr<Gfx::Bitmap> Desktop::wallpaper_bitmap() const
{ {
return WindowServerConnection::the().get_wallpaper().bitmap(); return ConnectionToWindowServer::the().get_wallpaper().bitmap();
} }
bool Desktop::set_wallpaper(RefPtr<Gfx::Bitmap> wallpaper_bitmap, Optional<String> path) bool Desktop::set_wallpaper(RefPtr<Gfx::Bitmap> wallpaper_bitmap, Optional<String> path)
@ -70,8 +70,8 @@ bool Desktop::set_wallpaper(RefPtr<Gfx::Bitmap> wallpaper_bitmap, Optional<Strin
return false; return false;
TemporaryChange is_setting_desktop_wallpaper_change(m_is_setting_desktop_wallpaper, true); TemporaryChange is_setting_desktop_wallpaper_change(m_is_setting_desktop_wallpaper, true);
WindowServerConnection::the().async_set_wallpaper(wallpaper_bitmap ? wallpaper_bitmap->to_shareable_bitmap() : Gfx::ShareableBitmap {}); ConnectionToWindowServer::the().async_set_wallpaper(wallpaper_bitmap ? wallpaper_bitmap->to_shareable_bitmap() : Gfx::ShareableBitmap {});
auto ret_val = WindowServerConnection::the().wait_for_specific_message<Messages::WindowClient::SetWallpaperFinished>()->success(); auto ret_val = ConnectionToWindowServer::the().wait_for_specific_message<Messages::WindowClient::SetWallpaperFinished>()->success();
if (ret_val && path.has_value()) { if (ret_val && path.has_value()) {
dbgln("Saving wallpaper path '{}' to ConfigServer", *path); dbgln("Saving wallpaper path '{}' to ConfigServer", *path);

View file

@ -42,7 +42,7 @@ public:
int taskbar_height() const { return TaskbarWindow::taskbar_height(); } int taskbar_height() const { return TaskbarWindow::taskbar_height(); }
void did_receive_screen_rects(Badge<WindowServerConnection>, const Vector<Gfx::IntRect, 4>&, size_t, unsigned, unsigned); void did_receive_screen_rects(Badge<ConnectionToWindowServer>, const Vector<Gfx::IntRect, 4>&, size_t, unsigned, unsigned);
template<typename F> template<typename F>
void on_receive_screen_rects(F&& callback) void on_receive_screen_rects(F&& callback)

View file

@ -6,8 +6,8 @@
#include <AK/Badge.h> #include <AK/Badge.h>
#include <AK/HashMap.h> #include <AK/HashMap.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/DisplayLink.h> #include <LibGUI/DisplayLink.h>
#include <LibGUI/WindowServerConnection.h>
namespace GUI { namespace GUI {
@ -40,7 +40,7 @@ static i32 s_next_callback_id = 1;
i32 DisplayLink::register_callback(Function<void(i32)> callback) i32 DisplayLink::register_callback(Function<void(i32)> callback)
{ {
if (callbacks().is_empty()) if (callbacks().is_empty())
WindowServerConnection::the().async_enable_display_link(); ConnectionToWindowServer::the().async_enable_display_link();
i32 callback_id = s_next_callback_id++; i32 callback_id = s_next_callback_id++;
callbacks().set(callback_id, adopt_ref(*new DisplayLinkCallback(callback_id, move(callback)))); callbacks().set(callback_id, adopt_ref(*new DisplayLinkCallback(callback_id, move(callback))));
@ -54,12 +54,12 @@ bool DisplayLink::unregister_callback(i32 callback_id)
callbacks().remove(callback_id); callbacks().remove(callback_id);
if (callbacks().is_empty()) if (callbacks().is_empty())
WindowServerConnection::the().async_disable_display_link(); ConnectionToWindowServer::the().async_disable_display_link();
return true; return true;
} }
void DisplayLink::notify(Badge<WindowServerConnection>) void DisplayLink::notify(Badge<ConnectionToWindowServer>)
{ {
auto copy_of_callbacks = callbacks(); auto copy_of_callbacks = callbacks();
for (auto& it : copy_of_callbacks) for (auto& it : copy_of_callbacks)

View file

@ -16,7 +16,7 @@ public:
static i32 register_callback(Function<void(i32)>); static i32 register_callback(Function<void(i32)>);
static bool unregister_callback(i32 callback_id); static bool unregister_callback(i32 callback_id);
static void notify(Badge<WindowServerConnection>); static void notify(Badge<ConnectionToWindowServer>);
}; };
} }

View file

@ -7,8 +7,8 @@
#include <AK/Badge.h> #include <AK/Badge.h>
#include <LibCore/EventLoop.h> #include <LibCore/EventLoop.h>
#include <LibCore/MimeData.h> #include <LibCore/MimeData.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/DragOperation.h> #include <LibGUI/DragOperation.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Bitmap.h> #include <LibGfx/Bitmap.h>
namespace GUI { namespace GUI {
@ -37,7 +37,7 @@ DragOperation::Outcome DragOperation::exec()
drag_bitmap = bitmap->to_shareable_bitmap(); drag_bitmap = bitmap->to_shareable_bitmap();
} }
auto started = WindowServerConnection::the().start_drag( auto started = ConnectionToWindowServer::the().start_drag(
m_mime_data->text(), m_mime_data->text(),
m_mime_data->all_data(), m_mime_data->all_data(),
drag_bitmap); drag_bitmap);
@ -64,13 +64,13 @@ void DragOperation::done(Outcome outcome)
m_event_loop->quit(0); m_event_loop->quit(0);
} }
void DragOperation::notify_accepted(Badge<WindowServerConnection>) void DragOperation::notify_accepted(Badge<ConnectionToWindowServer>)
{ {
VERIFY(s_current_drag_operation); VERIFY(s_current_drag_operation);
s_current_drag_operation->done(Outcome::Accepted); s_current_drag_operation->done(Outcome::Accepted);
} }
void DragOperation::notify_cancelled(Badge<WindowServerConnection>) void DragOperation::notify_cancelled(Badge<ConnectionToWindowServer>)
{ {
if (s_current_drag_operation) if (s_current_drag_operation)
s_current_drag_operation->done(Outcome::Cancelled); s_current_drag_operation->done(Outcome::Cancelled);

View file

@ -33,8 +33,8 @@ public:
Outcome exec(); Outcome exec();
Outcome outcome() const { return m_outcome; } Outcome outcome() const { return m_outcome; }
static void notify_accepted(Badge<WindowServerConnection>); static void notify_accepted(Badge<ConnectionToWindowServer>);
static void notify_cancelled(Badge<WindowServerConnection>); static void notify_cancelled(Badge<ConnectionToWindowServer>);
protected: protected:
explicit DragOperation(Core::Object* parent = nullptr); explicit DragOperation(Core::Object* parent = nullptr);

View file

@ -391,7 +391,7 @@ public:
} }
private: private:
friend class WindowServerConnection; friend class ConnectionToWindowServer;
KeyCode m_key { KeyCode::Key_Invalid }; KeyCode m_key { KeyCode::Key_Invalid };
u8 m_modifiers { 0 }; u8 m_modifiers { 0 };
u32 m_code_point { 0 }; u32 m_code_point { 0 };

View file

@ -88,7 +88,7 @@ class VerticalSlider;
class WMEvent; class WMEvent;
class Widget; class Widget;
class Window; class Window;
class WindowServerConnection; class ConnectionToWindowServer;
enum class ModelRole; enum class ModelRole;
enum class SortOrder; enum class SortOrder;

View file

@ -9,9 +9,9 @@
#include <AK/IDAllocator.h> #include <AK/IDAllocator.h>
#include <LibGUI/Action.h> #include <LibGUI/Action.h>
#include <LibGUI/ActionGroup.h> #include <LibGUI/ActionGroup.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Menu.h> #include <LibGUI/Menu.h>
#include <LibGUI/MenuItem.h> #include <LibGUI/MenuItem.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Bitmap.h> #include <LibGfx/Bitmap.h>
namespace GUI { namespace GUI {
@ -67,7 +67,7 @@ void Menu::add_action(NonnullRefPtr<Action> action)
void Menu::remove_all_actions() void Menu::remove_all_actions()
{ {
for (auto& item : m_items) { for (auto& item : m_items) {
WindowServerConnection::the().async_remove_menu_item(m_menu_id, item.identifier()); ConnectionToWindowServer::the().async_remove_menu_item(m_menu_id, item.identifier());
} }
m_items.clear(); m_items.clear();
} }
@ -119,14 +119,14 @@ void Menu::realize_if_needed(const RefPtr<Action>& default_action)
void Menu::popup(const Gfx::IntPoint& screen_position, const RefPtr<Action>& default_action) void Menu::popup(const Gfx::IntPoint& screen_position, const RefPtr<Action>& default_action)
{ {
realize_if_needed(default_action); realize_if_needed(default_action);
WindowServerConnection::the().async_popup_menu(m_menu_id, screen_position); ConnectionToWindowServer::the().async_popup_menu(m_menu_id, screen_position);
} }
void Menu::dismiss() void Menu::dismiss()
{ {
if (m_menu_id == -1) if (m_menu_id == -1)
return; return;
WindowServerConnection::the().async_dismiss_menu(m_menu_id); ConnectionToWindowServer::the().async_dismiss_menu(m_menu_id);
} }
int Menu::realize_menu(RefPtr<Action> default_action) int Menu::realize_menu(RefPtr<Action> default_action)
@ -134,7 +134,7 @@ int Menu::realize_menu(RefPtr<Action> default_action)
unrealize_menu(); unrealize_menu();
m_menu_id = s_menu_id_allocator.allocate(); m_menu_id = s_menu_id_allocator.allocate();
WindowServerConnection::the().async_create_menu(m_menu_id, m_name); ConnectionToWindowServer::the().async_create_menu(m_menu_id, m_name);
dbgln_if(MENU_DEBUG, "GUI::Menu::realize_menu(): New menu ID: {}", m_menu_id); dbgln_if(MENU_DEBUG, "GUI::Menu::realize_menu(): New menu ID: {}", m_menu_id);
VERIFY(m_menu_id > 0); VERIFY(m_menu_id > 0);
@ -153,7 +153,7 @@ void Menu::unrealize_menu()
if (m_menu_id == -1) if (m_menu_id == -1)
return; return;
all_menus().remove(m_menu_id); all_menus().remove(m_menu_id);
WindowServerConnection::the().async_destroy_menu(m_menu_id); ConnectionToWindowServer::the().async_destroy_menu(m_menu_id);
m_menu_id = -1; m_menu_id = -1;
} }
@ -178,7 +178,7 @@ void Menu::set_children_actions_enabled(bool enabled)
} }
} }
void Menu::visibility_did_change(Badge<WindowServerConnection>, bool visible) void Menu::visibility_did_change(Badge<ConnectionToWindowServer>, bool visible)
{ {
if (m_visible == visible) if (m_visible == visible)
return; return;
@ -193,7 +193,7 @@ void Menu::realize_menu_item(MenuItem& item, int item_id)
item.set_identifier({}, item_id); item.set_identifier({}, item_id);
switch (item.type()) { switch (item.type()) {
case MenuItem::Type::Separator: case MenuItem::Type::Separator:
WindowServerConnection::the().async_add_menu_separator(m_menu_id); ConnectionToWindowServer::the().async_add_menu_separator(m_menu_id);
break; break;
case MenuItem::Type::Action: { case MenuItem::Type::Action: {
auto& action = *item.action(); auto& action = *item.action();
@ -201,14 +201,14 @@ void Menu::realize_menu_item(MenuItem& item, int item_id)
bool exclusive = action.group() && action.group()->is_exclusive() && action.is_checkable(); bool exclusive = action.group() && action.group()->is_exclusive() && action.is_checkable();
bool is_default = (m_current_default_action.ptr() == &action); bool is_default = (m_current_default_action.ptr() == &action);
auto icon = action.icon() ? action.icon()->to_shareable_bitmap() : Gfx::ShareableBitmap(); auto icon = action.icon() ? action.icon()->to_shareable_bitmap() : Gfx::ShareableBitmap();
WindowServerConnection::the().async_add_menu_item(m_menu_id, item_id, -1, action.text(), action.is_enabled(), action.is_checkable(), action.is_checkable() ? action.is_checked() : false, is_default, shortcut_text, icon, exclusive); ConnectionToWindowServer::the().async_add_menu_item(m_menu_id, item_id, -1, action.text(), action.is_enabled(), action.is_checkable(), action.is_checkable() ? action.is_checked() : false, is_default, shortcut_text, icon, exclusive);
break; break;
} }
case MenuItem::Type::Submenu: { case MenuItem::Type::Submenu: {
auto& submenu = *item.submenu(); auto& submenu = *item.submenu();
submenu.realize_if_needed(m_current_default_action.strong_ref()); submenu.realize_if_needed(m_current_default_action.strong_ref());
auto icon = submenu.icon() ? submenu.icon()->to_shareable_bitmap() : Gfx::ShareableBitmap(); auto icon = submenu.icon() ? submenu.icon()->to_shareable_bitmap() : Gfx::ShareableBitmap();
WindowServerConnection::the().async_add_menu_item(m_menu_id, item_id, submenu.menu_id(), submenu.name(), true, false, false, false, "", icon, false); ConnectionToWindowServer::the().async_add_menu_item(m_menu_id, item_id, submenu.menu_id(), submenu.name(), true, false, false, false, "", icon, false);
break; break;
} }
case MenuItem::Type::Invalid: case MenuItem::Type::Invalid:

View file

@ -44,7 +44,7 @@ public:
void popup(const Gfx::IntPoint& screen_position, const RefPtr<Action>& default_action = nullptr); void popup(const Gfx::IntPoint& screen_position, const RefPtr<Action>& default_action = nullptr);
void dismiss(); void dismiss();
void visibility_did_change(Badge<WindowServerConnection>, bool visible); void visibility_did_change(Badge<ConnectionToWindowServer>, bool visible);
void set_children_actions_enabled(bool enabled); void set_children_actions_enabled(bool enabled);

View file

@ -5,9 +5,9 @@
*/ */
#include <LibGUI/Action.h> #include <LibGUI/Action.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Menu.h> #include <LibGUI/Menu.h>
#include <LibGUI/MenuItem.h> #include <LibGUI/MenuItem.h>
#include <LibGUI/WindowServerConnection.h>
namespace GUI { namespace GUI {
@ -74,7 +74,7 @@ void MenuItem::update_window_server()
return; return;
auto& action = *m_action; auto& action = *m_action;
auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_string() : String(); auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_string() : String();
WindowServerConnection::the().async_update_menu_item(m_menu_id, m_identifier, -1, action.text(), action.is_enabled(), action.is_checkable(), action.is_checkable() ? action.is_checked() : false, m_default, shortcut_text); ConnectionToWindowServer::the().async_update_menu_item(m_menu_id, m_identifier, -1, action.text(), action.is_enabled(), action.is_checkable(), action.is_checkable() ? action.is_checked() : false, m_default, shortcut_text);
} }
void MenuItem::set_menu_id(Badge<Menu>, unsigned int menu_id) void MenuItem::set_menu_id(Badge<Menu>, unsigned int menu_id)

View file

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/MouseTracker.h> #include <LibGUI/MouseTracker.h>
#include <LibGUI/WindowServerConnection.h>
namespace GUI { namespace GUI {
@ -14,7 +14,7 @@ MouseTracker::List MouseTracker::s_trackers;
MouseTracker::MouseTracker() MouseTracker::MouseTracker()
{ {
if (s_trackers.is_empty()) { if (s_trackers.is_empty()) {
WindowServerConnection::the().async_set_global_mouse_tracking(true); ConnectionToWindowServer::the().async_set_global_mouse_tracking(true);
} }
s_trackers.append(*this); s_trackers.append(*this);
} }
@ -22,11 +22,11 @@ MouseTracker::~MouseTracker()
{ {
m_list_node.remove(); m_list_node.remove();
if (s_trackers.is_empty()) { if (s_trackers.is_empty()) {
WindowServerConnection::the().async_set_global_mouse_tracking(false); ConnectionToWindowServer::the().async_set_global_mouse_tracking(false);
} }
} }
void MouseTracker::track_mouse_move(Badge<WindowServerConnection>, Gfx::IntPoint const& point) void MouseTracker::track_mouse_move(Badge<ConnectionToWindowServer>, Gfx::IntPoint const& point)
{ {
for (auto& tracker : s_trackers) { for (auto& tracker : s_trackers) {
tracker.track_mouse_move(point); tracker.track_mouse_move(point);

View file

@ -19,7 +19,7 @@ public:
MouseTracker(); MouseTracker();
virtual ~MouseTracker(); virtual ~MouseTracker();
static void track_mouse_move(Badge<WindowServerConnection>, Gfx::IntPoint const&); static void track_mouse_move(Badge<ConnectionToWindowServer>, Gfx::IntPoint const&);
protected: protected:
virtual void track_mouse_move(Gfx::IntPoint const&) = 0; virtual void track_mouse_move(Gfx::IntPoint const&) = 0;

View file

@ -13,6 +13,7 @@
#include <LibGUI/Action.h> #include <LibGUI/Action.h>
#include <LibGUI/Application.h> #include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h> #include <LibGUI/BoxLayout.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Event.h> #include <LibGUI/Event.h>
#include <LibGUI/GML/AST.h> #include <LibGUI/GML/AST.h>
#include <LibGUI/GML/Parser.h> #include <LibGUI/GML/Parser.h>
@ -21,7 +22,6 @@
#include <LibGUI/Painter.h> #include <LibGUI/Painter.h>
#include <LibGUI/Widget.h> #include <LibGUI/Widget.h>
#include <LibGUI/Window.h> #include <LibGUI/Window.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Bitmap.h> #include <LibGfx/Bitmap.h>
#include <LibGfx/Font.h> #include <LibGfx/Font.h>
#include <LibGfx/FontDatabase.h> #include <LibGfx/FontDatabase.h>

View file

@ -15,6 +15,7 @@
#include <LibGUI/Action.h> #include <LibGUI/Action.h>
#include <LibGUI/Application.h> #include <LibGUI/Application.h>
#include <LibGUI/ConnectionToWindowMangerServer.h> #include <LibGUI/ConnectionToWindowMangerServer.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Desktop.h> #include <LibGUI/Desktop.h>
#include <LibGUI/Event.h> #include <LibGUI/Event.h>
#include <LibGUI/MenuItem.h> #include <LibGUI/MenuItem.h>
@ -22,7 +23,6 @@
#include <LibGUI/Painter.h> #include <LibGUI/Painter.h>
#include <LibGUI/Widget.h> #include <LibGUI/Widget.h>
#include <LibGUI/Window.h> #include <LibGUI/Window.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Bitmap.h> #include <LibGfx/Bitmap.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
@ -110,7 +110,7 @@ void Window::move_to_front()
if (!is_visible()) if (!is_visible())
return; return;
WindowServerConnection::the().async_move_window_to_front(m_window_id); ConnectionToWindowServer::the().async_move_window_to_front(m_window_id);
} }
void Window::show() void Window::show()
@ -136,7 +136,7 @@ void Window::show()
unsetenv("__libgui_launch_origin_rect"); unsetenv("__libgui_launch_origin_rect");
} }
WindowServerConnection::the().async_create_window( ConnectionToWindowServer::the().async_create_window(
m_window_id, m_window_id,
m_rect_when_windowless, m_rect_when_windowless,
!m_moved_by_client, !m_moved_by_client,
@ -165,7 +165,7 @@ void Window::show()
m_menubar->for_each_menu([&](Menu& menu) { m_menubar->for_each_menu([&](Menu& menu) {
menu.realize_menu_if_needed(); 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 IterationDecision::Continue; return IterationDecision::Continue;
}); });
@ -205,7 +205,7 @@ void Window::hide()
if (GUI::Application::in_teardown()) if (GUI::Application::in_teardown())
return; return;
auto destroyed_window_ids = WindowServerConnection::the().destroy_window(m_window_id); auto destroyed_window_ids = ConnectionToWindowServer::the().destroy_window(m_window_id);
server_did_destroy(); server_did_destroy();
for (auto child_window_id : destroyed_window_ids) { for (auto child_window_id : destroyed_window_ids) {
@ -232,27 +232,27 @@ void Window::set_title(String title)
m_title_when_windowless = move(title); m_title_when_windowless = move(title);
if (!is_visible()) if (!is_visible())
return; return;
WindowServerConnection::the().async_set_window_title(m_window_id, m_title_when_windowless); ConnectionToWindowServer::the().async_set_window_title(m_window_id, m_title_when_windowless);
} }
String Window::title() const String Window::title() const
{ {
if (!is_visible()) if (!is_visible())
return m_title_when_windowless; return m_title_when_windowless;
return WindowServerConnection::the().get_window_title(m_window_id); return ConnectionToWindowServer::the().get_window_title(m_window_id);
} }
Gfx::IntRect Window::applet_rect_on_screen() const Gfx::IntRect Window::applet_rect_on_screen() const
{ {
VERIFY(m_window_type == WindowType::Applet); VERIFY(m_window_type == WindowType::Applet);
return WindowServerConnection::the().get_applet_rect_on_screen(m_window_id); return ConnectionToWindowServer::the().get_applet_rect_on_screen(m_window_id);
} }
Gfx::IntRect Window::rect() const Gfx::IntRect Window::rect() const
{ {
if (!is_visible()) if (!is_visible())
return m_rect_when_windowless; return m_rect_when_windowless;
return WindowServerConnection::the().get_window_rect(m_window_id); return ConnectionToWindowServer::the().get_window_rect(m_window_id);
} }
void Window::set_rect(const Gfx::IntRect& a_rect) void Window::set_rect(const Gfx::IntRect& a_rect)
@ -267,7 +267,7 @@ void Window::set_rect(const Gfx::IntRect& a_rect)
m_main_widget->resize(m_rect_when_windowless.size()); m_main_widget->resize(m_rect_when_windowless.size());
return; return;
} }
auto window_rect = WindowServerConnection::the().set_window_rect(m_window_id, a_rect); auto window_rect = ConnectionToWindowServer::the().set_window_rect(m_window_id, a_rect);
if (m_back_store && m_back_store->size() != window_rect.size()) if (m_back_store && m_back_store->size() != window_rect.size())
m_back_store = nullptr; m_back_store = nullptr;
if (m_front_store && m_front_store->size() != window_rect.size()) if (m_front_store && m_front_store->size() != window_rect.size())
@ -281,7 +281,7 @@ Gfx::IntSize Window::minimum_size() const
if (!is_visible()) if (!is_visible())
return m_minimum_size_when_windowless; return m_minimum_size_when_windowless;
return WindowServerConnection::the().get_window_minimum_size(m_window_id); return ConnectionToWindowServer::the().get_window_minimum_size(m_window_id);
} }
void Window::set_minimum_size(const Gfx::IntSize& size) void Window::set_minimum_size(const Gfx::IntSize& size)
@ -290,7 +290,7 @@ void Window::set_minimum_size(const Gfx::IntSize& size)
m_minimum_size_when_windowless = size; m_minimum_size_when_windowless = size;
if (is_visible()) if (is_visible())
WindowServerConnection::the().async_set_window_minimum_size(m_window_id, size); ConnectionToWindowServer::the().async_set_window_minimum_size(m_window_id, size);
} }
void Window::center_on_screen() void Window::center_on_screen()
@ -444,7 +444,7 @@ void Window::handle_multi_paint_event(MultiPaintEvent& event)
set_current_backing_store(*m_back_store, true); set_current_backing_store(*m_back_store, true);
if (is_visible()) if (is_visible())
WindowServerConnection::the().async_did_finish_painting(m_window_id, rects); ConnectionToWindowServer::the().async_did_finish_painting(m_window_id, rects);
} }
void Window::handle_key_event(KeyEvent& event) void Window::handle_key_event(KeyEvent& event)
@ -685,7 +685,7 @@ void Window::force_update()
if (!is_visible()) if (!is_visible())
return; return;
auto rect = this->rect(); auto rect = this->rect();
WindowServerConnection::the().async_invalidate_rect(m_window_id, { { 0, 0, rect.width(), rect.height() } }, true); ConnectionToWindowServer::the().async_invalidate_rect(m_window_id, { { 0, 0, rect.width(), rect.height() } }, true);
} }
void Window::update(const Gfx::IntRect& a_rect) void Window::update(const Gfx::IntRect& a_rect)
@ -705,7 +705,7 @@ void Window::update(const Gfx::IntRect& a_rect)
auto rects = move(m_pending_paint_event_rects); auto rects = move(m_pending_paint_event_rects);
if (rects.is_empty()) if (rects.is_empty())
return; return;
WindowServerConnection::the().async_invalidate_rect(m_window_id, rects, false); ConnectionToWindowServer::the().async_invalidate_rect(m_window_id, rects, false);
}); });
} }
m_pending_paint_event_rects.append(a_rect); m_pending_paint_event_rects.append(a_rect);
@ -791,7 +791,7 @@ void Window::set_has_alpha_channel(bool value)
m_back_store = nullptr; m_back_store = nullptr;
m_front_store = nullptr; m_front_store = nullptr;
WindowServerConnection::the().async_set_window_has_alpha_channel(m_window_id, value); ConnectionToWindowServer::the().async_set_window_has_alpha_channel(m_window_id, value);
update(); update();
} }
@ -806,7 +806,7 @@ void Window::set_opacity(float opacity)
m_opacity_when_windowless = opacity; m_opacity_when_windowless = opacity;
if (!is_visible()) if (!is_visible())
return; return;
WindowServerConnection::the().async_set_window_opacity(m_window_id, opacity); ConnectionToWindowServer::the().async_set_window_opacity(m_window_id, opacity);
} }
void Window::set_alpha_hit_threshold(float threshold) void Window::set_alpha_hit_threshold(float threshold)
@ -820,7 +820,7 @@ void Window::set_alpha_hit_threshold(float threshold)
m_alpha_hit_threshold = threshold; m_alpha_hit_threshold = threshold;
if (!is_visible()) if (!is_visible())
return; return;
WindowServerConnection::the().async_set_window_alpha_hit_threshold(m_window_id, threshold); ConnectionToWindowServer::the().async_set_window_alpha_hit_threshold(m_window_id, threshold);
} }
void Window::set_hovered_widget(Widget* widget) void Window::set_hovered_widget(Widget* widget)
@ -844,7 +844,7 @@ void Window::set_hovered_widget(Widget* widget)
void Window::set_current_backing_store(WindowBackingStore& backing_store, bool flush_immediately) void Window::set_current_backing_store(WindowBackingStore& backing_store, bool flush_immediately)
{ {
auto& bitmap = backing_store.bitmap(); auto& bitmap = backing_store.bitmap();
WindowServerConnection::the().set_window_backing_store(m_window_id, 32, bitmap.pitch(), bitmap.anonymous_buffer().fd(), backing_store.serial(), bitmap.has_alpha_channel(), bitmap.size(), flush_immediately); ConnectionToWindowServer::the().set_window_backing_store(m_window_id, 32, bitmap.pitch(), bitmap.anonymous_buffer().fd(), backing_store.serial(), bitmap.has_alpha_channel(), bitmap.size(), flush_immediately);
} }
void Window::flip(const Vector<Gfx::IntRect, 32>& dirty_rects) void Window::flip(const Vector<Gfx::IntRect, 32>& dirty_rects)
@ -935,12 +935,12 @@ void Window::apply_icon()
if (!is_visible()) if (!is_visible())
return; return;
WindowServerConnection::the().async_set_window_icon_bitmap(m_window_id, m_icon->to_shareable_bitmap()); ConnectionToWindowServer::the().async_set_window_icon_bitmap(m_window_id, m_icon->to_shareable_bitmap());
} }
void Window::start_interactive_resize() void Window::start_interactive_resize()
{ {
WindowServerConnection::the().async_start_window_resize(m_window_id); ConnectionToWindowServer::the().async_start_window_resize(m_window_id);
} }
Vector<Widget&> Window::focusable_widgets(FocusSource source) const Vector<Widget&> Window::focusable_widgets(FocusSource source) const
@ -993,7 +993,7 @@ void Window::set_fullscreen(bool fullscreen)
m_fullscreen = fullscreen; m_fullscreen = fullscreen;
if (!is_visible()) if (!is_visible())
return; return;
WindowServerConnection::the().async_set_fullscreen(m_window_id, fullscreen); ConnectionToWindowServer::the().async_set_fullscreen(m_window_id, fullscreen);
} }
void Window::set_frameless(bool frameless) void Window::set_frameless(bool frameless)
@ -1003,7 +1003,7 @@ void Window::set_frameless(bool frameless)
m_frameless = frameless; m_frameless = frameless;
if (!is_visible()) if (!is_visible())
return; return;
WindowServerConnection::the().async_set_frameless(m_window_id, frameless); ConnectionToWindowServer::the().async_set_frameless(m_window_id, frameless);
if (!frameless) if (!frameless)
apply_icon(); apply_icon();
@ -1016,7 +1016,7 @@ void Window::set_forced_shadow(bool shadow)
m_forced_shadow = shadow; m_forced_shadow = shadow;
if (!is_visible()) if (!is_visible())
return; return;
WindowServerConnection::the().async_set_forced_shadow(m_window_id, shadow); ConnectionToWindowServer::the().async_set_forced_shadow(m_window_id, shadow);
} }
bool Window::is_maximized() const bool Window::is_maximized() const
@ -1024,7 +1024,7 @@ bool Window::is_maximized() const
if (!is_visible()) if (!is_visible())
return m_maximized_when_windowless; return m_maximized_when_windowless;
return WindowServerConnection::the().is_maximized(m_window_id); return ConnectionToWindowServer::the().is_maximized(m_window_id);
} }
void Window::set_maximized(bool maximized) void Window::set_maximized(bool maximized)
@ -1033,7 +1033,7 @@ void Window::set_maximized(bool maximized)
if (!is_visible()) if (!is_visible())
return; return;
WindowServerConnection::the().async_set_maximized(m_window_id, maximized); ConnectionToWindowServer::the().async_set_maximized(m_window_id, maximized);
} }
void Window::schedule_relayout() void Window::schedule_relayout()
@ -1051,10 +1051,10 @@ void Window::schedule_relayout()
void Window::refresh_system_theme() void Window::refresh_system_theme()
{ {
WindowServerConnection::the().async_refresh_system_theme(); ConnectionToWindowServer::the().async_refresh_system_theme();
} }
void Window::for_each_window(Badge<WindowServerConnection>, Function<void(Window&)> callback) void Window::for_each_window(Badge<ConnectionToWindowServer>, Function<void(Window&)> callback)
{ {
for (auto& e : *reified_windows) { for (auto& e : *reified_windows) {
VERIFY(e.value); VERIFY(e.value);
@ -1062,14 +1062,14 @@ void Window::for_each_window(Badge<WindowServerConnection>, Function<void(Window
} }
} }
void Window::update_all_windows(Badge<WindowServerConnection>) void Window::update_all_windows(Badge<ConnectionToWindowServer>)
{ {
for (auto& e : *reified_windows) { for (auto& e : *reified_windows) {
e.value->force_update(); e.value->force_update();
} }
} }
void Window::notify_state_changed(Badge<WindowServerConnection>, bool minimized, bool occluded) void Window::notify_state_changed(Badge<ConnectionToWindowServer>, bool minimized, bool occluded)
{ {
m_visible_for_timer_purposes = !minimized && !occluded; m_visible_for_timer_purposes = !minimized && !occluded;
@ -1116,7 +1116,7 @@ void Window::set_base_size(const Gfx::IntSize& base_size)
return; return;
m_base_size = base_size; m_base_size = base_size;
if (is_visible()) if (is_visible())
WindowServerConnection::the().async_set_window_base_size_and_size_increment(m_window_id, m_base_size, m_size_increment); ConnectionToWindowServer::the().async_set_window_base_size_and_size_increment(m_window_id, m_base_size, m_size_increment);
} }
void Window::set_size_increment(const Gfx::IntSize& size_increment) void Window::set_size_increment(const Gfx::IntSize& size_increment)
@ -1125,7 +1125,7 @@ void Window::set_size_increment(const Gfx::IntSize& size_increment)
return; return;
m_size_increment = size_increment; m_size_increment = size_increment;
if (is_visible()) if (is_visible())
WindowServerConnection::the().async_set_window_base_size_and_size_increment(m_window_id, m_base_size, m_size_increment); ConnectionToWindowServer::the().async_set_window_base_size_and_size_increment(m_window_id, m_base_size, m_size_increment);
} }
void Window::set_resize_aspect_ratio(const Optional<Gfx::IntSize>& ratio) void Window::set_resize_aspect_ratio(const Optional<Gfx::IntSize>& ratio)
@ -1135,7 +1135,7 @@ void Window::set_resize_aspect_ratio(const Optional<Gfx::IntSize>& ratio)
m_resize_aspect_ratio = ratio; m_resize_aspect_ratio = ratio;
if (is_visible()) if (is_visible())
WindowServerConnection::the().async_set_window_resize_aspect_ratio(m_window_id, m_resize_aspect_ratio); ConnectionToWindowServer::the().async_set_window_resize_aspect_ratio(m_window_id, m_resize_aspect_ratio);
} }
void Window::did_add_widget(Badge<Widget>, Widget&) void Window::did_add_widget(Badge<Widget>, Widget&)
@ -1157,7 +1157,7 @@ void Window::did_remove_widget(Badge<Widget>, Widget& widget)
void Window::set_progress(Optional<int> progress) void Window::set_progress(Optional<int> progress)
{ {
VERIFY(m_window_id); VERIFY(m_window_id);
WindowServerConnection::the().async_set_window_progress(m_window_id, progress); ConnectionToWindowServer::the().async_set_window_progress(m_window_id, progress);
} }
void Window::update_cursor() void Window::update_cursor()
@ -1175,9 +1175,9 @@ void Window::update_cursor()
m_effective_cursor = new_cursor; m_effective_cursor = new_cursor;
if (new_cursor.has<NonnullRefPtr<Gfx::Bitmap>>()) if (new_cursor.has<NonnullRefPtr<Gfx::Bitmap>>())
WindowServerConnection::the().async_set_window_custom_cursor(m_window_id, new_cursor.get<NonnullRefPtr<Gfx::Bitmap>>()->to_shareable_bitmap()); ConnectionToWindowServer::the().async_set_window_custom_cursor(m_window_id, new_cursor.get<NonnullRefPtr<Gfx::Bitmap>>()->to_shareable_bitmap());
else else
WindowServerConnection::the().async_set_window_cursor(m_window_id, (u32)new_cursor.get<Gfx::StandardCursor>()); ConnectionToWindowServer::the().async_set_window_cursor(m_window_id, (u32)new_cursor.get<Gfx::StandardCursor>());
} }
void Window::focus_a_widget_if_possible(FocusSource source) void Window::focus_a_widget_if_possible(FocusSource source)
@ -1208,7 +1208,7 @@ ErrorOr<NonnullRefPtr<Menu>> Window::try_add_menu(String name)
auto menu = TRY(m_menubar->try_add_menu({}, move(name))); auto menu = TRY(m_menubar->try_add_menu({}, move(name)));
if (m_window_id) { if (m_window_id) {
menu->realize_menu_if_needed(); 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; return menu;
} }
@ -1225,21 +1225,21 @@ void Window::flash_menubar_menu_for(const MenuItem& menu_item)
if (menu_id < 0) if (menu_id < 0)
return; return;
WindowServerConnection::the().async_flash_menubar_menu(m_window_id, menu_id); ConnectionToWindowServer::the().async_flash_menubar_menu(m_window_id, menu_id);
} }
bool Window::is_modified() const bool Window::is_modified() const
{ {
if (!m_window_id) if (!m_window_id)
return false; return false;
return WindowServerConnection::the().is_window_modified(m_window_id); return ConnectionToWindowServer::the().is_window_modified(m_window_id);
} }
void Window::set_modified(bool modified) void Window::set_modified(bool modified)
{ {
if (!m_window_id) if (!m_window_id)
return; return;
WindowServerConnection::the().async_set_window_modified(m_window_id, modified); ConnectionToWindowServer::the().async_set_window_modified(m_window_id, modified);
} }
void Window::flush_pending_paints_immediately() void Window::flush_pending_paints_immediately()

View file

@ -190,9 +190,9 @@ public:
void refresh_system_theme(); void refresh_system_theme();
static void for_each_window(Badge<WindowServerConnection>, Function<void(Window&)>); static void for_each_window(Badge<ConnectionToWindowServer>, Function<void(Window&)>);
static void update_all_windows(Badge<WindowServerConnection>); static void update_all_windows(Badge<ConnectionToWindowServer>);
void notify_state_changed(Badge<WindowServerConnection>, bool minimized, bool occluded); void notify_state_changed(Badge<ConnectionToWindowServer>, bool minimized, bool occluded);
virtual bool is_visible_for_timer_purposes() const override { return m_visible_for_timer_purposes; } virtual bool is_visible_for_timer_purposes() const override { return m_visible_for_timer_purposes; }

View file

@ -6,7 +6,7 @@
// FIXME: LibIPC Decoder and Encoder are sensitive to include order here // FIXME: LibIPC Decoder and Encoder are sensitive to include order here
// clang-format off // clang-format off
#include <LibGUI/WindowServerConnection.h> #include <LibGUI/ConnectionToWindowServer.h>
// clang-format on // clang-format on
#include <AK/Debug.h> #include <AK/Debug.h>
#include <FileSystemAccessServer/ConnectionFromClient.h> #include <FileSystemAccessServer/ConnectionFromClient.h>
@ -41,10 +41,10 @@ RefPtr<GUI::Window> ConnectionFromClient::create_dummy_child_window(i32 window_s
auto window = GUI::Window::construct(); auto window = GUI::Window::construct();
window->set_opacity(0); window->set_opacity(0);
window->set_frameless(true); window->set_frameless(true);
auto rect = GUI::WindowServerConnection::the().get_window_rect_from_client(window_server_client_id, parent_window_id); auto rect = GUI::ConnectionToWindowServer::the().get_window_rect_from_client(window_server_client_id, parent_window_id);
window->set_rect(rect); window->set_rect(rect);
window->show(); window->show();
GUI::WindowServerConnection::the().async_set_window_parent_from_client(window_server_client_id, parent_window_id, window->window_id()); GUI::ConnectionToWindowServer::the().async_set_window_parent_from_client(window_server_client_id, parent_window_id, window->window_id());
return window; return window;
} }
@ -171,7 +171,7 @@ void ConnectionFromClient::prompt_helper(Optional<String> const& user_picked_fil
Messages::FileSystemAccessServer::ExposeWindowServerClientIdResponse ConnectionFromClient::expose_window_server_client_id() Messages::FileSystemAccessServer::ExposeWindowServerClientIdResponse ConnectionFromClient::expose_window_server_client_id()
{ {
return GUI::WindowServerConnection::the().expose_client_id(); return GUI::ConnectionToWindowServer::the().expose_client_id();
} }
} }

View file

@ -8,8 +8,8 @@
#include "WindowList.h" #include "WindowList.h"
#include <LibGUI/Action.h> #include <LibGUI/Action.h>
#include <LibGUI/ConnectionToWindowMangerServer.h> #include <LibGUI/ConnectionToWindowMangerServer.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Painter.h> #include <LibGUI/Painter.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Font.h> #include <LibGfx/Font.h>
#include <LibGfx/Palette.h> #include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h> #include <LibGfx/StylePainter.h>

View file

@ -14,13 +14,13 @@
#include <LibGUI/BoxLayout.h> #include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h> #include <LibGUI/Button.h>
#include <LibGUI/ConnectionToWindowMangerServer.h> #include <LibGUI/ConnectionToWindowMangerServer.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Desktop.h> #include <LibGUI/Desktop.h>
#include <LibGUI/Frame.h> #include <LibGUI/Frame.h>
#include <LibGUI/Icon.h> #include <LibGUI/Icon.h>
#include <LibGUI/Menu.h> #include <LibGUI/Menu.h>
#include <LibGUI/Painter.h> #include <LibGUI/Painter.h>
#include <LibGUI/Window.h> #include <LibGUI/Window.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/FontDatabase.h> #include <LibGfx/FontDatabase.h>
#include <LibGfx/Palette.h> #include <LibGfx/Palette.h>
#include <serenity.h> #include <serenity.h>
@ -210,7 +210,7 @@ void TaskbarWindow::event(Core::Event& event)
Gfx::IntPoint adjusted_point = { adjusted_x, adjusted_y }; Gfx::IntPoint adjusted_point = { adjusted_x, adjusted_y };
if (adjusted_point != mouse_event.position()) { if (adjusted_point != mouse_event.position()) {
GUI::WindowServerConnection::the().async_set_global_cursor_position(position() + adjusted_point); GUI::ConnectionToWindowServer::the().async_set_global_cursor_position(position() + adjusted_point);
GUI::MouseEvent adjusted_event = { (GUI::Event::Type)mouse_event.type(), adjusted_point, mouse_event.buttons(), mouse_event.button(), mouse_event.modifiers(), mouse_event.wheel_delta_x(), mouse_event.wheel_delta_y() }; GUI::MouseEvent adjusted_event = { (GUI::Event::Type)mouse_event.type(), adjusted_point, mouse_event.buttons(), mouse_event.button(), mouse_event.modifiers(), mouse_event.wheel_delta_x(), mouse_event.wheel_delta_y() };
Window::event(adjusted_event); Window::event(adjusted_event);
return; return;

View file

@ -21,8 +21,8 @@
#include <LibGUI/ActionGroup.h> #include <LibGUI/ActionGroup.h>
#include <LibGUI/Application.h> #include <LibGUI/Application.h>
#include <LibGUI/ConnectionToWindowMangerServer.h> #include <LibGUI/ConnectionToWindowMangerServer.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Menu.h> #include <LibGUI/Menu.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibMain/Main.h> #include <LibMain/Main.h>
#include <WindowServer/Window.h> #include <WindowServer/Window.h>
#include <serenity.h> #include <serenity.h>
@ -224,7 +224,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu()
quick_sort(g_themes, [](auto& a, auto& b) { return a.name < b.name; }); quick_sort(g_themes, [](auto& a, auto& b) { return a.name < b.name; });
} }
auto current_theme_name = GUI::WindowServerConnection::the().get_system_theme(); auto current_theme_name = GUI::ConnectionToWindowServer::the().get_system_theme();
{ {
int theme_identifier = 0; int theme_identifier = 0;
@ -232,7 +232,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu()
auto action = GUI::Action::create_checkable(theme.name, [theme_identifier](auto&) { auto action = GUI::Action::create_checkable(theme.name, [theme_identifier](auto&) {
auto& theme = g_themes[theme_identifier]; auto& theme = g_themes[theme_identifier];
dbgln("Theme switched to {} at path {}", theme.name, theme.path); dbgln("Theme switched to {} at path {}", theme.name, theme.path);
auto success = GUI::WindowServerConnection::the().set_system_theme(theme.path, theme.name); auto success = GUI::ConnectionToWindowServer::the().set_system_theme(theme.path, theme.name);
VERIFY(success); VERIFY(success);
}); });
if (theme.name == current_theme_name) if (theme.name == current_theme_name)

View file

@ -548,7 +548,7 @@ void WindowManager::tell_wms_super_space_key_pressed()
void WindowManager::tell_wms_super_digit_key_pressed(u8 digit) void WindowManager::tell_wms_super_digit_key_pressed(u8 digit)
{ {
for_each_window_manager([digit](WMClientConnection& conn) { for_each_window_manager([digit](WMConnectionFromClient& conn) {
if (conn.window_id() < 0) if (conn.window_id() < 0)
return IterationDecision::Continue; return IterationDecision::Continue;

View file

@ -6,7 +6,7 @@
#include <LibCore/ArgsParser.h> #include <LibCore/ArgsParser.h>
#include <LibGUI/Application.h> #include <LibGUI/Application.h>
#include <LibGUI/WindowServerConnection.h> #include <LibGUI/ConnectionToWindowServer.h>
#include <LibMain/Main.h> #include <LibMain/Main.h>
ErrorOr<int> serenity_main(Main::Arguments arguments) ErrorOr<int> serenity_main(Main::Arguments arguments)
@ -24,10 +24,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.add_positional_argument(scale, "Scale Factor", "scale", Core::ArgsParser::Required::No); args_parser.add_positional_argument(scale, "Scale Factor", "scale", Core::ArgsParser::Required::No);
args_parser.parse(arguments); args_parser.parse(arguments);
// A Core::EventLoop is all we need, but WindowServerConnection needs a full Application object. // A Core::EventLoop is all we need, but ConnectionToWindowServer needs a full Application object.
char* dummy_argv[] = { arguments.argv[0] }; char* dummy_argv[] = { arguments.argv[0] };
auto app = GUI::Application::construct(1, dummy_argv); auto app = GUI::Application::construct(1, dummy_argv);
auto screen_layout = GUI::WindowServerConnection::the().get_screen_layout(); auto screen_layout = GUI::ConnectionToWindowServer::the().get_screen_layout();
if (screen < 0 || (size_t)screen >= screen_layout.screens.size()) { if (screen < 0 || (size_t)screen >= screen_layout.screens.size()) {
warnln("invalid screen index: {}", screen); warnln("invalid screen index: {}", screen);
return 1; return 1;
@ -36,7 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
main_screen.resolution = { width, height }; main_screen.resolution = { width, height };
if (scale != -1) if (scale != -1)
main_screen.scale_factor = scale; main_screen.scale_factor = scale;
auto set_result = GUI::WindowServerConnection::the().set_screen_layout(screen_layout, true); auto set_result = GUI::ConnectionToWindowServer::the().set_screen_layout(screen_layout, true);
if (!set_result.success()) { if (!set_result.success()) {
warnln("failed to set resolution: {}", set_result.error_msg()); warnln("failed to set resolution: {}", set_result.error_msg());
return 1; return 1;

View file

@ -14,10 +14,10 @@
#include <LibCore/File.h> #include <LibCore/File.h>
#include <LibGUI/Application.h> #include <LibGUI/Application.h>
#include <LibGUI/Clipboard.h> #include <LibGUI/Clipboard.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Painter.h> #include <LibGUI/Painter.h>
#include <LibGUI/Widget.h> #include <LibGUI/Widget.h>
#include <LibGUI/Window.h> #include <LibGUI/Window.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/PNGWriter.h> #include <LibGfx/PNGWriter.h>
#include <LibGfx/Palette.h> #include <LibGfx/Palette.h>
#include <LibMain/Main.h> #include <LibMain/Main.h>
@ -133,7 +133,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (screen >= 0) if (screen >= 0)
screen_index = (u32)screen; screen_index = (u32)screen;
dbgln("getting screenshot..."); dbgln("getting screenshot...");
auto shared_bitmap = GUI::WindowServerConnection::the().get_screen_bitmap(crop_region, screen_index); auto shared_bitmap = GUI::ConnectionToWindowServer::the().get_screen_bitmap(crop_region, screen_index);
dbgln("got screenshot"); dbgln("got screenshot");
RefPtr<Gfx::Bitmap> bitmap = shared_bitmap.bitmap(); RefPtr<Gfx::Bitmap> bitmap = shared_bitmap.bitmap();

View file

@ -6,7 +6,7 @@
#include <LibCore/ArgsParser.h> #include <LibCore/ArgsParser.h>
#include <LibGUI/Application.h> #include <LibGUI/Application.h>
#include <LibGUI/WindowServerConnection.h> #include <LibGUI/ConnectionToWindowServer.h>
ErrorOr<int> serenity_main(Main::Arguments arguments) ErrorOr<int> serenity_main(Main::Arguments arguments)
{ {
@ -18,6 +18,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.parse(arguments); args_parser.parse(arguments);
if (flash_flush != -1) if (flash_flush != -1)
GUI::WindowServerConnection::the().async_set_flash_flush(flash_flush); GUI::ConnectionToWindowServer::the().async_set_flash_flush(flash_flush);
return 0; return 0;
} }