diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-05-03 13:33:59 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-03 21:14:40 +0200 |
commit | 5bb79ea0a79322d944368825ec617ccfb8912b81 (patch) | |
tree | 120c86845f8285f398000386722d0a7cda312440 /Userland | |
parent | 78803ce384d62c40958cc8191a036307f5d8bc9f (diff) | |
download | serenity-5bb79ea0a79322d944368825ec617ccfb8912b81.zip |
Userland: Update IPC calls to use proxies
This updates all existing code to use the auto-generated client
methods instead of post_message/send_sync.
Diffstat (limited to 'Userland')
63 files changed, 303 insertions, 316 deletions
diff --git a/Userland/Applications/DisplaySettings/DisplaySettings.cpp b/Userland/Applications/DisplaySettings/DisplaySettings.cpp index 7c80bac763..42443fc0d4 100644 --- a/Userland/Applications/DisplaySettings/DisplaySettings.cpp +++ b/Userland/Applications/DisplaySettings/DisplaySettings.cpp @@ -264,9 +264,9 @@ void DisplaySettingsWidget::send_settings_to_window_server() } if (current_resolution != m_monitor_widget->desktop_resolution() || current_scale_factor != m_monitor_widget->desktop_scale_factor()) { - auto result = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetResolution>(m_monitor_widget->desktop_resolution(), m_monitor_widget->desktop_scale_factor()); - if (!result->success()) { - GUI::MessageBox::show(nullptr, String::formatted("Reverting to resolution {}x{} @ {}x", result->resolution().width(), result->resolution().height(), result->scale_factor()), + auto result = GUI::WindowServerConnection::the().set_resolution(m_monitor_widget->desktop_resolution(), m_monitor_widget->desktop_scale_factor()); + if (!result.success()) { + GUI::MessageBox::show(nullptr, String::formatted("Reverting to resolution {}x{} @ {}x", result.resolution().width(), result.resolution().height(), result.scale_factor()), "Unable to set resolution", GUI::MessageBox::Type::Error); } else { auto box = GUI::MessageBox::construct(window(), String::formatted("Do you want to keep the new settings? They will be reverted after 10 seconds."), @@ -282,9 +282,9 @@ void DisplaySettingsWidget::send_settings_to_window_server() // If the user selects "No", closes the window or the window gets closed by the 10 seconds timer, revert the changes. if (box->exec() != GUI::MessageBox::ExecYes) { - result = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetResolution>(current_resolution, current_scale_factor); - if (!result->success()) { - GUI::MessageBox::show(nullptr, String::formatted("Reverting to resolution {}x{} @ {}x", result->resolution().width(), result->resolution().height(), result->scale_factor()), + result = GUI::WindowServerConnection::the().set_resolution(current_resolution, current_scale_factor); + if (!result.success()) { + GUI::MessageBox::show(nullptr, String::formatted("Reverting to resolution {}x{} @ {}x", result.resolution().width(), result.resolution().height(), result.scale_factor()), "Unable to set resolution", GUI::MessageBox::Type::Error); } } diff --git a/Userland/Applications/MouseSettings/MouseSettingsWindow.cpp b/Userland/Applications/MouseSettings/MouseSettingsWindow.cpp index ffe93f0646..7910b6f80c 100644 --- a/Userland/Applications/MouseSettings/MouseSettingsWindow.cpp +++ b/Userland/Applications/MouseSettings/MouseSettingsWindow.cpp @@ -24,9 +24,9 @@ constexpr int double_click_speed_default = 250; void MouseSettingsWindow::update_window_server() { const float factor = m_speed_slider->value() / speed_slider_scale; - GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetMouseAcceleration>(factor); - GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetScrollStepSize>(m_scroll_length_spinbox->value()); - GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetDoubleClickSpeed>(m_double_click_speed_slider->value()); + GUI::WindowServerConnection::the().set_mouse_acceleration(factor); + GUI::WindowServerConnection::the().set_scroll_step_size(m_scroll_length_spinbox->value()); + GUI::WindowServerConnection::the().set_double_click_speed(m_double_click_speed_slider->value()); } void MouseSettingsWindow::reset_default_values() @@ -48,12 +48,12 @@ MouseSettingsWindow::MouseSettingsWindow() m_speed_slider->on_change = [&](const int value) { m_speed_label->set_text(String::formatted("{} %", value)); }; - const int slider_value = float { speed_slider_scale } * GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::GetMouseAcceleration>()->factor(); + const int slider_value = float { speed_slider_scale } * GUI::WindowServerConnection::the().get_mouse_acceleration().factor(); m_speed_slider->set_value(slider_value); m_scroll_length_spinbox = *main_widget.find_descendant_of_type_named<GUI::SpinBox>("scroll_length_spinbox"); m_scroll_length_spinbox->set_min(WindowServer::scroll_step_size_min); - m_scroll_length_spinbox->set_value(GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::GetScrollStepSize>()->step_size()); + m_scroll_length_spinbox->set_value(GUI::WindowServerConnection::the().get_scroll_step_size().step_size()); m_double_click_speed_label = *main_widget.find_descendant_of_type_named<GUI::Label>("double_click_speed_label"); m_double_click_speed_slider = *main_widget.find_descendant_of_type_named<GUI::HorizontalSlider>("double_click_speed_slider"); @@ -62,7 +62,7 @@ MouseSettingsWindow::MouseSettingsWindow() m_double_click_speed_slider->on_change = [&](const int value) { m_double_click_speed_label->set_text(String::formatted("{} ms", value)); }; - m_double_click_speed_slider->set_value(GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::GetDoubleClickSpeed>()->speed()); + m_double_click_speed_slider->set_value(GUI::WindowServerConnection::the().get_double_click_speed().speed()); m_ok_button = *main_widget.find_descendant_of_type_named<GUI::Button>("ok_button"); m_ok_button->on_click = [this](auto) { diff --git a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp index 205fecc1c1..f9cb3bea81 100644 --- a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp +++ b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp @@ -316,7 +316,7 @@ void TreeMapWidget::mousewheel_event(GUI::MouseEvent& event) { int delta = event.wheel_delta(); // FIXME: The wheel_delta is premultiplied in the window server, we actually want a raw value here. - int step_size = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::GetScrollStepSize>()->step_size(); + int step_size = GUI::WindowServerConnection::the().get_scroll_step_size().step_size(); if (delta > 0) { size_t step_back = delta / step_size; if (step_back > m_viewpoint) diff --git a/Userland/Demos/CatDog/main.cpp b/Userland/Demos/CatDog/main.cpp index bcaef8ff39..70c0dd5d4f 100644 --- a/Userland/Demos/CatDog/main.cpp +++ b/Userland/Demos/CatDog/main.cpp @@ -134,7 +134,7 @@ public: VERIFY(window_id >= 0); set_global_cursor_tracking(true); - GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetGlobalCursorTracking>(window_id, true); + GUI::WindowServerConnection::the().set_global_cursor_tracking(window_id, true); } void start_the_timer() { m_timer.start(); } diff --git a/Userland/Demos/Eyes/EyesWidget.cpp b/Userland/Demos/Eyes/EyesWidget.cpp index e1837d29da..f1565771ff 100644 --- a/Userland/Demos/Eyes/EyesWidget.cpp +++ b/Userland/Demos/Eyes/EyesWidget.cpp @@ -22,7 +22,7 @@ void EyesWidget::track_cursor_globally() VERIFY(window_id >= 0); set_global_cursor_tracking(true); - GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetGlobalCursorTracking>(window_id, true); + GUI::WindowServerConnection::the().set_global_cursor_tracking(window_id, true); } void EyesWidget::mousemove_event(GUI::MouseEvent& event) diff --git a/Userland/DevTools/HackStudio/LanguageClient.cpp b/Userland/DevTools/HackStudio/LanguageClient.cpp index 7df58af470..475c169977 100644 --- a/Userland/DevTools/HackStudio/LanguageClient.cpp +++ b/Userland/DevTools/HackStudio/LanguageClient.cpp @@ -43,14 +43,14 @@ void LanguageClient::open_file(const String& path, int fd) { if (!m_connection_wrapper.connection()) return; - m_connection_wrapper.connection()->post_message(Messages::LanguageServer::FileOpened(path, fd)); + m_connection_wrapper.connection()->async_file_opened(path, fd); } void LanguageClient::set_file_content(const String& path, const String& content) { if (!m_connection_wrapper.connection()) return; - m_connection_wrapper.connection()->post_message(Messages::LanguageServer::SetFileContent(path, content)); + m_connection_wrapper.connection()->async_set_file_content(path, content); } void LanguageClient::insert_text(const String& path, const String& text, size_t line, size_t column) @@ -58,14 +58,14 @@ void LanguageClient::insert_text(const String& path, const String& text, size_t if (!m_connection_wrapper.connection()) return; // set_active_client(); - m_connection_wrapper.connection()->post_message(Messages::LanguageServer::FileEditInsertText(path, text, line, column)); + m_connection_wrapper.connection()->async_file_edit_insert_text(path, text, line, column); } void LanguageClient::remove_text(const String& path, size_t from_line, size_t from_column, size_t to_line, size_t to_column) { if (!m_connection_wrapper.connection()) return; - m_connection_wrapper.connection()->post_message(Messages::LanguageServer::FileEditRemoveText(path, from_line, from_column, to_line, to_column)); + m_connection_wrapper.connection()->async_file_edit_remove_text(path, from_line, from_column, to_line, to_column); } void LanguageClient::request_autocomplete(const String& path, size_t cursor_line, size_t cursor_column) @@ -73,7 +73,7 @@ void LanguageClient::request_autocomplete(const String& path, size_t cursor_line if (!m_connection_wrapper.connection()) return; set_active_client(); - m_connection_wrapper.connection()->post_message(Messages::LanguageServer::AutoCompleteSuggestions(GUI::AutocompleteProvider::ProjectLocation { path, cursor_line, cursor_column })); + m_connection_wrapper.connection()->async_auto_complete_suggestions(GUI::AutocompleteProvider::ProjectLocation { path, cursor_line, cursor_column }); } void LanguageClient::provide_autocomplete_suggestions(const Vector<GUI::AutocompleteProvider::Entry>& suggestions) const @@ -88,7 +88,7 @@ void LanguageClient::set_autocomplete_mode(const String& mode) { if (!m_connection_wrapper.connection()) return; - m_connection_wrapper.connection()->post_message(Messages::LanguageServer::SetAutoCompleteMode(mode)); + m_connection_wrapper.connection()->async_set_auto_complete_mode(mode); } void LanguageClient::set_active_client() @@ -110,7 +110,7 @@ void LanguageClient::search_declaration(const String& path, size_t line, size_t if (!m_connection_wrapper.connection()) return; set_active_client(); - m_connection_wrapper.connection()->post_message(Messages::LanguageServer::FindDeclaration(GUI::AutocompleteProvider::ProjectLocation { path, line, column })); + m_connection_wrapper.connection()->async_find_declaration(GUI::AutocompleteProvider::ProjectLocation { path, line, column }); } void LanguageClient::declaration_found(const String& file, size_t line, size_t column) const @@ -221,7 +221,7 @@ void ServerConnectionWrapper::try_respawn_connection() project().for_each_text_file([this](const ProjectFile& file) { if (file.code_document().language() != m_language) return; - m_connection->post_message(Messages::LanguageServer::SetFileContent(file.code_document().file_path(), file.document().text())); + m_connection->async_set_file_content(file.code_document().file_path(), file.document().text()); }); } diff --git a/Userland/DevTools/HackStudio/LanguageClient.h b/Userland/DevTools/HackStudio/LanguageClient.h index 1d2c1057d1..e99a52c549 100644 --- a/Userland/DevTools/HackStudio/LanguageClient.h +++ b/Userland/DevTools/HackStudio/LanguageClient.h @@ -38,7 +38,7 @@ public: virtual void handshake() override { - send_sync<Messages::LanguageServer::Greet>(m_project_path); + greet(m_project_path); } WeakPtr<LanguageClient> language_client() { return m_current_language_client; } diff --git a/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.cpp b/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.cpp index 032ec6cfd8..ae64494e38 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.cpp @@ -81,7 +81,7 @@ void ClientConnection::auto_complete_suggestions(GUI::AutocompleteProvider::Proj GUI::TextPosition autocomplete_position = { (size_t)location.line, (size_t)max(location.column, location.column - 1) }; Vector<GUI::AutocompleteProvider::Entry> suggestions = m_autocomplete_engine->get_suggestions(location.file, autocomplete_position); - post_message(Messages::LanguageClient::AutoCompleteSuggestions(move(suggestions))); + async_auto_complete_suggestions(move(suggestions)); } void ClientConnection::set_file_content(String const& filename, String const& content) @@ -115,12 +115,12 @@ void ClientConnection::find_declaration(GUI::AutocompleteProvider::ProjectLocati } dbgln_if(LANGUAGE_SERVER_DEBUG, "declaration location: {} {}:{}", decl_location.value().file, decl_location.value().line, decl_location.value().column); - post_message(Messages::LanguageClient::DeclarationLocation(GUI::AutocompleteProvider::ProjectLocation { decl_location.value().file, decl_location.value().line, decl_location.value().column })); + async_declaration_location(GUI::AutocompleteProvider::ProjectLocation { decl_location.value().file, decl_location.value().line, decl_location.value().column }); } void ClientConnection::set_declarations_of_document_callback(ClientConnection& instance, const String& filename, Vector<GUI::AutocompleteProvider::Declaration>&& declarations) { - instance.post_message(Messages::LanguageClient::DeclarationsInDocument(filename, move(declarations))); + instance.async_declarations_in_document(filename, move(declarations)); } } diff --git a/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.h b/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.h index cba8fadb94..0ae2ff1d37 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.h +++ b/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.h @@ -19,8 +19,7 @@ namespace LanguageServers { class ClientConnection - : public IPC::ClientConnection<LanguageClientEndpoint, LanguageServerEndpoint> -{ + : public IPC::ClientConnection<LanguageClientEndpoint, LanguageServerEndpoint> { public: explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id); ~ClientConnection() override; diff --git a/Userland/DevTools/IPCCompiler/main.cpp b/Userland/DevTools/IPCCompiler/main.cpp index 5b35a4942b..4a6ad43d1f 100644 --- a/Userland/DevTools/IPCCompiler/main.cpp +++ b/Userland/DevTools/IPCCompiler/main.cpp @@ -254,9 +254,9 @@ int main(int argc, char** argv) #include <LibIPC/Decoder.h> #include <LibIPC/Dictionary.h> #include <LibIPC/Encoder.h> -#include <LibIPC/Stub.h> #include <LibIPC/File.h> #include <LibIPC/Message.h> +#include <LibIPC/Stub.h> )~~~"); for (auto& endpoint : endpoints) { diff --git a/Userland/Libraries/LibAudio/ClientConnection.cpp b/Userland/Libraries/LibAudio/ClientConnection.cpp index f8926e9efc..f095b2a968 100644 --- a/Userland/Libraries/LibAudio/ClientConnection.cpp +++ b/Userland/Libraries/LibAudio/ClientConnection.cpp @@ -16,14 +16,14 @@ ClientConnection::ClientConnection() void ClientConnection::handshake() { - send_sync<Messages::AudioServer::Greet>(); + greet(); } void ClientConnection::enqueue(const Buffer& buffer) { for (;;) { - auto response = send_sync<Messages::AudioServer::EnqueueBuffer>(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count()); - if (response->success()) + auto response = enqueue_buffer(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count()); + if (response.success()) break; sleep(1); } @@ -31,53 +31,53 @@ void ClientConnection::enqueue(const Buffer& buffer) bool ClientConnection::try_enqueue(const Buffer& buffer) { - auto response = send_sync<Messages::AudioServer::EnqueueBuffer>(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count()); - return response->success(); + auto response = enqueue_buffer(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count()); + return response.success(); } bool ClientConnection::get_muted() { - return send_sync<Messages::AudioServer::GetMuted>()->muted(); + return IPCProxy::get_muted().muted(); } void ClientConnection::set_muted(bool muted) { - send_sync<Messages::AudioServer::SetMuted>(muted); + IPCProxy::set_muted(muted); } int ClientConnection::get_main_mix_volume() { - return send_sync<Messages::AudioServer::GetMainMixVolume>()->volume(); + return IPCProxy::get_main_mix_volume().volume(); } void ClientConnection::set_main_mix_volume(int volume) { - send_sync<Messages::AudioServer::SetMainMixVolume>(volume); + IPCProxy::set_main_mix_volume(volume); } int ClientConnection::get_remaining_samples() { - return send_sync<Messages::AudioServer::GetRemainingSamples>()->remaining_samples(); + return IPCProxy::get_remaining_samples().remaining_samples(); } int ClientConnection::get_played_samples() { - return send_sync<Messages::AudioServer::GetPlayedSamples>()->played_samples(); + return IPCProxy::get_played_samples().played_samples(); } void ClientConnection::set_paused(bool paused) { - send_sync<Messages::AudioServer::SetPaused>(paused); + IPCProxy::set_paused(paused); } void ClientConnection::clear_buffer(bool paused) { - send_sync<Messages::AudioServer::ClearBuffer>(paused); + IPCProxy::clear_buffer(paused); } int ClientConnection::get_playing_buffer() { - return send_sync<Messages::AudioServer::GetPlayingBuffer>()->buffer_id(); + return IPCProxy::get_playing_buffer().buffer_id(); } void ClientConnection::finished_playing_buffer(i32 buffer_id) diff --git a/Userland/Libraries/LibDesktop/Launcher.cpp b/Userland/Libraries/LibDesktop/Launcher.cpp index 1a654224e2..c77d4a8fba 100644 --- a/Userland/Libraries/LibDesktop/Launcher.cpp +++ b/Userland/Libraries/LibDesktop/Launcher.cpp @@ -40,7 +40,7 @@ class LaunchServerConnection : public IPC::ServerConnection<LaunchClientEndpoint public: virtual void handshake() override { - send_sync<Messages::LaunchServer::Greet>(); + greet(); } private: @@ -99,7 +99,7 @@ bool Launcher::seal_allowlist() bool Launcher::open(const URL& url, const String& handler_name) { - return connection().send_sync<Messages::LaunchServer::OpenURL>(url, handler_name)->response(); + return connection().open_url(url, handler_name).response(); } bool Launcher::open(const URL& url, const Details& details) @@ -110,12 +110,12 @@ bool Launcher::open(const URL& url, const Details& details) Vector<String> Launcher::get_handlers_for_url(const URL& url) { - return connection().send_sync<Messages::LaunchServer::GetHandlersForURL>(url.to_string())->handlers(); + return connection().get_handlers_for_url(url.to_string()).handlers(); } auto Launcher::get_handlers_with_details_for_url(const URL& url) -> NonnullRefPtrVector<Details> { - auto details = connection().send_sync<Messages::LaunchServer::GetHandlersWithDetailsForURL>(url.to_string())->handlers_details(); + auto details = connection().get_handlers_with_details_for_url(url.to_string()).handlers_details(); NonnullRefPtrVector<Details> handlers_with_details; for (auto& value : details) { handlers_with_details.append(Details::from_details_str(value)); diff --git a/Userland/Libraries/LibGUI/Application.cpp b/Userland/Libraries/LibGUI/Application.cpp index 1b78ce29c5..cafd194c41 100644 --- a/Userland/Libraries/LibGUI/Application.cpp +++ b/Userland/Libraries/LibGUI/Application.cpp @@ -186,7 +186,7 @@ void Application::tooltip_show_timer_did_fire() Gfx::IntRect desktop_rect = Desktop::the().rect(); const int margin = 30; - Gfx::IntPoint adjusted_pos = WindowServerConnection::the().send_sync<Messages::WindowServer::GetGlobalCursorPosition>()->position(); + Gfx::IntPoint adjusted_pos = WindowServerConnection::the().get_global_cursor_position().position(); adjusted_pos.translate_by(0, 18); diff --git a/Userland/Libraries/LibGUI/Clipboard.cpp b/Userland/Libraries/LibGUI/Clipboard.cpp index dc1660da62..255b6095a4 100644 --- a/Userland/Libraries/LibGUI/Clipboard.cpp +++ b/Userland/Libraries/LibGUI/Clipboard.cpp @@ -19,7 +19,7 @@ class ClipboardServerConnection : public IPC::ServerConnection<ClipboardClientEn public: virtual void handshake() override { - send_sync<Messages::ClipboardServer::Greet>(); + greet(); } private: @@ -56,12 +56,12 @@ Clipboard::Clipboard() Clipboard::DataAndType Clipboard::data_and_type() const { - auto response = connection().send_sync<Messages::ClipboardServer::GetClipboardData>(); - if (!response->data().is_valid()) + auto response = connection().get_clipboard_data(); + if (!response.data().is_valid()) return {}; - auto data = ByteBuffer::copy(response->data().data<void>(), response->data().size()); - auto type = response->mime_type(); - auto metadata = response->metadata().entries(); + auto data = ByteBuffer::copy(response.data().data<void>(), response.data().size()); + auto type = response.mime_type(); + auto metadata = response.metadata().entries(); return { data, type, metadata }; } @@ -75,7 +75,7 @@ void Clipboard::set_data(ReadonlyBytes data, const String& type, const HashMap<S if (!data.is_empty()) memcpy(buffer.data<void>(), data.data(), data.size()); - connection().send_sync<Messages::ClipboardServer::SetClipboardData>(move(buffer), type, metadata); + connection().set_clipboard_data(move(buffer), type, metadata); } void ClipboardServerConnection::clipboard_data_changed(String const& mime_type) diff --git a/Userland/Libraries/LibGUI/Desktop.cpp b/Userland/Libraries/LibGUI/Desktop.cpp index 77d40ed2b3..8dda3d099f 100644 --- a/Userland/Libraries/LibGUI/Desktop.cpp +++ b/Userland/Libraries/LibGUI/Desktop.cpp @@ -34,18 +34,18 @@ void Desktop::did_receive_screen_rect(Badge<WindowServerConnection>, const Gfx:: void Desktop::set_background_color(const StringView& background_color) { - WindowServerConnection::the().post_message(Messages::WindowServer::SetBackgroundColor(background_color)); + WindowServerConnection::the().async_set_background_color(background_color); } void Desktop::set_wallpaper_mode(const StringView& mode) { - WindowServerConnection::the().post_message(Messages::WindowServer::SetWallpaperMode(mode)); + WindowServerConnection::the().async_set_wallpaper_mode(mode); } bool Desktop::set_wallpaper(const StringView& path, bool save_config) { - WindowServerConnection::the().post_message(Messages::WindowServer::AsyncSetWallpaper(path)); - auto ret_val = WindowServerConnection::the().wait_for_specific_message<Messages::WindowClient::AsyncSetWallpaperFinished>()->success(); + WindowServerConnection::the().async_set_wallpaper(path); + auto ret_val = WindowServerConnection::the().wait_for_specific_message<Messages::WindowClient::SetWallpaperFinished>()->success(); if (ret_val && save_config) { RefPtr<Core::ConfigFile> config = Core::ConfigFile::get_for_app("WindowManager"); @@ -59,7 +59,7 @@ bool Desktop::set_wallpaper(const StringView& path, bool save_config) String Desktop::wallpaper() const { - return WindowServerConnection::the().send_sync<Messages::WindowServer::GetWallpaper>()->path(); + return WindowServerConnection::the().get_wallpaper().path(); } } diff --git a/Userland/Libraries/LibGUI/DisplayLink.cpp b/Userland/Libraries/LibGUI/DisplayLink.cpp index cd64dd4dd8..a7aed14a53 100644 --- a/Userland/Libraries/LibGUI/DisplayLink.cpp +++ b/Userland/Libraries/LibGUI/DisplayLink.cpp @@ -43,7 +43,7 @@ static i32 s_next_callback_id = 1; i32 DisplayLink::register_callback(Function<void(i32)> callback) { if (callbacks().is_empty()) - WindowServerConnection::the().post_message(Messages::WindowServer::EnableDisplayLink()); + WindowServerConnection::the().async_enable_display_link(); i32 callback_id = s_next_callback_id++; callbacks().set(callback_id, adopt_ref(*new DisplayLinkCallback(callback_id, move(callback)))); @@ -57,7 +57,7 @@ bool DisplayLink::unregister_callback(i32 callback_id) callbacks().remove(callback_id); if (callbacks().is_empty()) - WindowServerConnection::the().post_message(Messages::WindowServer::DisableDisplayLink()); + WindowServerConnection::the().async_disable_display_link(); return true; } diff --git a/Userland/Libraries/LibGUI/DragOperation.cpp b/Userland/Libraries/LibGUI/DragOperation.cpp index 99001946d9..f840569cc3 100644 --- a/Userland/Libraries/LibGUI/DragOperation.cpp +++ b/Userland/Libraries/LibGUI/DragOperation.cpp @@ -37,12 +37,12 @@ DragOperation::Outcome DragOperation::exec() drag_bitmap = bitmap->to_shareable_bitmap(); } - auto response = WindowServerConnection::the().send_sync<Messages::WindowServer::StartDrag>( + auto response = WindowServerConnection::the().start_drag( m_mime_data->text(), m_mime_data->all_data(), drag_bitmap); - if (!response->started()) { + if (!response.started()) { m_outcome = Outcome::Cancelled; return m_outcome; } diff --git a/Userland/Libraries/LibGUI/Menu.cpp b/Userland/Libraries/LibGUI/Menu.cpp index 3d774ad385..9cdc02623f 100644 --- a/Userland/Libraries/LibGUI/Menu.cpp +++ b/Userland/Libraries/LibGUI/Menu.cpp @@ -72,20 +72,20 @@ void Menu::realize_if_needed(const RefPtr<Action>& default_action) void Menu::popup(const Gfx::IntPoint& screen_position, const RefPtr<Action>& default_action) { realize_if_needed(default_action); - WindowServerConnection::the().post_message(Messages::WindowServer::PopupMenu(m_menu_id, screen_position)); + WindowServerConnection::the().async_popup_menu(m_menu_id, screen_position); } void Menu::dismiss() { if (m_menu_id == -1) return; - WindowServerConnection::the().post_message(Messages::WindowServer::DismissMenu(m_menu_id)); + WindowServerConnection::the().async_dismiss_menu(m_menu_id); } int Menu::realize_menu(RefPtr<Action> default_action) { unrealize_menu(); - m_menu_id = WindowServerConnection::the().send_sync<Messages::WindowServer::CreateMenu>(m_name)->menu_id(); + m_menu_id = WindowServerConnection::the().create_menu(m_name).menu_id(); dbgln_if(MENU_DEBUG, "GUI::Menu::realize_menu(): New menu ID: {}", m_menu_id); VERIFY(m_menu_id > 0); @@ -94,14 +94,14 @@ int Menu::realize_menu(RefPtr<Action> default_action) item.set_menu_id({}, m_menu_id); item.set_identifier({}, i); if (item.type() == MenuItem::Type::Separator) { - WindowServerConnection::the().send_sync<Messages::WindowServer::AddMenuSeparator>(m_menu_id); + WindowServerConnection::the().add_menu_separator(m_menu_id); continue; } if (item.type() == MenuItem::Type::Submenu) { auto& submenu = *item.submenu(); submenu.realize_if_needed(default_action); auto icon = submenu.icon() ? submenu.icon()->to_shareable_bitmap() : Gfx::ShareableBitmap(); - WindowServerConnection::the().send_sync<Messages::WindowServer::AddMenuItem>(m_menu_id, i, submenu.menu_id(), submenu.name(), true, false, false, false, "", icon, false); + WindowServerConnection::the().add_menu_item(m_menu_id, i, submenu.menu_id(), submenu.name(), true, false, false, false, "", icon, false); continue; } if (item.type() == MenuItem::Type::Action) { @@ -110,7 +110,7 @@ int Menu::realize_menu(RefPtr<Action> default_action) bool exclusive = action.group() && action.group()->is_exclusive() && action.is_checkable(); bool is_default = (default_action.ptr() == &action); auto icon = action.icon() ? action.icon()->to_shareable_bitmap() : Gfx::ShareableBitmap(); - WindowServerConnection::the().send_sync<Messages::WindowServer::AddMenuItem>(m_menu_id, i, -1, action.text(), action.is_enabled(), action.is_checkable(), action.is_checkable() ? action.is_checked() : false, is_default, shortcut_text, icon, exclusive); + WindowServerConnection::the().add_menu_item(m_menu_id, i, -1, action.text(), action.is_enabled(), action.is_checkable(), action.is_checkable() ? action.is_checked() : false, is_default, shortcut_text, icon, exclusive); } } all_menus().set(m_menu_id, this); @@ -123,7 +123,7 @@ void Menu::unrealize_menu() if (m_menu_id == -1) return; all_menus().remove(m_menu_id); - WindowServerConnection::the().send_sync<Messages::WindowServer::DestroyMenu>(m_menu_id); + WindowServerConnection::the().destroy_menu(m_menu_id); m_menu_id = -1; } diff --git a/Userland/Libraries/LibGUI/MenuItem.cpp b/Userland/Libraries/LibGUI/MenuItem.cpp index 76ec90f0a2..02ca0bd6b3 100644 --- a/Userland/Libraries/LibGUI/MenuItem.cpp +++ b/Userland/Libraries/LibGUI/MenuItem.cpp @@ -74,7 +74,7 @@ void MenuItem::update_window_server() return; auto& action = *m_action; auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_string() : String(); - WindowServerConnection::the().send_sync<Messages::WindowServer::UpdateMenuItem>(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); + WindowServerConnection::the().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) diff --git a/Userland/Libraries/LibGUI/Menubar.cpp b/Userland/Libraries/LibGUI/Menubar.cpp index dac6acdaf4..2afac80b91 100644 --- a/Userland/Libraries/LibGUI/Menubar.cpp +++ b/Userland/Libraries/LibGUI/Menubar.cpp @@ -30,14 +30,14 @@ Menu& Menubar::add_menu(String name) int Menubar::realize_menubar() { - return WindowServerConnection::the().send_sync<Messages::WindowServer::CreateMenubar>()->menubar_id(); + return WindowServerConnection::the().create_menubar().menubar_id(); } void Menubar::unrealize_menubar() { if (m_menubar_id == -1) return; - WindowServerConnection::the().send_sync<Messages::WindowServer::DestroyMenubar>(m_menubar_id); + WindowServerConnection::the().destroy_menubar(m_menubar_id); m_menubar_id = -1; } @@ -49,7 +49,7 @@ void Menubar::notify_added_to_window(Badge<Window>) for (auto& menu : m_menus) { int menu_id = menu.realize_menu(); VERIFY(menu_id != -1); - WindowServerConnection::the().send_sync<Messages::WindowServer::AddMenuToMenubar>(m_menubar_id, menu_id); + WindowServerConnection::the().add_menu_to_menubar(m_menubar_id, menu_id); } } diff --git a/Userland/Libraries/LibGUI/Notification.cpp b/Userland/Libraries/LibGUI/Notification.cpp index 4e1909c102..30d61c7af4 100644 --- a/Userland/Libraries/LibGUI/Notification.cpp +++ b/Userland/Libraries/LibGUI/Notification.cpp @@ -20,7 +20,7 @@ class NotificationServerConnection : public IPC::ServerConnection<NotificationCl public: virtual void handshake() override { - send_sync<Messages::NotificationServer::Greet>(); + greet(); } virtual void die() override @@ -51,7 +51,7 @@ void Notification::show() VERIFY(!m_shown && !m_destroyed); auto icon = m_icon ? m_icon->to_shareable_bitmap() : Gfx::ShareableBitmap(); m_connection = NotificationServerConnection::construct(this); - m_connection->send_sync<Messages::NotificationServer::ShowNotification>(m_text, m_title, icon); + m_connection->show_notification(m_text, m_title, icon); m_shown = true; } @@ -59,7 +59,7 @@ void Notification::close() { VERIFY(m_shown); if (!m_destroyed) { - m_connection->send_sync<Messages::NotificationServer::CloseNotification>(); + m_connection->close_notification(); connection_closed(); return; } @@ -73,13 +73,13 @@ bool Notification::update() } if (m_text_dirty || m_title_dirty) { - m_connection->send_sync<Messages::NotificationServer::UpdateNotificationText>(m_text, m_title); + m_connection->update_notification_text(m_text, m_title); m_text_dirty = false; m_title_dirty = false; } if (m_icon_dirty) { - m_connection->send_sync<Messages::NotificationServer::UpdateNotificationIcon>(m_icon ? m_icon->to_shareable_bitmap() : Gfx::ShareableBitmap()); + m_connection->update_notification_icon(m_icon ? m_icon->to_shareable_bitmap() : Gfx::ShareableBitmap()); m_icon_dirty = false; } diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp index ae03296839..1f028b2369 100644 --- a/Userland/Libraries/LibGUI/Window.cpp +++ b/Userland/Libraries/LibGUI/Window.cpp @@ -109,7 +109,7 @@ void Window::move_to_front() if (!is_visible()) return; - WindowServerConnection::the().send_sync<Messages::WindowServer::MoveWindowToFront>(m_window_id); + WindowServerConnection::the().move_window_to_front(m_window_id); } void Window::show() @@ -119,7 +119,7 @@ void Window::show() auto* parent_window = find_parent_window(); - auto response = WindowServerConnection::the().send_sync<Messages::WindowServer::CreateWindow>( + auto response = WindowServerConnection::the().create_window( m_rect_when_windowless, !m_moved_by_client, m_has_alpha_channel, @@ -138,7 +138,7 @@ void Window::show() (i32)m_window_type, m_title_when_windowless, parent_window ? parent_window->window_id() : 0); - m_window_id = response->window_id(); + m_window_id = response.window_id(); m_visible = true; apply_icon(); @@ -178,10 +178,10 @@ void Window::hide() { if (!is_visible()) return; - auto response = WindowServerConnection::the().send_sync<Messages::WindowServer::DestroyWindow>(m_window_id); + auto response = WindowServerConnection::the().destroy_window(m_window_id); server_did_destroy(); - for (auto child_window_id : response->destroyed_window_ids()) { + for (auto child_window_id : response.destroyed_window_ids()) { if (auto* window = Window::from_window_id(child_window_id)) { window->server_did_destroy(); } @@ -205,27 +205,27 @@ void Window::set_title(String title) m_title_when_windowless = move(title); if (!is_visible()) return; - WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowTitle>(m_window_id, m_title_when_windowless); + WindowServerConnection::the().set_window_title(m_window_id, m_title_when_windowless); } String Window::title() const { if (!is_visible()) return m_title_when_windowless; - return WindowServerConnection::the().send_sync<Messages::WindowServer::GetWindowTitle>(m_window_id)->title(); + return WindowServerConnection::the().get_window_title(m_window_id).title(); } Gfx::IntRect Window::applet_rect_on_screen() const { VERIFY(m_window_type == WindowType::Applet); - return WindowServerConnection::the().send_sync<Messages::WindowServer::GetAppletRectOnScreen>(m_window_id)->rect(); + return WindowServerConnection::the().get_applet_rect_on_screen(m_window_id).rect(); } Gfx::IntRect Window::rect() const { if (!is_visible()) return m_rect_when_windowless; - return WindowServerConnection::the().send_sync<Messages::WindowServer::GetWindowRect>(m_window_id)->rect(); + return WindowServerConnection::the().get_window_rect(m_window_id).rect(); } void Window::set_rect(const Gfx::IntRect& a_rect) @@ -240,7 +240,7 @@ void Window::set_rect(const Gfx::IntRect& a_rect) m_main_widget->resize(m_rect_when_windowless.size()); return; } - auto window_rect = WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowRect>(m_window_id, a_rect)->rect(); + auto window_rect = WindowServerConnection::the().set_window_rect(m_window_id, a_rect).rect(); if (m_back_store && m_back_store->size() != window_rect.size()) m_back_store = nullptr; if (m_front_store && m_front_store->size() != window_rect.size()) @@ -254,7 +254,7 @@ Gfx::IntSize Window::minimum_size() const if (!is_visible()) return m_minimum_size_when_windowless; - return WindowServerConnection::the().send_sync<Messages::WindowServer::GetWindowMinimumSize>(m_window_id)->size(); + return WindowServerConnection::the().get_window_minimum_size(m_window_id).size(); } void Window::set_minimum_size(const Gfx::IntSize& size) @@ -263,7 +263,7 @@ void Window::set_minimum_size(const Gfx::IntSize& size) m_minimum_size_when_windowless = size; if (is_visible()) - WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowMinimumSize>(m_window_id, size); + WindowServerConnection::the().set_window_minimum_size(m_window_id, size); } void Window::center_on_screen() @@ -297,10 +297,8 @@ void Window::set_window_type(WindowType window_type) void Window::make_window_manager(unsigned event_mask) { - GUI::WindowManagerServerConnection::the() - .post_message(Messages::WindowManagerServer::SetEventMask(event_mask)); - GUI::WindowManagerServerConnection::the() - .post_message(Messages::WindowManagerServer::SetManagerWindow(m_window_id)); + GUI::WindowManagerServerConnection::the().async_set_event_mask(event_mask); + GUI::WindowManagerServerConnection::the().async_set_manager_window(m_window_id); } void Window::set_cursor(Gfx::StandardCursor cursor) @@ -418,7 +416,7 @@ void Window::handle_multi_paint_event(MultiPaintEvent& event) set_current_backing_store(*m_back_store, true); if (is_visible()) - WindowServerConnection::the().post_message(Messages::WindowServer::DidFinishPainting(m_window_id, rects)); + WindowServerConnection::the().async_did_finish_painting(m_window_id, rects); } void Window::handle_key_event(KeyEvent& event) @@ -599,7 +597,7 @@ void Window::force_update() if (!is_visible()) return; auto rect = this->rect(); - WindowServerConnection::the().post_message(Messages::WindowServer::InvalidateRect(m_window_id, { { 0, 0, rect.width(), rect.height() } }, true)); + WindowServerConnection::the().async_invalidate_rect(m_window_id, { { 0, 0, rect.width(), rect.height() } }, true); } void Window::update(const Gfx::IntRect& a_rect) @@ -619,7 +617,7 @@ void Window::update(const Gfx::IntRect& a_rect) auto rects = move(m_pending_paint_event_rects); if (rects.is_empty()) return; - WindowServerConnection::the().post_message(Messages::WindowServer::InvalidateRect(m_window_id, rects, false)); + WindowServerConnection::the().async_invalidate_rect(m_window_id, rects, false); }); } m_pending_paint_event_rects.append(a_rect); @@ -698,7 +696,7 @@ void Window::set_has_alpha_channel(bool value) m_back_store = nullptr; m_front_store = nullptr; - WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowHasAlphaChannel>(m_window_id, value); + WindowServerConnection::the().set_window_has_alpha_channel(m_window_id, value); update(); } @@ -713,7 +711,7 @@ void Window::set_opacity(float opacity) m_opacity_when_windowless = opacity; if (!is_visible()) return; - WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowOpacity>(m_window_id, opacity); + WindowServerConnection::the().set_window_opacity(m_window_id, opacity); } void Window::set_alpha_hit_threshold(float threshold) @@ -727,7 +725,7 @@ void Window::set_alpha_hit_threshold(float threshold) m_alpha_hit_threshold = threshold; if (!is_visible()) return; - WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowAlphaHitThreshold>(m_window_id, threshold); + WindowServerConnection::the().set_window_alpha_hit_threshold(m_window_id, threshold); } void Window::set_hovered_widget(Widget* widget) @@ -747,7 +745,7 @@ void Window::set_hovered_widget(Widget* widget) void Window::set_current_backing_store(WindowBackingStore& backing_store, bool flush_immediately) { auto& bitmap = backing_store.bitmap(); - WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowBackingStore>(m_window_id, 32, bitmap.pitch(), bitmap.anon_fd(), backing_store.serial(), bitmap.has_alpha_channel(), bitmap.size(), flush_immediately); + WindowServerConnection::the().set_window_backing_store(m_window_id, 32, bitmap.pitch(), bitmap.anon_fd(), backing_store.serial(), bitmap.has_alpha_channel(), bitmap.size(), flush_immediately); } void Window::flip(const Vector<Gfx::IntRect, 32>& dirty_rects) @@ -832,12 +830,12 @@ void Window::apply_icon() if (!is_visible()) return; - WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowIconBitmap>(m_window_id, m_icon->to_shareable_bitmap()); + WindowServerConnection::the().set_window_icon_bitmap(m_window_id, m_icon->to_shareable_bitmap()); } void Window::start_interactive_resize() { - WindowServerConnection::the().post_message(Messages::WindowServer::StartWindowResize(m_window_id)); + WindowServerConnection::the().async_start_window_resize(m_window_id); } Vector<Widget*> Window::focusable_widgets(FocusSource source) const @@ -888,7 +886,7 @@ void Window::set_fullscreen(bool fullscreen) m_fullscreen = fullscreen; if (!is_visible()) return; - WindowServerConnection::the().send_sync<Messages::WindowServer::SetFullscreen>(m_window_id, fullscreen); + WindowServerConnection::the().set_fullscreen(m_window_id, fullscreen); } void Window::set_frameless(bool frameless) @@ -898,7 +896,7 @@ void Window::set_frameless(bool frameless) m_frameless = frameless; if (!is_visible()) return; - WindowServerConnection::the().send_sync<Messages::WindowServer::SetFrameless>(m_window_id, frameless); + WindowServerConnection::the().set_frameless(m_window_id, frameless); } bool Window::is_maximized() const @@ -906,7 +904,7 @@ bool Window::is_maximized() const if (!is_visible()) return false; - return WindowServerConnection::the().send_sync<Messages::WindowServer::IsMaximized>(m_window_id)->maximized(); + return WindowServerConnection::the().is_maximized(m_window_id).maximized(); } void Window::schedule_relayout() @@ -924,7 +922,7 @@ void Window::schedule_relayout() void Window::refresh_system_theme() { - WindowServerConnection::the().post_message(Messages::WindowServer::RefreshSystemTheme()); + WindowServerConnection::the().async_refresh_system_theme(); } void Window::for_each_window(Badge<WindowServerConnection>, Function<void(Window&)> callback) @@ -981,7 +979,7 @@ void Window::set_base_size(const Gfx::IntSize& base_size) return; m_base_size = base_size; if (is_visible()) - WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowBaseSizeAndSizeIncrement>(m_window_id, m_base_size, m_size_increment); + WindowServerConnection::the().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) @@ -990,7 +988,7 @@ void Window::set_size_increment(const Gfx::IntSize& size_increment) return; m_size_increment = size_increment; if (is_visible()) - WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowBaseSizeAndSizeIncrement>(m_window_id, m_base_size, m_size_increment); + WindowServerConnection::the().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) @@ -1000,7 +998,7 @@ void Window::set_resize_aspect_ratio(const Optional<Gfx::IntSize>& ratio) m_resize_aspect_ratio = ratio; if (is_visible()) - WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowResizeAspectRatio>(m_window_id, m_resize_aspect_ratio); + WindowServerConnection::the().set_window_resize_aspect_ratio(m_window_id, m_resize_aspect_ratio); } void Window::did_add_widget(Badge<Widget>, Widget&) @@ -1024,7 +1022,7 @@ void Window::did_remove_widget(Badge<Widget>, Widget& widget) void Window::set_progress(Optional<int> progress) { VERIFY(m_window_id); - WindowServerConnection::the().post_message(Messages::WindowServer::SetWindowProgress(m_window_id, progress)); + WindowServerConnection::the().async_set_window_progress(m_window_id, progress); } void Window::update_cursor() @@ -1041,9 +1039,9 @@ void Window::update_cursor() m_effective_cursor = new_cursor; if (m_custom_cursor) - WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowCustomCursor>(m_window_id, m_custom_cursor->to_shareable_bitmap()); + WindowServerConnection::the().set_window_custom_cursor(m_window_id, m_custom_cursor->to_shareable_bitmap()); else - WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowCursor>(m_window_id, (u32)m_effective_cursor); + WindowServerConnection::the().set_window_cursor(m_window_id, (u32)m_effective_cursor); } void Window::focus_a_widget_if_possible(FocusSource source) @@ -1078,7 +1076,7 @@ void Window::set_menubar(RefPtr<Menubar> menubar) m_menubar = move(menubar); if (m_window_id && m_menubar) { m_menubar->notify_added_to_window({}); - WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowMenubar>(m_window_id, m_menubar->menubar_id()); + WindowServerConnection::the().set_window_menubar(m_window_id, m_menubar->menubar_id()); } } @@ -1086,14 +1084,14 @@ bool Window::is_modified() const { if (!m_window_id) return false; - return WindowServerConnection::the().send_sync<Messages::WindowServer::IsWindowModified>(m_window_id)->modified(); + return WindowServerConnection::the().is_window_modified(m_window_id).modified(); } void Window::set_modified(bool modified) { if (!m_window_id) return; - WindowServerConnection::the().post_message(Messages::WindowServer::SetWindowModified(m_window_id, modified)); + WindowServerConnection::the().async_set_window_modified(m_window_id, modified); } } diff --git a/Userland/Libraries/LibGUI/WindowServerConnection.cpp b/Userland/Libraries/LibGUI/WindowServerConnection.cpp index 08a45cfd3b..81609ce748 100644 --- a/Userland/Libraries/LibGUI/WindowServerConnection.cpp +++ b/Userland/Libraries/LibGUI/WindowServerConnection.cpp @@ -42,9 +42,9 @@ static void set_system_theme_from_anonymous_buffer(Core::AnonymousBuffer buffer) void WindowServerConnection::handshake() { - auto response = send_sync<Messages::WindowServer::Greet>(); - set_system_theme_from_anonymous_buffer(response->theme_buffer()); - Desktop::the().did_receive_screen_rect({}, response->screen_rect()); + auto response = greet(); + set_system_theme_from_anonymous_buffer(response.theme_buffer()); + Desktop::the().did_receive_screen_rect({}, response.screen_rect()); } void WindowServerConnection::update_system_theme(Core::AnonymousBuffer const& theme_buffer) @@ -293,7 +293,7 @@ void WindowServerConnection::screen_rect_changed(Gfx::IntRect const& rect) }); } -void WindowServerConnection::async_set_wallpaper_finished(bool) +void WindowServerConnection::set_wallpaper_finished(bool) { // This is handled manually by Desktop::set_wallpaper(). } @@ -337,7 +337,7 @@ void WindowServerConnection::display_link_notification() void WindowServerConnection::ping() { - post_message(Messages::WindowServer::Pong()); + async_pong(); } } diff --git a/Userland/Libraries/LibGUI/WindowServerConnection.h b/Userland/Libraries/LibGUI/WindowServerConnection.h index 6e152c506d..472888ac2b 100644 --- a/Userland/Libraries/LibGUI/WindowServerConnection.h +++ b/Userland/Libraries/LibGUI/WindowServerConnection.h @@ -48,7 +48,7 @@ private: virtual void menu_item_left(i32, u32) override; virtual void menu_visibility_did_change(i32, bool) override; virtual void screen_rect_changed(Gfx::IntRect const&) override; - virtual void async_set_wallpaper_finished(bool) override; + virtual void set_wallpaper_finished(bool) override; virtual void drag_dropped(i32, Gfx::IntPoint const&, String const&, HashMap<String, ByteBuffer> const&) override; virtual void drag_accepted() override; virtual void drag_cancelled() override; diff --git a/Userland/Libraries/LibIPC/ClientConnection.h b/Userland/Libraries/LibIPC/ClientConnection.h index 77eea2548a..bb72a6f633 100644 --- a/Userland/Libraries/LibIPC/ClientConnection.h +++ b/Userland/Libraries/LibIPC/ClientConnection.h @@ -17,13 +17,16 @@ NonnullRefPtr<T> new_client_connection(Args&&... args) } template<typename ClientEndpoint, typename ServerEndpoint> -class ClientConnection : public Connection<ServerEndpoint, ClientEndpoint>, public ServerEndpoint::Stub { +class ClientConnection : public Connection<ServerEndpoint, ClientEndpoint> + , public ServerEndpoint::Stub + , public ClientEndpoint::template Proxy<ServerEndpoint> { public: - using ClientProxy = typename ClientEndpoint::Proxy; using ServerStub = typename ServerEndpoint::Stub; + using IPCProxy = ClientEndpoint::template Proxy<ServerEndpoint>; ClientConnection(ServerStub& stub, NonnullRefPtr<Core::LocalSocket> socket, int client_id) : IPC::Connection<ServerEndpoint, ClientEndpoint>(stub, move(socket)) + , ClientEndpoint::template Proxy<ServerEndpoint>(*this, {}) , m_client_id(client_id) { VERIFY(this->socket().is_connected()); diff --git a/Userland/Libraries/LibIPC/Connection.h b/Userland/Libraries/LibIPC/Connection.h index a859037ca8..555b5e67df 100644 --- a/Userland/Libraries/LibIPC/Connection.h +++ b/Userland/Libraries/LibIPC/Connection.h @@ -29,7 +29,6 @@ template<typename LocalEndpoint, typename PeerEndpoint> class Connection : public Core::Object { public: using LocalStub = typename LocalEndpoint::Stub; - using PeerProxy = typename PeerEndpoint::Proxy; Connection(LocalStub& local_stub, NonnullRefPtr<Core::LocalSocket> socket) : m_local_stub(local_stub) diff --git a/Userland/Libraries/LibIPC/ServerConnection.h b/Userland/Libraries/LibIPC/ServerConnection.h index bd6cc0dbcd..8c181d2b25 100644 --- a/Userland/Libraries/LibIPC/ServerConnection.h +++ b/Userland/Libraries/LibIPC/ServerConnection.h @@ -11,13 +11,16 @@ namespace IPC { template<typename ClientEndpoint, typename ServerEndpoint> -class ServerConnection : public IPC::Connection<ClientEndpoint, ServerEndpoint>, public ClientEndpoint::Stub { +class ServerConnection : public IPC::Connection<ClientEndpoint, ServerEndpoint> + , public ClientEndpoint::Stub + , public ServerEndpoint::template Proxy<ClientEndpoint> { public: using ClientStub = typename ClientEndpoint::Stub; - using ServerProxy = typename ServerEndpoint::Proxy; + using IPCProxy = ServerEndpoint::template Proxy<ClientEndpoint>; ServerConnection(ClientStub& local_endpoint, const StringView& address) : Connection<ClientEndpoint, ServerEndpoint>(local_endpoint, Core::LocalSocket::construct()) + , ServerEndpoint::template Proxy<ClientEndpoint>(*this, {}) { // We want to rate-limit our clients this->socket().set_blocking(true); diff --git a/Userland/Libraries/LibImageDecoderClient/Client.cpp b/Userland/Libraries/LibImageDecoderClient/Client.cpp index b4a2779bf7..bf49c7dd7b 100644 --- a/Userland/Libraries/LibImageDecoderClient/Client.cpp +++ b/Userland/Libraries/LibImageDecoderClient/Client.cpp @@ -23,7 +23,7 @@ void Client::die() void Client::handshake() { - send_sync<Messages::ImageDecoderServer::Greet>(); + greet(); } void Client::dummy() diff --git a/Userland/Libraries/LibProtocol/RequestClient.cpp b/Userland/Libraries/LibProtocol/RequestClient.cpp index 0fb195c243..8c25c1ea27 100644 --- a/Userland/Libraries/LibProtocol/RequestClient.cpp +++ b/Userland/Libraries/LibProtocol/RequestClient.cpp @@ -18,12 +18,12 @@ RequestClient::RequestClient() void RequestClient::handshake() { - send_sync<Messages::RequestServer::Greet>(); + greet(); } bool RequestClient::is_supported_protocol(const String& protocol) { - return send_sync<Messages::RequestServer::IsSupportedProtocol>(protocol)->supported(); + return IPCProxy::is_supported_protocol(protocol).supported(); } template<typename RequestHashMapTraits> @@ -33,29 +33,30 @@ RefPtr<Request> RequestClient::start_request(const String& method, const String& for (auto& it : request_headers) header_dictionary.add(it.key, it.value); - auto response = send_sync<Messages::RequestServer::StartRequest>(method, url, header_dictionary, ByteBuffer::copy(request_body)); - auto request_id = response->request_id(); - if (request_id < 0 || !response->response_fd().has_value()) + auto response = IPCProxy::start_request(method, url, header_dictionary, ByteBuffer::copy(request_body)); + auto request_id = response.request_id(); + if (request_id < 0 || !response.response_fd().has_value()) return nullptr; - auto response_fd = response->response_fd().value().take_fd(); + auto response_fd = response.response_fd().value().take_fd(); auto request = Request::create_from_id({}, *this, request_id); request->set_request_fd({}, response_fd); m_requests.set(request_id, request); return request; + return nullptr; } bool RequestClient::stop_request(Badge<Request>, Request& request) { if (!m_requests.contains(request.id())) return false; - return send_sync<Messages::RequestServer::StopRequest>(request.id())->success(); + return IPCProxy::stop_request(request.id()).success(); } bool RequestClient::set_certificate(Badge<Request>, Request& request, String certificate, String key) { if (!m_requests.contains(request.id())) return false; - return send_sync<Messages::RequestServer::SetCertificate>(request.id(), move(certificate), move(key))->success(); + return IPCProxy::set_certificate(request.id(), move(certificate), move(key)).success(); } void RequestClient::request_finished(i32 request_id, bool success, u32 total_size) diff --git a/Userland/Libraries/LibProtocol/WebSocketClient.cpp b/Userland/Libraries/LibProtocol/WebSocketClient.cpp index d322828d7f..e8607d7e2b 100644 --- a/Userland/Libraries/LibProtocol/WebSocketClient.cpp +++ b/Userland/Libraries/LibProtocol/WebSocketClient.cpp @@ -17,7 +17,7 @@ WebSocketClient::WebSocketClient() void WebSocketClient::handshake() { - send_sync<Messages::WebSocketServer::Greet>(); + greet(); } RefPtr<WebSocket> WebSocketClient::connect(const URL& url, const String& origin, const Vector<String>& protocols, const Vector<String>& extensions, const HashMap<String, String>& request_headers) @@ -25,8 +25,8 @@ RefPtr<WebSocket> WebSocketClient::connect(const URL& url, const String& origin, IPC::Dictionary header_dictionary; for (auto& it : request_headers) header_dictionary.add(it.key, it.value); - auto response = send_sync<Messages::WebSocketServer::Connect>(url, origin, protocols, extensions, header_dictionary); - auto connection_id = response->connection_id(); + auto response = IPCProxy::connect(url, origin, protocols, extensions, header_dictionary); + auto connection_id = response.connection_id(); if (connection_id < 0) return nullptr; auto connection = WebSocket::create_from_id({}, *this, connection_id); @@ -38,28 +38,28 @@ u32 WebSocketClient::ready_state(Badge<WebSocket>, WebSocket& connection) { if (!m_connections.contains(connection.id())) return (u32)WebSocket::ReadyState::Closed; - return send_sync<Messages::WebSocketServer::ReadyState>(connection.id())->ready_state(); + return IPCProxy::ready_state(connection.id()).ready_state(); } void WebSocketClient::send(Badge<WebSocket>, WebSocket& connection, ByteBuffer data, bool is_text) { if (!m_connections.contains(connection.id())) return; - post_message(Messages::WebSocketServer::Send(connection.id(), is_text, move(data))); + async_send(connection.id(), is_text, move(data)); } void WebSocketClient::close(Badge<WebSocket>, WebSocket& connection, u16 code, String message) { if (!m_connections.contains(connection.id())) return; - post_message(Messages::WebSocketServer::Close(connection.id(), code, move(message))); + async_close(connection.id(), code, move(message)); } bool WebSocketClient::set_certificate(Badge<WebSocket>, WebSocket& connection, String certificate, String key) { if (!m_connections.contains(connection.id())) return false; - return send_sync<Messages::WebSocketServer::SetCertificate>(connection.id(), move(certificate), move(key))->success(); + return IPCProxy::set_certificate(connection.id(), move(certificate), move(key)).success(); } void WebSocketClient::connected(i32 connection_id) diff --git a/Userland/Libraries/LibSymbolClient/Client.cpp b/Userland/Libraries/LibSymbolClient/Client.cpp index 7af4e1ee36..01486174b1 100644 --- a/Userland/Libraries/LibSymbolClient/Client.cpp +++ b/Userland/Libraries/LibSymbolClient/Client.cpp @@ -20,7 +20,7 @@ Client::Client() void Client::handshake() { - send_sync<Messages::SymbolServer::Greet>(); + greet(); } void Client::dummy() @@ -29,16 +29,16 @@ void Client::dummy() Optional<Symbol> Client::symbolicate(const String& path, FlatPtr address) { - auto response = send_sync<Messages::SymbolServer::Symbolicate>(path, address); - if (!response->success()) + auto response = IPCProxy::symbolicate(path, address); + if (!response.success()) return {}; return Symbol { .address = address, - .name = response->name(), - .offset = response->offset(), - .filename = response->filename(), - .line_number = response->line() + .name = response.name(), + .offset = response.offset(), + .filename = response.filename(), + .line_number = response.line() }; } diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp index cf97279c91..9cfc18a9e3 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp @@ -68,26 +68,26 @@ void OutOfProcessWebView::create_client() }); }; - client().post_message(Messages::WebContentServer::UpdateSystemTheme(Gfx::current_system_theme_buffer())); - client().post_message(Messages::WebContentServer::UpdateScreenRect(GUI::Desktop::the().rect())); + client().async_update_system_theme(Gfx::current_system_theme_buffer()); + client().async_update_screen_rect(GUI::Desktop::the().rect()); } void OutOfProcessWebView::load(const URL& url) { m_url = url; - client().post_message(Messages::WebContentServer::LoadURL(url)); + client().async_load_url(url); } void OutOfProcessWebView::load_html(const StringView& html, const URL& url) { m_url = url; - client().post_message(Messages::WebContentServer::LoadHTML(html, url)); + client().async_load_html(html, url); } void OutOfProcessWebView::load_empty_document() { m_url = {}; - client().post_message(Messages::WebContentServer::LoadHTML("", {})); + client().async_load_html("", {}); } void OutOfProcessWebView::paint_event(GUI::PaintEvent& event) @@ -119,7 +119,7 @@ void OutOfProcessWebView::resize_event(GUI::ResizeEvent& event) void OutOfProcessWebView::handle_resize() { - client().post_message(Messages::WebContentServer::SetViewportRect(Gfx::IntRect({ horizontal_scrollbar().value(), vertical_scrollbar().value() }, available_size()))); + client().async_set_viewport_rect(Gfx::IntRect({ horizontal_scrollbar().value(), vertical_scrollbar().value() }, available_size())); if (m_client_state.has_usable_bitmap) { // NOTE: We keep the outgoing front bitmap as a backup so we have something to paint until we get a new one. @@ -128,12 +128,12 @@ void OutOfProcessWebView::handle_resize() if (m_client_state.front_bitmap) { m_client_state.front_bitmap = nullptr; - client().post_message(Messages::WebContentServer::RemoveBackingStore(m_client_state.front_bitmap_id)); + client().async_remove_backing_store(m_client_state.front_bitmap_id); } if (m_client_state.back_bitmap) { m_client_state.back_bitmap = nullptr; - client().post_message(Messages::WebContentServer::RemoveBackingStore(m_client_state.back_bitmap_id)); + client().async_remove_backing_store(m_client_state.back_bitmap_id); } m_client_state.front_bitmap_id = -1; @@ -146,13 +146,13 @@ void OutOfProcessWebView::handle_resize() if (auto new_bitmap = Gfx::Bitmap::create_shareable(Gfx::BitmapFormat::BGRx8888, available_size())) { m_client_state.front_bitmap = move(new_bitmap); m_client_state.front_bitmap_id = m_client_state.next_bitmap_id++; - client().post_message(Messages::WebContentServer::AddBackingStore(m_client_state.front_bitmap_id, m_client_state.front_bitmap->to_shareable_bitmap())); + client().async_add_backing_store(m_client_state.front_bitmap_id, m_client_state.front_bitmap->to_shareable_bitmap()); } if (auto new_bitmap = Gfx::Bitmap::create_shareable(Gfx::BitmapFormat::BGRx8888, available_size())) { m_client_state.back_bitmap = move(new_bitmap); m_client_state.back_bitmap_id = m_client_state.next_bitmap_id++; - client().post_message(Messages::WebContentServer::AddBackingStore(m_client_state.back_bitmap_id, m_client_state.back_bitmap->to_shareable_bitmap())); + client().async_add_backing_store(m_client_state.back_bitmap_id, m_client_state.back_bitmap->to_shareable_bitmap()); } request_repaint(); @@ -160,39 +160,39 @@ void OutOfProcessWebView::handle_resize() void OutOfProcessWebView::keydown_event(GUI::KeyEvent& event) { - client().post_message(Messages::WebContentServer::KeyDown(event.key(), event.modifiers(), event.code_point())); + client().async_key_down(event.key(), event.modifiers(), event.code_point()); } void OutOfProcessWebView::mousedown_event(GUI::MouseEvent& event) { - client().post_message(Messages::WebContentServer::MouseDown(to_content_position(event.position()), event.button(), event.buttons(), event.modifiers())); + client().async_mouse_down(to_content_position(event.position()), event.button(), event.buttons(), event.modifiers()); } void OutOfProcessWebView::mouseup_event(GUI::MouseEvent& event) { - client().post_message(Messages::WebContentServer::MouseUp(to_content_position(event.position()), event.button(), event.buttons(), event.modifiers())); + client().async_mouse_up(to_content_position(event.position()), event.button(), event.buttons(), event.modifiers()); } void OutOfProcessWebView::mousemove_event(GUI::MouseEvent& event) { - client().post_message(Messages::WebContentServer::MouseMove(to_content_position(event.position()), event.button(), event.buttons(), event.modifiers())); + client().async_mouse_move(to_content_position(event.position()), event.button(), event.buttons(), event.modifiers()); } void OutOfProcessWebView::mousewheel_event(GUI::MouseEvent& event) { - client().post_message(Messages::WebContentServer::MouseWheel(to_content_position(event.position()), event.button(), event.buttons(), event.modifiers(), event.wheel_delta())); + client().async_mouse_wheel(to_content_position(event.position()), event.button(), event.buttons(), event.modifiers(), event.wheel_delta()); } void OutOfProcessWebView::theme_change_event(GUI::ThemeChangeEvent& event) { GUI::AbstractScrollableWidget::theme_change_event(event); - client().post_message(Messages::WebContentServer::UpdateSystemTheme(Gfx::current_system_theme_buffer())); + client().async_update_system_theme(Gfx::current_system_theme_buffer()); request_repaint(); } void OutOfProcessWebView::screen_rect_change_event(GUI::ScreenRectChangeEvent& event) { - client().post_message(Messages::WebContentServer::UpdateScreenRect(event.rect())); + client().async_update_screen_rect(event.rect()); } void OutOfProcessWebView::notify_server_did_paint(Badge<WebContentClient>, i32 bitmap_id) @@ -360,7 +360,7 @@ void OutOfProcessWebView::notify_server_did_set_cookie(Badge<WebContentClient>, void OutOfProcessWebView::did_scroll() { - client().post_message(Messages::WebContentServer::SetViewportRect(visible_content_rect())); + client().async_set_viewport_rect(visible_content_rect()); request_repaint(); } @@ -370,7 +370,7 @@ void OutOfProcessWebView::request_repaint() // it won't have a back bitmap yet, so we can just skip repaint requests. if (!m_client_state.back_bitmap) return; - client().post_message(Messages::WebContentServer::Paint(m_client_state.back_bitmap->rect().translated(horizontal_scrollbar().value(), vertical_scrollbar().value()), m_client_state.back_bitmap_id)); + client().async_paint(m_client_state.back_bitmap->rect().translated(horizontal_scrollbar().value(), vertical_scrollbar().value()), m_client_state.back_bitmap_id); } WebContentClient& OutOfProcessWebView::client() @@ -381,22 +381,22 @@ WebContentClient& OutOfProcessWebView::client() void OutOfProcessWebView::debug_request(const String& request, const String& argument) { - client().post_message(Messages::WebContentServer::DebugRequest(request, argument)); + client().async_debug_request(request, argument); } void OutOfProcessWebView::get_source() { - client().post_message(Messages::WebContentServer::GetSource()); + client().async_get_source(); } void OutOfProcessWebView::js_console_initialize() { - client().post_message(Messages::WebContentServer::JSConsoleInitialize()); + client().async_jsconsole_initialize(); } void OutOfProcessWebView::js_console_input(const String& js_source) { - client().post_message(Messages::WebContentServer::JSConsoleInput(js_source)); + client().async_jsconsole_input(js_source); } } diff --git a/Userland/Libraries/LibWeb/WebContentClient.cpp b/Userland/Libraries/LibWeb/WebContentClient.cpp index 7881406a1d..d06198edc4 100644 --- a/Userland/Libraries/LibWeb/WebContentClient.cpp +++ b/Userland/Libraries/LibWeb/WebContentClient.cpp @@ -26,7 +26,7 @@ void WebContentClient::die() void WebContentClient::handshake() { - send_sync<Messages::WebContentServer::Greet>(); + greet(); } void WebContentClient::did_paint(const Gfx::IntRect&, i32 bitmap_id) diff --git a/Userland/Services/AudioServer/ClientConnection.cpp b/Userland/Services/AudioServer/ClientConnection.cpp index 5433e3c9c4..34ef976d73 100644 --- a/Userland/Services/AudioServer/ClientConnection.cpp +++ b/Userland/Services/AudioServer/ClientConnection.cpp @@ -46,17 +46,17 @@ void ClientConnection::die() void ClientConnection::did_finish_playing_buffer(Badge<BufferQueue>, int buffer_id) { - post_message(Messages::AudioClient::FinishedPlayingBuffer(buffer_id)); + async_finished_playing_buffer(buffer_id); } void ClientConnection::did_change_muted_state(Badge<Mixer>, bool muted) { - post_message(Messages::AudioClient::MutedStateChanged(muted)); + async_muted_state_changed(muted); } void ClientConnection::did_change_main_mix_volume(Badge<Mixer>, int volume) { - post_message(Messages::AudioClient::MainMixVolumeChanged(volume)); + async_main_mix_volume_changed(volume); } void ClientConnection::greet() diff --git a/Userland/Services/AudioServer/ClientConnection.h b/Userland/Services/AudioServer/ClientConnection.h index 1a66f4bf70..21c65fbffa 100644 --- a/Userland/Services/AudioServer/ClientConnection.h +++ b/Userland/Services/AudioServer/ClientConnection.h @@ -20,8 +20,7 @@ namespace AudioServer { class BufferQueue; class Mixer; -class ClientConnection final : public IPC::ClientConnection<AudioClientEndpoint, AudioServerEndpoint> -{ +class ClientConnection final : public IPC::ClientConnection<AudioClientEndpoint, AudioServerEndpoint> { C_OBJECT(ClientConnection) public: explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id, Mixer& mixer); diff --git a/Userland/Services/Clipboard/ClientConnection.cpp b/Userland/Services/Clipboard/ClientConnection.cpp index fbba429880..25d5545c43 100644 --- a/Userland/Services/Clipboard/ClientConnection.cpp +++ b/Userland/Services/Clipboard/ClientConnection.cpp @@ -52,7 +52,7 @@ Messages::ClipboardServer::GetClipboardDataResponse ClientConnection::get_clipbo void ClientConnection::notify_about_clipboard_change() { - post_message(Messages::ClipboardClient::ClipboardDataChanged(Storage::the().mime_type())); + async_clipboard_data_changed(Storage::the().mime_type()); } } diff --git a/Userland/Services/Clipboard/ClientConnection.h b/Userland/Services/Clipboard/ClientConnection.h index 1bf0055b2d..4fbbe3fb05 100644 --- a/Userland/Services/Clipboard/ClientConnection.h +++ b/Userland/Services/Clipboard/ClientConnection.h @@ -14,8 +14,7 @@ namespace Clipboard { class ClientConnection final - : public IPC::ClientConnection<ClipboardClientEndpoint, ClipboardServerEndpoint> -{ + : public IPC::ClientConnection<ClipboardClientEndpoint, ClipboardServerEndpoint> { C_OBJECT(ClientConnection); public: diff --git a/Userland/Services/ImageDecoder/ClientConnection.h b/Userland/Services/ImageDecoder/ClientConnection.h index 89d6ef856d..b7417894b7 100644 --- a/Userland/Services/ImageDecoder/ClientConnection.h +++ b/Userland/Services/ImageDecoder/ClientConnection.h @@ -16,8 +16,7 @@ namespace ImageDecoder { class ClientConnection final - : public IPC::ClientConnection<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint> -{ + : public IPC::ClientConnection<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint> { C_OBJECT(ClientConnection); public: diff --git a/Userland/Services/LaunchServer/ClientConnection.h b/Userland/Services/LaunchServer/ClientConnection.h index c4e7c6ad57..48cb450cde 100644 --- a/Userland/Services/LaunchServer/ClientConnection.h +++ b/Userland/Services/LaunchServer/ClientConnection.h @@ -12,8 +12,7 @@ namespace LaunchServer { -class ClientConnection final : public IPC::ClientConnection<LaunchClientEndpoint, LaunchServerEndpoint> -{ +class ClientConnection final : public IPC::ClientConnection<LaunchClientEndpoint, LaunchServerEndpoint> { C_OBJECT(ClientConnection) public: ~ClientConnection() override; diff --git a/Userland/Services/LookupServer/ClientConnection.h b/Userland/Services/LookupServer/ClientConnection.h index 50f7316c50..a7f465be30 100644 --- a/Userland/Services/LookupServer/ClientConnection.h +++ b/Userland/Services/LookupServer/ClientConnection.h @@ -14,8 +14,7 @@ namespace LookupServer { class ClientConnection final - : public IPC::ClientConnection<LookupClientEndpoint, LookupServerEndpoint> -{ + : public IPC::ClientConnection<LookupClientEndpoint, LookupServerEndpoint> { C_OBJECT(ClientConnection); public: diff --git a/Userland/Services/NotificationServer/ClientConnection.h b/Userland/Services/NotificationServer/ClientConnection.h index 2abe843cce..6f5449d787 100644 --- a/Userland/Services/NotificationServer/ClientConnection.h +++ b/Userland/Services/NotificationServer/ClientConnection.h @@ -12,8 +12,7 @@ namespace NotificationServer { -class ClientConnection final : public IPC::ClientConnection<NotificationClientEndpoint, NotificationServerEndpoint> -{ +class ClientConnection final : public IPC::ClientConnection<NotificationClientEndpoint, NotificationServerEndpoint> { C_OBJECT(ClientConnection) public: ~ClientConnection() override; diff --git a/Userland/Services/RequestServer/ClientConnection.cpp b/Userland/Services/RequestServer/ClientConnection.cpp index 366783441f..eac1085dbf 100644 --- a/Userland/Services/RequestServer/ClientConnection.cpp +++ b/Userland/Services/RequestServer/ClientConnection.cpp @@ -77,26 +77,26 @@ void ClientConnection::did_receive_headers(Badge<Request>, Request& request) for (auto& it : request.response_headers()) response_headers.add(it.key, it.value); - post_message(Messages::RequestClient::HeadersBecameAvailable(request.id(), move(response_headers), request.status_code())); + async_headers_became_available(request.id(), move(response_headers), request.status_code()); } void ClientConnection::did_finish_request(Badge<Request>, Request& request, bool success) { VERIFY(request.total_size().has_value()); - post_message(Messages::RequestClient::RequestFinished(request.id(), success, request.total_size().value())); + async_request_finished(request.id(), success, request.total_size().value()); m_requests.remove(request.id()); } void ClientConnection::did_progress_request(Badge<Request>, Request& request) { - post_message(Messages::RequestClient::RequestProgress(request.id(), request.total_size(), request.downloaded_size())); + async_request_progress(request.id(), request.total_size(), request.downloaded_size()); } void ClientConnection::did_request_certificates(Badge<Request>, Request& request) { - post_message(Messages::RequestClient::CertificateRequested(request.id())); + async_certificate_requested(request.id()); } void ClientConnection::greet() diff --git a/Userland/Services/RequestServer/ClientConnection.h b/Userland/Services/RequestServer/ClientConnection.h index 6bfcd6e172..a5e1f9f965 100644 --- a/Userland/Services/RequestServer/ClientConnection.h +++ b/Userland/Services/RequestServer/ClientConnection.h @@ -15,8 +15,7 @@ namespace RequestServer { class ClientConnection final - : public IPC::ClientConnection<RequestClientEndpoint, RequestServerEndpoint> -{ + : public IPC::ClientConnection<RequestClientEndpoint, RequestServerEndpoint> { C_OBJECT(ClientConnection); public: diff --git a/Userland/Services/SymbolServer/ClientConnection.h b/Userland/Services/SymbolServer/ClientConnection.h index ea6132983c..29558a2a29 100644 --- a/Userland/Services/SymbolServer/ClientConnection.h +++ b/Userland/Services/SymbolServer/ClientConnection.h @@ -16,8 +16,7 @@ namespace SymbolServer { class ClientConnection final - : public IPC::ClientConnection<SymbolClientEndpoint, SymbolServerEndpoint> -{ + : public IPC::ClientConnection<SymbolClientEndpoint, SymbolServerEndpoint> { C_OBJECT(ClientConnection); public: diff --git a/Userland/Services/Taskbar/TaskbarButton.cpp b/Userland/Services/Taskbar/TaskbarButton.cpp index 22143a2458..62ca821008 100644 --- a/Userland/Services/Taskbar/TaskbarButton.cpp +++ b/Userland/Services/Taskbar/TaskbarButton.cpp @@ -26,29 +26,26 @@ TaskbarButton::~TaskbarButton() void TaskbarButton::context_menu_event(GUI::ContextMenuEvent&) { - GUI::WindowManagerServerConnection::the().post_message( - Messages::WindowManagerServer::PopupWindowMenu( - m_identifier.client_id(), - m_identifier.window_id(), - screen_relative_rect().location())); + GUI::WindowManagerServerConnection::the().async_popup_window_menu( + m_identifier.client_id(), + m_identifier.window_id(), + screen_relative_rect().location()); } void TaskbarButton::update_taskbar_rect() { - GUI::WindowManagerServerConnection::the().post_message( - Messages::WindowManagerServer::SetWindowTaskbarRect( - m_identifier.client_id(), - m_identifier.window_id(), - screen_relative_rect())); + GUI::WindowManagerServerConnection::the().async_set_window_taskbar_rect( + m_identifier.client_id(), + m_identifier.window_id(), + screen_relative_rect()); } void TaskbarButton::clear_taskbar_rect() { - GUI::WindowManagerServerConnection::the().post_message( - Messages::WindowManagerServer::SetWindowTaskbarRect( - m_identifier.client_id(), - m_identifier.window_id(), - {})); + GUI::WindowManagerServerConnection::the().async_set_window_taskbar_rect( + m_identifier.client_id(), + m_identifier.window_id(), + {}); } void TaskbarButton::resize_event(GUI::ResizeEvent& event) diff --git a/Userland/Services/Taskbar/TaskbarWindow.cpp b/Userland/Services/Taskbar/TaskbarWindow.cpp index a6dd4da3f1..05aeff2972 100644 --- a/Userland/Services/Taskbar/TaskbarWindow.cpp +++ b/Userland/Services/Taskbar/TaskbarWindow.cpp @@ -164,7 +164,7 @@ void TaskbarWindow::update_applet_area() main_widget()->do_layout(); Gfx::IntRect new_rect { {}, m_applet_area_size }; new_rect.center_within(m_applet_area_container->screen_relative_rect()); - GUI::WindowManagerServerConnection::the().send_sync<Messages::WindowManagerServer::SetAppletAreaPosition>(new_rect.location()); + GUI::WindowManagerServerConnection::the().set_applet_area_position(new_rect.location()); } NonnullRefPtr<GUI::Button> TaskbarWindow::create_button(const WindowIdentifier& identifier) @@ -191,9 +191,9 @@ void TaskbarWindow::add_window_button(::Window& window, const WindowIdentifier& // false because window is the modal window's owner (which is not // active) if (window->is_minimized() || !button->is_checked()) { - GUI::WindowManagerServerConnection::the().post_message(Messages::WindowManagerServer::SetActiveWindow(identifier.client_id(), identifier.window_id())); + GUI::WindowManagerServerConnection::the().async_set_active_window(identifier.client_id(), identifier.window_id()); } else { - GUI::WindowManagerServerConnection::the().post_message(Messages::WindowManagerServer::SetWindowMinimized(identifier.client_id(), identifier.window_id(), true)); + GUI::WindowManagerServerConnection::the().async_set_window_minimized(identifier.client_id(), identifier.window_id(), true); } }; } diff --git a/Userland/Services/Taskbar/main.cpp b/Userland/Services/Taskbar/main.cpp index 54c452e7ce..e32e208049 100644 --- a/Userland/Services/Taskbar/main.cpp +++ b/Userland/Services/Taskbar/main.cpp @@ -178,7 +178,7 @@ NonnullRefPtr<GUI::Menu> build_system_menu() quick_sort(g_themes, [](auto& a, auto& b) { return a.name < b.name; }); } - auto current_theme_name = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::GetSystemTheme>()->theme_name(); + auto current_theme_name = GUI::WindowServerConnection::the().get_system_theme().theme_name(); { int theme_identifier = 0; @@ -186,8 +186,8 @@ NonnullRefPtr<GUI::Menu> build_system_menu() auto action = GUI::Action::create_checkable(theme.name, [theme_identifier](auto&) { auto& theme = g_themes[theme_identifier]; dbgln("Theme switched to {} at path {}", theme.name, theme.path); - auto response = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetSystemTheme>(theme.path, theme.name); - VERIFY(response->success()); + auto response = GUI::WindowServerConnection::the().set_system_theme(theme.path, theme.name); + VERIFY(response.success()); }); if (theme.name == current_theme_name) action->set_checked(true); diff --git a/Userland/Services/WebContent/ClientConnection.cpp b/Userland/Services/WebContent/ClientConnection.cpp index 4f0b109816..23b764eb52 100644 --- a/Userland/Services/WebContent/ClientConnection.cpp +++ b/Userland/Services/WebContent/ClientConnection.cpp @@ -135,7 +135,7 @@ void ClientConnection::flush_pending_paint_requests() { for (auto& pending_paint : m_pending_paint_requests) { m_page_host->paint(pending_paint.content_rect, *pending_paint.bitmap); - post_message(Messages::WebContentClient::DidPaint(pending_paint.content_rect, pending_paint.bitmap_id)); + async_did_paint(pending_paint.content_rect, pending_paint.bitmap_id); } m_pending_paint_requests.clear(); } @@ -209,7 +209,7 @@ void ClientConnection::debug_request(const String& request, const String& argume void ClientConnection::get_source() { if (auto* doc = page().main_frame().document()) { - post_message(Messages::WebContentClient::DidGetSource(doc->url(), doc->source())); + async_did_get_source(doc->url(), doc->source()); } } diff --git a/Userland/Services/WebContent/ClientConnection.h b/Userland/Services/WebContent/ClientConnection.h index cfc0ea691d..eb290ff742 100644 --- a/Userland/Services/WebContent/ClientConnection.h +++ b/Userland/Services/WebContent/ClientConnection.h @@ -19,8 +19,7 @@ namespace WebContent { class ClientConnection final - : public IPC::ClientConnection<WebContentClientEndpoint, WebContentServerEndpoint> -{ + : public IPC::ClientConnection<WebContentClientEndpoint, WebContentServerEndpoint> { C_OBJECT(ClientConnection); public: diff --git a/Userland/Services/WebContent/PageHost.cpp b/Userland/Services/WebContent/PageHost.cpp index 86a48ecba1..6e2647287d 100644 --- a/Userland/Services/WebContent/PageHost.cpp +++ b/Userland/Services/WebContent/PageHost.cpp @@ -78,17 +78,17 @@ void PageHost::set_viewport_rect(const Gfx::IntRect& rect) void PageHost::page_did_invalidate(const Gfx::IntRect& content_rect) { - m_client.post_message(Messages::WebContentClient::DidInvalidateContentRect(content_rect)); + m_client.async_did_invalidate_content_rect(content_rect); } void PageHost::page_did_change_selection() { - m_client.post_message(Messages::WebContentClient::DidChangeSelection()); + m_client.async_did_change_selection(); } void PageHost::page_did_request_cursor_change(Gfx::StandardCursor cursor) { - m_client.post_message(Messages::WebContentClient::DidRequestCursorChange((u32)cursor)); + m_client.async_did_request_cursor_change((u32)cursor); } void PageHost::page_did_layout() @@ -96,107 +96,107 @@ void PageHost::page_did_layout() auto* layout_root = this->layout_root(); VERIFY(layout_root); auto content_size = enclosing_int_rect(layout_root->absolute_rect()).size(); - m_client.post_message(Messages::WebContentClient::DidLayout(content_size)); + m_client.async_did_layout(content_size); } void PageHost::page_did_change_title(const String& title) { - m_client.post_message(Messages::WebContentClient::DidChangeTitle(title)); + m_client.async_did_change_title(title); } void PageHost::page_did_request_scroll(int wheel_delta) { - m_client.post_message(Messages::WebContentClient::DidRequestScroll(wheel_delta)); + m_client.async_did_request_scroll(wheel_delta); } void PageHost::page_did_request_scroll_into_view(const Gfx::IntRect& rect) { - m_client.post_message(Messages::WebContentClient::DidRequestScrollIntoView(rect)); + m_client.async_did_request_scroll_into_view(rect); } void PageHost::page_did_enter_tooltip_area(const Gfx::IntPoint& content_position, const String& title) { - m_client.post_message(Messages::WebContentClient::DidEnterTooltipArea(content_position, title)); + m_client.async_did_enter_tooltip_area(content_position, title); } void PageHost::page_did_leave_tooltip_area() { - m_client.post_message(Messages::WebContentClient::DidLeaveTooltipArea()); + m_client.async_did_leave_tooltip_area(); } void PageHost::page_did_hover_link(const URL& url) { - m_client.post_message(Messages::WebContentClient::DidHoverLink(url)); + m_client.async_did_hover_link(url); } void PageHost::page_did_unhover_link() { - m_client.post_message(Messages::WebContentClient::DidUnhoverLink()); + m_client.async_did_unhover_link(); } void PageHost::page_did_click_link(const URL& url, const String& target, unsigned modifiers) { - m_client.post_message(Messages::WebContentClient::DidClickLink(url, target, modifiers)); + m_client.async_did_click_link(url, target, modifiers); } void PageHost::page_did_middle_click_link(const URL& url, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { - m_client.post_message(Messages::WebContentClient::DidMiddleClickLink(url, target, modifiers)); + m_client.async_did_middle_click_link(url, target, modifiers); } void PageHost::page_did_start_loading(const URL& url) { - m_client.post_message(Messages::WebContentClient::DidStartLoading(url)); + m_client.async_did_start_loading(url); } void PageHost::page_did_finish_loading(const URL& url) { - m_client.post_message(Messages::WebContentClient::DidFinishLoading(url)); + m_client.async_did_finish_loading(url); } void PageHost::page_did_request_context_menu(const Gfx::IntPoint& content_position) { - m_client.post_message(Messages::WebContentClient::DidRequestContextMenu(content_position)); + m_client.async_did_request_context_menu(content_position); } void PageHost::page_did_request_link_context_menu(const Gfx::IntPoint& content_position, const URL& url, const String& target, unsigned modifiers) { - m_client.post_message(Messages::WebContentClient::DidRequestLinkContextMenu(content_position, url, target, modifiers)); + m_client.async_did_request_link_context_menu(content_position, url, target, modifiers); } void PageHost::page_did_request_alert(const String& message) { - m_client.send_sync<Messages::WebContentClient::DidRequestAlert>(message); + m_client.did_request_alert(message); } bool PageHost::page_did_request_confirm(const String& message) { - return m_client.send_sync<Messages::WebContentClient::DidRequestConfirm>(message)->result(); + return m_client.did_request_confirm(message).result(); } String PageHost::page_did_request_prompt(const String& message, const String& default_) { - return m_client.send_sync<Messages::WebContentClient::DidRequestPrompt>(message, default_)->response(); + return m_client.did_request_prompt(message, default_).response(); } void PageHost::page_did_change_favicon(const Gfx::Bitmap& favicon) { - m_client.post_message(Messages::WebContentClient::DidChangeFavicon(favicon.to_shareable_bitmap())); + m_client.async_did_change_favicon(favicon.to_shareable_bitmap()); } void PageHost::page_did_request_image_context_menu(const Gfx::IntPoint& content_position, const URL& url, const String& target, unsigned modifiers, const Gfx::Bitmap* bitmap) { - m_client.post_message(Messages::WebContentClient::DidRequestImageContextMenu(content_position, url, target, modifiers, bitmap->to_shareable_bitmap())); + m_client.async_did_request_image_context_menu(content_position, url, target, modifiers, bitmap->to_shareable_bitmap()); } String PageHost::page_did_request_cookie(const URL& url, Web::Cookie::Source source) { - return m_client.send_sync<Messages::WebContentClient::DidRequestCookie>(url, static_cast<u8>(source))->cookie(); + return m_client.did_request_cookie(url, static_cast<u8>(source)).cookie(); } void PageHost::page_did_set_cookie(const URL& url, const Web::Cookie::ParsedCookie& cookie, Web::Cookie::Source source) { - m_client.post_message(Messages::WebContentClient::DidSetCookie(url, cookie, static_cast<u8>(source))); + m_client.async_did_set_cookie(url, cookie, static_cast<u8>(source)); } } diff --git a/Userland/Services/WebContent/WebContentConsoleClient.cpp b/Userland/Services/WebContent/WebContentConsoleClient.cpp index 31e6a0188b..97fd46973d 100644 --- a/Userland/Services/WebContent/WebContentConsoleClient.cpp +++ b/Userland/Services/WebContent/WebContentConsoleClient.cpp @@ -51,12 +51,12 @@ void WebContentConsoleClient::handle_input(const String& js_source) void WebContentConsoleClient::print_html(const String& line) { - m_client.post_message(Messages::WebContentClient::DidJSConsoleOutput("html", line)); + m_client.async_did_jsconsole_output("html", line); } void WebContentConsoleClient::clear_output() { - m_client.post_message(Messages::WebContentClient::DidJSConsoleOutput("clear_output", {})); + m_client.async_did_jsconsole_output("clear_output", {}); } JS::Value WebContentConsoleClient::log() diff --git a/Userland/Services/WebSocket/ClientConnection.cpp b/Userland/Services/WebSocket/ClientConnection.cpp index 5c292aa591..ee9921697f 100644 --- a/Userland/Services/WebSocket/ClientConnection.cpp +++ b/Userland/Services/WebSocket/ClientConnection.cpp @@ -115,22 +115,22 @@ Messages::WebSocketServer::SetCertificateResponse ClientConnection::set_certific void ClientConnection::did_connect(i32 connection_id) { - post_message(Messages::WebSocketClient::Connected(connection_id)); + async_connected(connection_id); } void ClientConnection::did_receive_message(i32 connection_id, Message message) { - post_message(Messages::WebSocketClient::Received(connection_id, message.is_text(), message.data())); + async_received(connection_id, message.is_text(), message.data()); } void ClientConnection::did_error(i32 connection_id, i32 message) { - post_message(Messages::WebSocketClient::Errored(connection_id, message)); + async_errored(connection_id, message); } void ClientConnection::did_close(i32 connection_id, u16 code, String reason, bool was_clean) { - post_message(Messages::WebSocketClient::Closed(connection_id, code, reason, was_clean)); + async_closed(connection_id, code, reason, was_clean); deferred_invoke([this, connection_id] { m_connections.remove(connection_id); }); @@ -138,7 +138,7 @@ void ClientConnection::did_close(i32 connection_id, u16 code, String reason, boo void ClientConnection::did_request_certificates(i32 connection_id) { - post_message(Messages::WebSocketClient::CertificateRequested(connection_id)); + async_certificate_requested(connection_id); } } diff --git a/Userland/Services/WebSocket/ClientConnection.h b/Userland/Services/WebSocket/ClientConnection.h index 65720e2f99..41ef9b4fcf 100644 --- a/Userland/Services/WebSocket/ClientConnection.h +++ b/Userland/Services/WebSocket/ClientConnection.h @@ -15,8 +15,7 @@ namespace WebSocket { class ClientConnection final - : public IPC::ClientConnection<WebSocketClientEndpoint, WebSocketServerEndpoint> -{ + : public IPC::ClientConnection<WebSocketClientEndpoint, WebSocketServerEndpoint> { C_OBJECT(ClientConnection); public: diff --git a/Userland/Services/WindowServer/ClientConnection.cpp b/Userland/Services/WindowServer/ClientConnection.cpp index 9d3f9e5272..1878fe088b 100644 --- a/Userland/Services/WindowServer/ClientConnection.cpp +++ b/Userland/Services/WindowServer/ClientConnection.cpp @@ -78,7 +78,7 @@ void ClientConnection::die() void ClientConnection::notify_about_new_screen_rect(Gfx::IntRect const& rect) { - post_message(Messages::WindowClient::ScreenRectChanged(rect)); + async_screen_rect_changed(rect); } Messages::WindowServer::CreateMenubarResponse ClientConnection::create_menubar() @@ -278,10 +278,10 @@ void ClientConnection::set_window_opacity(i32 window_id, float opacity) it->value->set_opacity(opacity); } -void ClientConnection::async_set_wallpaper(String const& path) +void ClientConnection::set_wallpaper(String const& path) { Compositor::the().set_wallpaper(path, [&](bool success) { - post_message(Messages::WindowClient::AsyncSetWallpaperFinished(success)); + async_set_wallpaper_finished(success); }); } @@ -544,7 +544,7 @@ void ClientConnection::post_paint_message(Window& window, bool ignore_occlusion) if (window.is_minimized() || (!ignore_occlusion && window.is_occluded())) return; - post_message(Messages::WindowClient::Paint(window.window_id(), window.size(), rect_set.rects())); + async_paint(window.window_id(), window.size(), rect_set.rects()); } void ClientConnection::invalidate_rect(i32 window_id, Vector<Gfx::IntRect> const& rects, bool ignore_occlusion) @@ -755,7 +755,7 @@ void ClientConnection::notify_display_link(Badge<Compositor>) if (!m_has_display_link) return; - post_message(Messages::WindowClient::DisplayLinkNotification()); + async_display_link_notification(); } void ClientConnection::set_window_progress(i32 window_id, Optional<i32> const& progress) @@ -771,7 +771,7 @@ void ClientConnection::set_window_progress(i32 window_id, Optional<i32> const& p void ClientConnection::refresh_system_theme() { // Post the client an UpdateSystemTheme message to refresh its theme. - post_message(Messages::WindowClient::UpdateSystemTheme(Gfx::current_system_theme_buffer())); + async_update_system_theme(Gfx::current_system_theme_buffer()); } void ClientConnection::pong() @@ -847,7 +847,7 @@ void ClientConnection::set_unresponsive(bool unresponsive) void ClientConnection::may_have_become_unresponsive() { - post_message(Messages::WindowClient::Ping()); + async_ping(); m_ping_timer = Core::Timer::create_single_shot(1000, [this] { set_unresponsive(true); }); diff --git a/Userland/Services/WindowServer/ClientConnection.h b/Userland/Services/WindowServer/ClientConnection.h index 3d8a32a2a2..0fba35da8d 100644 --- a/Userland/Services/WindowServer/ClientConnection.h +++ b/Userland/Services/WindowServer/ClientConnection.h @@ -28,8 +28,7 @@ class Menubar; class WMClientConnection; class ClientConnection final - : public IPC::ClientConnection<WindowClientEndpoint, WindowServerEndpoint> -{ + : public IPC::ClientConnection<WindowClientEndpoint, WindowServerEndpoint> { C_OBJECT(ClientConnection) public: ~ClientConnection() override; @@ -120,7 +119,7 @@ private: virtual void move_window_to_front(i32) override; virtual void set_fullscreen(i32, bool) override; virtual void set_frameless(i32, bool) override; - virtual void async_set_wallpaper(String const&) override; + virtual void set_wallpaper(String const&) override; virtual void set_background_color(String const&) override; virtual void set_wallpaper_mode(String const&) override; virtual Messages::WindowServer::GetWallpaperResponse get_wallpaper() override; diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp index 3b05d96e08..7cd63ba4da 100644 --- a/Userland/Services/WindowServer/Menu.cpp +++ b/Userland/Services/WindowServer/Menu.cpp @@ -507,7 +507,7 @@ void Menu::did_activate(MenuItem& item, bool leave_menu_open) MenuManager::the().close_everyone(); if (m_client) - m_client->post_message(Messages::WindowClient::MenuItemActivated(m_menu_id, item.identifier())); + m_client->async_menu_item_activated(m_menu_id, item.identifier()); } bool Menu::activate_default() @@ -612,7 +612,7 @@ void Menu::set_visible(bool visible) return; menu_window()->set_visible(visible); if (m_client) - m_client->post_message(Messages::WindowClient::MenuVisibilityDidChange(m_menu_id, visible)); + m_client->async_menu_visibility_did_change(m_menu_id, visible); } void Menu::add_item(NonnullOwnPtr<MenuItem> item) @@ -637,13 +637,13 @@ void Menu::set_hovered_index(int index, bool make_input) return; if (auto* old_hovered_item = hovered_item()) { if (client()) - client()->post_message(Messages::WindowClient::MenuItemLeft(m_menu_id, old_hovered_item->identifier())); + client()->async_menu_item_left(m_menu_id, old_hovered_item->identifier()); } m_hovered_item_index = index; update_for_new_hovered_item(make_input); if (auto* new_hovered_item = hovered_item()) { if (client()) - client()->post_message(Messages::WindowClient::MenuItemEntered(m_menu_id, new_hovered_item->identifier())); + client()->async_menu_item_entered(m_menu_id, new_hovered_item->identifier()); } } diff --git a/Userland/Services/WindowServer/WMClientConnection.h b/Userland/Services/WindowServer/WMClientConnection.h index 1e7ff649fc..e29ac25760 100644 --- a/Userland/Services/WindowServer/WMClientConnection.h +++ b/Userland/Services/WindowServer/WMClientConnection.h @@ -15,8 +15,7 @@ namespace WindowServer { class WMClientConnection final - : public IPC::ClientConnection<WindowManagerClientEndpoint, WindowManagerServerEndpoint> -{ + : public IPC::ClientConnection<WindowManagerClientEndpoint, WindowManagerServerEndpoint> { C_OBJECT(WMClientConnection) public: diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp index c1e9c9dd7d..ac60a9ce1e 100644 --- a/Userland/Services/WindowServer/Window.cpp +++ b/Userland/Services/WindowServer/Window.cpp @@ -226,19 +226,19 @@ void Window::handle_mouse_event(const MouseEvent& event) switch (event.type()) { case Event::MouseMove: - m_client->post_message(Messages::WindowClient::MouseMove(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta(), event.is_drag(), event.mime_types())); + m_client->async_mouse_move(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta(), event.is_drag(), event.mime_types()); break; case Event::MouseDown: - m_client->post_message(Messages::WindowClient::MouseDown(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta())); + m_client->async_mouse_down(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta()); break; case Event::MouseDoubleClick: - m_client->post_message(Messages::WindowClient::MouseDoubleClick(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta())); + m_client->async_mouse_double_click(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta()); break; case Event::MouseUp: - m_client->post_message(Messages::WindowClient::MouseUp(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta())); + m_client->async_mouse_up(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta()); break; case Event::MouseWheel: - m_client->post_message(Messages::WindowClient::MouseWheel(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta())); + m_client->async_mouse_wheel(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta()); break; default: VERIFY_NOT_REACHED(); @@ -414,39 +414,38 @@ void Window::event(Core::Event& event) switch (event.type()) { case Event::WindowEntered: - m_client->post_message(Messages::WindowClient::WindowEntered(m_window_id)); + m_client->async_window_entered(m_window_id); break; case Event::WindowLeft: - m_client->post_message(Messages::WindowClient::WindowLeft(m_window_id)); + m_client->async_window_left(m_window_id); break; case Event::KeyDown: handle_keydown_event(static_cast<const KeyEvent&>(event)); break; case Event::KeyUp: - m_client->post_message( - Messages::WindowClient::KeyUp(m_window_id, - (u32) static_cast<const KeyEvent&>(event).code_point(), - (u32) static_cast<const KeyEvent&>(event).key(), - static_cast<const KeyEvent&>(event).modifiers(), - (u32) static_cast<const KeyEvent&>(event).scancode())); + m_client->async_key_up(m_window_id, + (u32) static_cast<const KeyEvent&>(event).code_point(), + (u32) static_cast<const KeyEvent&>(event).key(), + static_cast<const KeyEvent&>(event).modifiers(), + (u32) static_cast<const KeyEvent&>(event).scancode()); break; case Event::WindowActivated: - m_client->post_message(Messages::WindowClient::WindowActivated(m_window_id)); + m_client->async_window_activated(m_window_id); break; case Event::WindowDeactivated: - m_client->post_message(Messages::WindowClient::WindowDeactivated(m_window_id)); + m_client->async_window_deactivated(m_window_id); break; case Event::WindowInputEntered: - m_client->post_message(Messages::WindowClient::WindowInputEntered(m_window_id)); + m_client->async_window_input_entered(m_window_id); break; case Event::WindowInputLeft: - m_client->post_message(Messages::WindowClient::WindowInputLeft(m_window_id)); + m_client->async_window_input_left(m_window_id); break; case Event::WindowCloseRequest: - m_client->post_message(Messages::WindowClient::WindowCloseRequest(m_window_id)); + m_client->async_window_close_request(m_window_id); break; case Event::WindowResized: - m_client->post_message(Messages::WindowClient::WindowResized(m_window_id, static_cast<const ResizeEvent&>(event).rect())); + m_client->async_window_resized(m_window_id, static_cast<const ResizeEvent&>(event).rect()); break; default: break; @@ -471,7 +470,7 @@ void Window::handle_keydown_event(const KeyEvent& event) return; } } - m_client->post_message(Messages::WindowClient::KeyDown(m_window_id, (u32)event.code_point(), (u32)event.key(), event.modifiers(), (u32)event.scancode())); + m_client->async_key_down(m_window_id, (u32)event.code_point(), (u32)event.key(), event.modifiers(), (u32)event.scancode()); } void Window::set_global_cursor_tracking_enabled(bool enabled) @@ -556,7 +555,7 @@ bool Window::invalidate_no_notify(const Gfx::IntRect& rect, bool with_frame) void Window::refresh_client_size() { - client()->post_message(Messages::WindowClient::WindowResized(m_window_id, m_rect)); + client()->async_window_resized(m_window_id, m_rect); } void Window::prepare_dirty_rects() diff --git a/Userland/Services/WindowServer/WindowClient.ipc b/Userland/Services/WindowServer/WindowClient.ipc index ea8f49635d..2184c26daf 100644 --- a/Userland/Services/WindowServer/WindowClient.ipc +++ b/Userland/Services/WindowServer/WindowClient.ipc @@ -25,7 +25,7 @@ endpoint WindowClient ScreenRectChanged(Gfx::IntRect rect) =| - AsyncSetWallpaperFinished(bool success) =| + SetWallpaperFinished(bool success) =| DragAccepted() =| DragCancelled() =| diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index 1986507e2b..3354f58b41 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -269,7 +269,7 @@ void WindowManager::remove_window(Window& window) if (conn.window_id() < 0 || !(conn.event_mask() & WMEventMask::WindowRemovals)) return IterationDecision::Continue; if (!window.is_internal() && !window.is_modal()) - conn.post_message(Messages::WindowManagerClient::WindowRemoved(conn.window_id(), window.client_id(), window.window_id())); + conn.async_window_removed(conn.window_id(), window.client_id(), window.window_id()); return IterationDecision::Continue; }); } @@ -299,7 +299,7 @@ void WindowManager::tell_wm_about_window(WMClientConnection& conn, Window& windo if (window.is_internal()) return; auto* parent = window.parent_window(); - conn.post_message(Messages::WindowManagerClient::WindowStateChanged(conn.window_id(), window.client_id(), window.window_id(), parent ? parent->client_id() : -1, parent ? parent->window_id() : -1, window.is_active(), window.is_minimized(), window.is_modal_dont_unparent(), window.is_frameless(), (i32)window.type(), window.title(), window.rect(), window.progress())); + conn.async_window_state_changed(conn.window_id(), window.client_id(), window.window_id(), parent ? parent->client_id() : -1, parent ? parent->window_id() : -1, window.is_active(), window.is_minimized(), window.is_modal_dont_unparent(), window.is_frameless(), (i32)window.type(), window.title(), window.rect(), window.progress()); } void WindowManager::tell_wm_about_window_rect(WMClientConnection& conn, Window& window) @@ -310,7 +310,7 @@ void WindowManager::tell_wm_about_window_rect(WMClientConnection& conn, Window& return; if (window.is_internal()) return; - conn.post_message(Messages::WindowManagerClient::WindowRectChanged(conn.window_id(), window.client_id(), window.window_id(), window.rect())); + conn.async_window_rect_changed(conn.window_id(), window.client_id(), window.window_id(), window.rect()); } void WindowManager::tell_wm_about_window_icon(WMClientConnection& conn, Window& window) @@ -321,7 +321,7 @@ void WindowManager::tell_wm_about_window_icon(WMClientConnection& conn, Window& return; if (window.is_internal()) return; - conn.post_message(Messages::WindowManagerClient::WindowIconBitmapChanged(conn.window_id(), window.client_id(), window.window_id(), window.icon().to_shareable_bitmap())); + conn.async_window_icon_bitmap_changed(conn.window_id(), window.client_id(), window.window_id(), window.icon().to_shareable_bitmap()); } void WindowManager::tell_wms_window_state_changed(Window& window) @@ -354,7 +354,7 @@ void WindowManager::tell_wms_applet_area_size_changed(const Gfx::IntSize& size) if (conn.window_id() < 0) return IterationDecision::Continue; - conn.post_message(Messages::WindowManagerClient::AppletAreaSizeChanged(conn.window_id(), size)); + conn.async_applet_area_size_changed(conn.window_id(), size); return IterationDecision::Continue; }); } @@ -365,7 +365,7 @@ void WindowManager::tell_wms_super_key_pressed() if (conn.window_id() < 0) return IterationDecision::Continue; - conn.post_message(Messages::WindowManagerClient::SuperKeyPressed(conn.window_id())); + conn.async_super_key_pressed(conn.window_id()); return IterationDecision::Continue; }); } @@ -427,7 +427,7 @@ void WindowManager::notify_minimization_state_changed(Window& window) tell_wms_window_state_changed(window); if (window.client()) - window.client()->post_message(Messages::WindowClient::WindowStateChanged(window.window_id(), window.is_minimized(), window.is_occluded())); + window.client()->async_window_state_changed(window.window_id(), window.is_minimized(), window.is_occluded()); if (window.is_active() && window.is_minimized()) pick_new_active_window(&window); @@ -436,7 +436,7 @@ void WindowManager::notify_minimization_state_changed(Window& window) void WindowManager::notify_occlusion_state_changed(Window& window) { if (window.client()) - window.client()->post_message(Messages::WindowClient::WindowStateChanged(window.window_id(), window.is_minimized(), window.is_occluded())); + window.client()->async_window_state_changed(window.window_id(), window.is_minimized(), window.is_occluded()); } void WindowManager::notify_progress_changed(Window& window) @@ -769,13 +769,13 @@ bool WindowManager::process_ongoing_drag(MouseEvent& event, Window*& hovered_win }); if (hovered_window) { - m_dnd_client->post_message(Messages::WindowClient::DragAccepted()); + m_dnd_client->async_drag_accepted(); if (hovered_window->client()) { auto translated_event = event.translated(-hovered_window->position()); - hovered_window->client()->post_message(Messages::WindowClient::DragDropped(hovered_window->window_id(), translated_event.position(), m_dnd_text, m_dnd_mime_data->all_data())); + hovered_window->client()->async_drag_dropped(hovered_window->window_id(), translated_event.position(), m_dnd_text, m_dnd_mime_data->all_data()); } } else { - m_dnd_client->post_message(Messages::WindowClient::DragCancelled()); + m_dnd_client->async_drag_cancelled(); } end_dnd_drag(); @@ -1190,11 +1190,11 @@ void WindowManager::event(Core::Event& event) // Escape key cancels an ongoing drag. if (key_event.type() == Event::KeyDown && key_event.key() == Key_Escape && m_dnd_client) { // Notify the drag-n-drop client that the drag was cancelled. - m_dnd_client->post_message(Messages::WindowClient::DragCancelled()); + m_dnd_client->async_drag_cancelled(); // Also notify the currently hovered window (if any) that the ongoing drag was cancelled. if (m_hovered_window && m_hovered_window->client() && m_hovered_window->client() != m_dnd_client) - m_hovered_window->client()->post_message(Messages::WindowClient::DragCancelled()); + m_hovered_window->client()->async_drag_cancelled(); end_dnd_drag(); return; @@ -1538,7 +1538,7 @@ bool WindowManager::update_theme(String theme_path, String theme_name) for_each_window([&](Window& window) { if (window.client()) { if (!notified_clients.contains(window.client())) { - window.client()->post_message(Messages::WindowClient::UpdateSystemTheme(Gfx::current_system_theme_buffer())); + window.client()->async_update_system_theme(Gfx::current_system_theme_buffer()); notified_clients.set(window.client()); } } diff --git a/Userland/Services/WindowServer/WindowServer.ipc b/Userland/Services/WindowServer/WindowServer.ipc index 5f514268dd..c8268efd82 100644 --- a/Userland/Services/WindowServer/WindowServer.ipc +++ b/Userland/Services/WindowServer/WindowServer.ipc @@ -88,7 +88,7 @@ endpoint WindowServer PopupMenu(i32 menu_id, Gfx::IntPoint screen_position) => () DismissMenu(i32 menu_id) => () - AsyncSetWallpaper(String path) =| + SetWallpaper(String path) =| SetBackgroundColor(String background_color) => () SetWallpaperMode(String mode) => () diff --git a/Userland/Utilities/chres.cpp b/Userland/Utilities/chres.cpp index 82374c88a8..cb4617bf3c 100644 --- a/Userland/Utilities/chres.cpp +++ b/Userland/Utilities/chres.cpp @@ -24,8 +24,8 @@ int main(int argc, char** argv) // A Core::EventLoop is all we need, but WindowServerConnection needs a full Application object. char* dummy_argv[] = { argv[0] }; auto app = GUI::Application::construct(1, dummy_argv); - auto result = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetResolution>(Gfx::IntSize { width, height }, scale); - if (!result->success()) { + auto result = GUI::WindowServerConnection::the().set_resolution(Gfx::IntSize { width, height }, scale); + if (!result.success()) { warnln("failed to set resolution"); return 1; } diff --git a/Userland/Utilities/shot.cpp b/Userland/Utilities/shot.cpp index 2f0a77deb4..82f4f0d071 100644 --- a/Userland/Utilities/shot.cpp +++ b/Userland/Utilities/shot.cpp @@ -34,9 +34,9 @@ int main(int argc, char** argv) auto app = GUI::Application::construct(argc, argv); sleep(delay); - auto response = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::GetScreenBitmap>(); + auto response = GUI::WindowServerConnection::the().get_screen_bitmap(); - auto* bitmap = response->bitmap().bitmap(); + auto* bitmap = response.bitmap().bitmap(); if (!bitmap) { warnln("Failed to grab screenshot"); return 1; |