1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:57:42 +00:00

Userland: Update IPC calls to use proxies

This updates all existing code to use the auto-generated client
methods instead of post_message/send_sync.
This commit is contained in:
Gunnar Beutner 2021-05-03 13:33:59 +02:00 committed by Andreas Kling
parent 78803ce384
commit 5bb79ea0a7
63 changed files with 303 additions and 316 deletions

View file

@ -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()) { 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()); auto result = GUI::WindowServerConnection::the().set_resolution(m_monitor_widget->desktop_resolution(), m_monitor_widget->desktop_scale_factor());
if (!result->success()) { if (!result.success()) {
GUI::MessageBox::show(nullptr, String::formatted("Reverting to resolution {}x{} @ {}x", result->resolution().width(), result->resolution().height(), result->scale_factor()), 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); "Unable to set resolution", GUI::MessageBox::Type::Error);
} else { } else {
auto box = GUI::MessageBox::construct(window(), String::formatted("Do you want to keep the new settings? They will be reverted after 10 seconds."), 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 the user selects "No", closes the window or the window gets closed by the 10 seconds timer, revert the changes.
if (box->exec() != GUI::MessageBox::ExecYes) { if (box->exec() != GUI::MessageBox::ExecYes) {
result = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetResolution>(current_resolution, current_scale_factor); result = GUI::WindowServerConnection::the().set_resolution(current_resolution, current_scale_factor);
if (!result->success()) { if (!result.success()) {
GUI::MessageBox::show(nullptr, String::formatted("Reverting to resolution {}x{} @ {}x", result->resolution().width(), result->resolution().height(), result->scale_factor()), 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); "Unable to set resolution", GUI::MessageBox::Type::Error);
} }
} }

View file

@ -24,9 +24,9 @@ constexpr int double_click_speed_default = 250;
void MouseSettingsWindow::update_window_server() void MouseSettingsWindow::update_window_server()
{ {
const float factor = m_speed_slider->value() / speed_slider_scale; const float factor = m_speed_slider->value() / speed_slider_scale;
GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetMouseAcceleration>(factor); GUI::WindowServerConnection::the().set_mouse_acceleration(factor);
GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetScrollStepSize>(m_scroll_length_spinbox->value()); GUI::WindowServerConnection::the().set_scroll_step_size(m_scroll_length_spinbox->value());
GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetDoubleClickSpeed>(m_double_click_speed_slider->value()); GUI::WindowServerConnection::the().set_double_click_speed(m_double_click_speed_slider->value());
} }
void MouseSettingsWindow::reset_default_values() void MouseSettingsWindow::reset_default_values()
@ -48,12 +48,12 @@ MouseSettingsWindow::MouseSettingsWindow()
m_speed_slider->on_change = [&](const int value) { m_speed_slider->on_change = [&](const int value) {
m_speed_label->set_text(String::formatted("{} %", 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_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 = *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_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_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"); 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_slider->on_change = [&](const int value) {
m_double_click_speed_label->set_text(String::formatted("{} ms", 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 = *main_widget.find_descendant_of_type_named<GUI::Button>("ok_button");
m_ok_button->on_click = [this](auto) { m_ok_button->on_click = [this](auto) {

View file

@ -316,7 +316,7 @@ void TreeMapWidget::mousewheel_event(GUI::MouseEvent& event)
{ {
int delta = event.wheel_delta(); int delta = event.wheel_delta();
// FIXME: The wheel_delta is premultiplied in the window server, we actually want a raw value here. // 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) { if (delta > 0) {
size_t step_back = delta / step_size; size_t step_back = delta / step_size;
if (step_back > m_viewpoint) if (step_back > m_viewpoint)

View file

@ -134,7 +134,7 @@ public:
VERIFY(window_id >= 0); VERIFY(window_id >= 0);
set_global_cursor_tracking(true); 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(); } void start_the_timer() { m_timer.start(); }

View file

@ -22,7 +22,7 @@ void EyesWidget::track_cursor_globally()
VERIFY(window_id >= 0); VERIFY(window_id >= 0);
set_global_cursor_tracking(true); 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) void EyesWidget::mousemove_event(GUI::MouseEvent& event)

View file

@ -43,14 +43,14 @@ void LanguageClient::open_file(const String& path, int fd)
{ {
if (!m_connection_wrapper.connection()) if (!m_connection_wrapper.connection())
return; 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) void LanguageClient::set_file_content(const String& path, const String& content)
{ {
if (!m_connection_wrapper.connection()) if (!m_connection_wrapper.connection())
return; 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) 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()) if (!m_connection_wrapper.connection())
return; return;
// set_active_client(); // 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) 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()) if (!m_connection_wrapper.connection())
return; 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) 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()) if (!m_connection_wrapper.connection())
return; return;
set_active_client(); 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 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()) if (!m_connection_wrapper.connection())
return; 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() 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()) if (!m_connection_wrapper.connection())
return; return;
set_active_client(); 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 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) { project().for_each_text_file([this](const ProjectFile& file) {
if (file.code_document().language() != m_language) if (file.code_document().language() != m_language)
return; 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());
}); });
} }

View file

@ -38,7 +38,7 @@ public:
virtual void handshake() override 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; } WeakPtr<LanguageClient> language_client() { return m_current_language_client; }

View file

@ -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) }; 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); 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) 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); 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) 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));
} }
} }

View file

@ -19,8 +19,7 @@
namespace LanguageServers { namespace LanguageServers {
class ClientConnection class ClientConnection
: public IPC::ClientConnection<LanguageClientEndpoint, LanguageServerEndpoint> : public IPC::ClientConnection<LanguageClientEndpoint, LanguageServerEndpoint> {
{
public: public:
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id); explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
~ClientConnection() override; ~ClientConnection() override;

View file

@ -254,9 +254,9 @@ int main(int argc, char** argv)
#include <LibIPC/Decoder.h> #include <LibIPC/Decoder.h>
#include <LibIPC/Dictionary.h> #include <LibIPC/Dictionary.h>
#include <LibIPC/Encoder.h> #include <LibIPC/Encoder.h>
#include <LibIPC/Stub.h>
#include <LibIPC/File.h> #include <LibIPC/File.h>
#include <LibIPC/Message.h> #include <LibIPC/Message.h>
#include <LibIPC/Stub.h>
)~~~"); )~~~");
for (auto& endpoint : endpoints) { for (auto& endpoint : endpoints) {

View file

@ -16,14 +16,14 @@ ClientConnection::ClientConnection()
void ClientConnection::handshake() void ClientConnection::handshake()
{ {
send_sync<Messages::AudioServer::Greet>(); greet();
} }
void ClientConnection::enqueue(const Buffer& buffer) void ClientConnection::enqueue(const Buffer& buffer)
{ {
for (;;) { for (;;) {
auto response = send_sync<Messages::AudioServer::EnqueueBuffer>(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count()); auto response = enqueue_buffer(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count());
if (response->success()) if (response.success())
break; break;
sleep(1); sleep(1);
} }
@ -31,53 +31,53 @@ void ClientConnection::enqueue(const Buffer& buffer)
bool ClientConnection::try_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()); auto response = enqueue_buffer(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count());
return response->success(); return response.success();
} }
bool ClientConnection::get_muted() bool ClientConnection::get_muted()
{ {
return send_sync<Messages::AudioServer::GetMuted>()->muted(); return IPCProxy::get_muted().muted();
} }
void ClientConnection::set_muted(bool muted) void ClientConnection::set_muted(bool muted)
{ {
send_sync<Messages::AudioServer::SetMuted>(muted); IPCProxy::set_muted(muted);
} }
int ClientConnection::get_main_mix_volume() 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) 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() 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() 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) void ClientConnection::set_paused(bool paused)
{ {
send_sync<Messages::AudioServer::SetPaused>(paused); IPCProxy::set_paused(paused);
} }
void ClientConnection::clear_buffer(bool paused) void ClientConnection::clear_buffer(bool paused)
{ {
send_sync<Messages::AudioServer::ClearBuffer>(paused); IPCProxy::clear_buffer(paused);
} }
int ClientConnection::get_playing_buffer() 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) void ClientConnection::finished_playing_buffer(i32 buffer_id)

View file

@ -40,7 +40,7 @@ class LaunchServerConnection : public IPC::ServerConnection<LaunchClientEndpoint
public: public:
virtual void handshake() override virtual void handshake() override
{ {
send_sync<Messages::LaunchServer::Greet>(); greet();
} }
private: private:
@ -99,7 +99,7 @@ bool Launcher::seal_allowlist()
bool Launcher::open(const URL& url, const String& handler_name) 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) 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) 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 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; NonnullRefPtrVector<Details> handlers_with_details;
for (auto& value : details) { for (auto& value : details) {
handlers_with_details.append(Details::from_details_str(value)); handlers_with_details.append(Details::from_details_str(value));

View file

@ -186,7 +186,7 @@ void Application::tooltip_show_timer_did_fire()
Gfx::IntRect desktop_rect = Desktop::the().rect(); Gfx::IntRect desktop_rect = Desktop::the().rect();
const int margin = 30; const int margin = 30;
Gfx::IntPoint adjusted_pos = WindowServerConnection::the().send_sync<Messages::WindowServer::GetGlobalCursorPosition>()->position(); Gfx::IntPoint adjusted_pos = WindowServerConnection::the().get_global_cursor_position().position();
adjusted_pos.translate_by(0, 18); adjusted_pos.translate_by(0, 18);

View file

@ -19,7 +19,7 @@ class ClipboardServerConnection : public IPC::ServerConnection<ClipboardClientEn
public: public:
virtual void handshake() override virtual void handshake() override
{ {
send_sync<Messages::ClipboardServer::Greet>(); greet();
} }
private: private:
@ -56,12 +56,12 @@ Clipboard::Clipboard()
Clipboard::DataAndType Clipboard::data_and_type() const Clipboard::DataAndType Clipboard::data_and_type() const
{ {
auto response = connection().send_sync<Messages::ClipboardServer::GetClipboardData>(); auto response = connection().get_clipboard_data();
if (!response->data().is_valid()) if (!response.data().is_valid())
return {}; return {};
auto data = ByteBuffer::copy(response->data().data<void>(), response->data().size()); auto data = ByteBuffer::copy(response.data().data<void>(), response.data().size());
auto type = response->mime_type(); auto type = response.mime_type();
auto metadata = response->metadata().entries(); auto metadata = response.metadata().entries();
return { data, type, metadata }; return { data, type, metadata };
} }
@ -75,7 +75,7 @@ void Clipboard::set_data(ReadonlyBytes data, const String& type, const HashMap<S
if (!data.is_empty()) if (!data.is_empty())
memcpy(buffer.data<void>(), data.data(), data.size()); 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) void ClipboardServerConnection::clipboard_data_changed(String const& mime_type)

View file

@ -34,18 +34,18 @@ void Desktop::did_receive_screen_rect(Badge<WindowServerConnection>, const Gfx::
void Desktop::set_background_color(const StringView& background_color) 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) 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) bool Desktop::set_wallpaper(const StringView& path, bool save_config)
{ {
WindowServerConnection::the().post_message(Messages::WindowServer::AsyncSetWallpaper(path)); WindowServerConnection::the().async_set_wallpaper(path);
auto ret_val = WindowServerConnection::the().wait_for_specific_message<Messages::WindowClient::AsyncSetWallpaperFinished>()->success(); auto ret_val = WindowServerConnection::the().wait_for_specific_message<Messages::WindowClient::SetWallpaperFinished>()->success();
if (ret_val && save_config) { if (ret_val && save_config) {
RefPtr<Core::ConfigFile> config = Core::ConfigFile::get_for_app("WindowManager"); 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 String Desktop::wallpaper() const
{ {
return WindowServerConnection::the().send_sync<Messages::WindowServer::GetWallpaper>()->path(); return WindowServerConnection::the().get_wallpaper().path();
} }
} }

View file

@ -43,7 +43,7 @@ static i32 s_next_callback_id = 1;
i32 DisplayLink::register_callback(Function<void(i32)> callback) i32 DisplayLink::register_callback(Function<void(i32)> callback)
{ {
if (callbacks().is_empty()) if (callbacks().is_empty())
WindowServerConnection::the().post_message(Messages::WindowServer::EnableDisplayLink()); WindowServerConnection::the().async_enable_display_link();
i32 callback_id = s_next_callback_id++; i32 callback_id = s_next_callback_id++;
callbacks().set(callback_id, adopt_ref(*new DisplayLinkCallback(callback_id, move(callback)))); callbacks().set(callback_id, adopt_ref(*new DisplayLinkCallback(callback_id, move(callback))));
@ -57,7 +57,7 @@ bool DisplayLink::unregister_callback(i32 callback_id)
callbacks().remove(callback_id); callbacks().remove(callback_id);
if (callbacks().is_empty()) if (callbacks().is_empty())
WindowServerConnection::the().post_message(Messages::WindowServer::DisableDisplayLink()); WindowServerConnection::the().async_disable_display_link();
return true; return true;
} }

View file

@ -37,12 +37,12 @@ DragOperation::Outcome DragOperation::exec()
drag_bitmap = bitmap->to_shareable_bitmap(); 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->text(),
m_mime_data->all_data(), m_mime_data->all_data(),
drag_bitmap); drag_bitmap);
if (!response->started()) { if (!response.started()) {
m_outcome = Outcome::Cancelled; m_outcome = Outcome::Cancelled;
return m_outcome; return m_outcome;
} }

View file

@ -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) void Menu::popup(const Gfx::IntPoint& screen_position, const RefPtr<Action>& default_action)
{ {
realize_if_needed(default_action); realize_if_needed(default_action);
WindowServerConnection::the().post_message(Messages::WindowServer::PopupMenu(m_menu_id, screen_position)); WindowServerConnection::the().async_popup_menu(m_menu_id, screen_position);
} }
void Menu::dismiss() void Menu::dismiss()
{ {
if (m_menu_id == -1) if (m_menu_id == -1)
return; return;
WindowServerConnection::the().post_message(Messages::WindowServer::DismissMenu(m_menu_id)); WindowServerConnection::the().async_dismiss_menu(m_menu_id);
} }
int Menu::realize_menu(RefPtr<Action> default_action) int Menu::realize_menu(RefPtr<Action> default_action)
{ {
unrealize_menu(); 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); dbgln_if(MENU_DEBUG, "GUI::Menu::realize_menu(): New menu ID: {}", m_menu_id);
VERIFY(m_menu_id > 0); 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_menu_id({}, m_menu_id);
item.set_identifier({}, i); item.set_identifier({}, i);
if (item.type() == MenuItem::Type::Separator) { 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; continue;
} }
if (item.type() == MenuItem::Type::Submenu) { if (item.type() == MenuItem::Type::Submenu) {
auto& submenu = *item.submenu(); auto& submenu = *item.submenu();
submenu.realize_if_needed(default_action); submenu.realize_if_needed(default_action);
auto icon = submenu.icon() ? submenu.icon()->to_shareable_bitmap() : Gfx::ShareableBitmap(); 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; continue;
} }
if (item.type() == MenuItem::Type::Action) { 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 exclusive = action.group() && action.group()->is_exclusive() && action.is_checkable();
bool is_default = (default_action.ptr() == &action); bool is_default = (default_action.ptr() == &action);
auto icon = action.icon() ? action.icon()->to_shareable_bitmap() : Gfx::ShareableBitmap(); auto icon = action.icon() ? action.icon()->to_shareable_bitmap() : Gfx::ShareableBitmap();
WindowServerConnection::the().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); all_menus().set(m_menu_id, this);
@ -123,7 +123,7 @@ void Menu::unrealize_menu()
if (m_menu_id == -1) if (m_menu_id == -1)
return; return;
all_menus().remove(m_menu_id); all_menus().remove(m_menu_id);
WindowServerConnection::the().send_sync<Messages::WindowServer::DestroyMenu>(m_menu_id); WindowServerConnection::the().destroy_menu(m_menu_id);
m_menu_id = -1; m_menu_id = -1;
} }

View file

@ -74,7 +74,7 @@ void MenuItem::update_window_server()
return; return;
auto& action = *m_action; auto& action = *m_action;
auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_string() : String(); auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_string() : String();
WindowServerConnection::the().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) void MenuItem::set_menu_id(Badge<Menu>, unsigned int menu_id)

View file

@ -30,14 +30,14 @@ Menu& Menubar::add_menu(String name)
int Menubar::realize_menubar() 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() void Menubar::unrealize_menubar()
{ {
if (m_menubar_id == -1) if (m_menubar_id == -1)
return; return;
WindowServerConnection::the().send_sync<Messages::WindowServer::DestroyMenubar>(m_menubar_id); WindowServerConnection::the().destroy_menubar(m_menubar_id);
m_menubar_id = -1; m_menubar_id = -1;
} }
@ -49,7 +49,7 @@ void Menubar::notify_added_to_window(Badge<Window>)
for (auto& menu : m_menus) { for (auto& menu : m_menus) {
int menu_id = menu.realize_menu(); int menu_id = menu.realize_menu();
VERIFY(menu_id != -1); 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);
} }
} }

View file

@ -20,7 +20,7 @@ class NotificationServerConnection : public IPC::ServerConnection<NotificationCl
public: public:
virtual void handshake() override virtual void handshake() override
{ {
send_sync<Messages::NotificationServer::Greet>(); greet();
} }
virtual void die() override virtual void die() override
@ -51,7 +51,7 @@ void Notification::show()
VERIFY(!m_shown && !m_destroyed); VERIFY(!m_shown && !m_destroyed);
auto icon = m_icon ? m_icon->to_shareable_bitmap() : Gfx::ShareableBitmap(); auto icon = m_icon ? m_icon->to_shareable_bitmap() : Gfx::ShareableBitmap();
m_connection = NotificationServerConnection::construct(this); 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; m_shown = true;
} }
@ -59,7 +59,7 @@ void Notification::close()
{ {
VERIFY(m_shown); VERIFY(m_shown);
if (!m_destroyed) { if (!m_destroyed) {
m_connection->send_sync<Messages::NotificationServer::CloseNotification>(); m_connection->close_notification();
connection_closed(); connection_closed();
return; return;
} }
@ -73,13 +73,13 @@ bool Notification::update()
} }
if (m_text_dirty || m_title_dirty) { 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_text_dirty = false;
m_title_dirty = false; m_title_dirty = false;
} }
if (m_icon_dirty) { 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; m_icon_dirty = false;
} }

View file

@ -109,7 +109,7 @@ void Window::move_to_front()
if (!is_visible()) if (!is_visible())
return; return;
WindowServerConnection::the().send_sync<Messages::WindowServer::MoveWindowToFront>(m_window_id); WindowServerConnection::the().move_window_to_front(m_window_id);
} }
void Window::show() void Window::show()
@ -119,7 +119,7 @@ void Window::show()
auto* parent_window = find_parent_window(); 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_rect_when_windowless,
!m_moved_by_client, !m_moved_by_client,
m_has_alpha_channel, m_has_alpha_channel,
@ -138,7 +138,7 @@ void Window::show()
(i32)m_window_type, (i32)m_window_type,
m_title_when_windowless, m_title_when_windowless,
parent_window ? parent_window->window_id() : 0); parent_window ? parent_window->window_id() : 0);
m_window_id = response->window_id(); m_window_id = response.window_id();
m_visible = true; m_visible = true;
apply_icon(); apply_icon();
@ -178,10 +178,10 @@ void Window::hide()
{ {
if (!is_visible()) if (!is_visible())
return; 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(); 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)) { if (auto* window = Window::from_window_id(child_window_id)) {
window->server_did_destroy(); window->server_did_destroy();
} }
@ -205,27 +205,27 @@ void Window::set_title(String title)
m_title_when_windowless = move(title); m_title_when_windowless = move(title);
if (!is_visible()) if (!is_visible())
return; return;
WindowServerConnection::the().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 String Window::title() const
{ {
if (!is_visible()) if (!is_visible())
return m_title_when_windowless; 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 Gfx::IntRect Window::applet_rect_on_screen() const
{ {
VERIFY(m_window_type == WindowType::Applet); 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 Gfx::IntRect Window::rect() const
{ {
if (!is_visible()) if (!is_visible())
return m_rect_when_windowless; 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) 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()); m_main_widget->resize(m_rect_when_windowless.size());
return; 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()) if (m_back_store && m_back_store->size() != window_rect.size())
m_back_store = nullptr; m_back_store = nullptr;
if (m_front_store && m_front_store->size() != window_rect.size()) if (m_front_store && m_front_store->size() != window_rect.size())
@ -254,7 +254,7 @@ Gfx::IntSize Window::minimum_size() const
if (!is_visible()) if (!is_visible())
return m_minimum_size_when_windowless; return m_minimum_size_when_windowless;
return WindowServerConnection::the().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) 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; m_minimum_size_when_windowless = size;
if (is_visible()) 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() 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) void Window::make_window_manager(unsigned event_mask)
{ {
GUI::WindowManagerServerConnection::the() GUI::WindowManagerServerConnection::the().async_set_event_mask(event_mask);
.post_message(Messages::WindowManagerServer::SetEventMask(event_mask)); GUI::WindowManagerServerConnection::the().async_set_manager_window(m_window_id);
GUI::WindowManagerServerConnection::the()
.post_message(Messages::WindowManagerServer::SetManagerWindow(m_window_id));
} }
void Window::set_cursor(Gfx::StandardCursor cursor) 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); set_current_backing_store(*m_back_store, true);
if (is_visible()) 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) void Window::handle_key_event(KeyEvent& event)
@ -599,7 +597,7 @@ void Window::force_update()
if (!is_visible()) if (!is_visible())
return; return;
auto rect = this->rect(); 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) 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); auto rects = move(m_pending_paint_event_rects);
if (rects.is_empty()) if (rects.is_empty())
return; 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); 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_back_store = nullptr;
m_front_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(); update();
} }
@ -713,7 +711,7 @@ void Window::set_opacity(float opacity)
m_opacity_when_windowless = opacity; m_opacity_when_windowless = opacity;
if (!is_visible()) if (!is_visible())
return; return;
WindowServerConnection::the().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) 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; m_alpha_hit_threshold = threshold;
if (!is_visible()) if (!is_visible())
return; 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) 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) void Window::set_current_backing_store(WindowBackingStore& backing_store, bool flush_immediately)
{ {
auto& bitmap = backing_store.bitmap(); 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) void Window::flip(const Vector<Gfx::IntRect, 32>& dirty_rects)
@ -832,12 +830,12 @@ void Window::apply_icon()
if (!is_visible()) if (!is_visible())
return; 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() 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 Vector<Widget*> Window::focusable_widgets(FocusSource source) const
@ -888,7 +886,7 @@ void Window::set_fullscreen(bool fullscreen)
m_fullscreen = fullscreen; m_fullscreen = fullscreen;
if (!is_visible()) if (!is_visible())
return; 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) void Window::set_frameless(bool frameless)
@ -898,7 +896,7 @@ void Window::set_frameless(bool frameless)
m_frameless = frameless; m_frameless = frameless;
if (!is_visible()) if (!is_visible())
return; 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 bool Window::is_maximized() const
@ -906,7 +904,7 @@ bool Window::is_maximized() const
if (!is_visible()) if (!is_visible())
return false; 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() void Window::schedule_relayout()
@ -924,7 +922,7 @@ void Window::schedule_relayout()
void Window::refresh_system_theme() 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) 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; return;
m_base_size = base_size; m_base_size = base_size;
if (is_visible()) 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) 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; return;
m_size_increment = size_increment; m_size_increment = size_increment;
if (is_visible()) 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) 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; m_resize_aspect_ratio = ratio;
if (is_visible()) 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&) 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) void Window::set_progress(Optional<int> progress)
{ {
VERIFY(m_window_id); 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() void Window::update_cursor()
@ -1041,9 +1039,9 @@ void Window::update_cursor()
m_effective_cursor = new_cursor; m_effective_cursor = new_cursor;
if (m_custom_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 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) void Window::focus_a_widget_if_possible(FocusSource source)
@ -1078,7 +1076,7 @@ void Window::set_menubar(RefPtr<Menubar> menubar)
m_menubar = move(menubar); m_menubar = move(menubar);
if (m_window_id && m_menubar) { if (m_window_id && m_menubar) {
m_menubar->notify_added_to_window({}); 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) if (!m_window_id)
return false; 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) void Window::set_modified(bool modified)
{ {
if (!m_window_id) if (!m_window_id)
return; return;
WindowServerConnection::the().post_message(Messages::WindowServer::SetWindowModified(m_window_id, modified)); WindowServerConnection::the().async_set_window_modified(m_window_id, modified);
} }
} }

View file

@ -42,9 +42,9 @@ static void set_system_theme_from_anonymous_buffer(Core::AnonymousBuffer buffer)
void WindowServerConnection::handshake() void WindowServerConnection::handshake()
{ {
auto response = send_sync<Messages::WindowServer::Greet>(); auto response = greet();
set_system_theme_from_anonymous_buffer(response->theme_buffer()); set_system_theme_from_anonymous_buffer(response.theme_buffer());
Desktop::the().did_receive_screen_rect({}, response->screen_rect()); Desktop::the().did_receive_screen_rect({}, response.screen_rect());
} }
void WindowServerConnection::update_system_theme(Core::AnonymousBuffer const& theme_buffer) 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(). // This is handled manually by Desktop::set_wallpaper().
} }
@ -337,7 +337,7 @@ void WindowServerConnection::display_link_notification()
void WindowServerConnection::ping() void WindowServerConnection::ping()
{ {
post_message(Messages::WindowServer::Pong()); async_pong();
} }
} }

View file

@ -48,7 +48,7 @@ private:
virtual void menu_item_left(i32, u32) override; virtual void menu_item_left(i32, u32) override;
virtual void menu_visibility_did_change(i32, bool) override; virtual void menu_visibility_did_change(i32, bool) override;
virtual void screen_rect_changed(Gfx::IntRect const&) 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_dropped(i32, Gfx::IntPoint const&, String const&, HashMap<String, ByteBuffer> const&) override;
virtual void drag_accepted() override; virtual void drag_accepted() override;
virtual void drag_cancelled() override; virtual void drag_cancelled() override;

View file

@ -17,13 +17,16 @@ NonnullRefPtr<T> new_client_connection(Args&&... args)
} }
template<typename ClientEndpoint, typename ServerEndpoint> 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: public:
using ClientProxy = typename ClientEndpoint::Proxy;
using ServerStub = typename ServerEndpoint::Stub; using ServerStub = typename ServerEndpoint::Stub;
using IPCProxy = ClientEndpoint::template Proxy<ServerEndpoint>;
ClientConnection(ServerStub& stub, NonnullRefPtr<Core::LocalSocket> socket, int client_id) ClientConnection(ServerStub& stub, NonnullRefPtr<Core::LocalSocket> socket, int client_id)
: IPC::Connection<ServerEndpoint, ClientEndpoint>(stub, move(socket)) : IPC::Connection<ServerEndpoint, ClientEndpoint>(stub, move(socket))
, ClientEndpoint::template Proxy<ServerEndpoint>(*this, {})
, m_client_id(client_id) , m_client_id(client_id)
{ {
VERIFY(this->socket().is_connected()); VERIFY(this->socket().is_connected());

View file

@ -29,7 +29,6 @@ template<typename LocalEndpoint, typename PeerEndpoint>
class Connection : public Core::Object { class Connection : public Core::Object {
public: public:
using LocalStub = typename LocalEndpoint::Stub; using LocalStub = typename LocalEndpoint::Stub;
using PeerProxy = typename PeerEndpoint::Proxy;
Connection(LocalStub& local_stub, NonnullRefPtr<Core::LocalSocket> socket) Connection(LocalStub& local_stub, NonnullRefPtr<Core::LocalSocket> socket)
: m_local_stub(local_stub) : m_local_stub(local_stub)

View file

@ -11,13 +11,16 @@
namespace IPC { namespace IPC {
template<typename ClientEndpoint, typename ServerEndpoint> 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: public:
using ClientStub = typename ClientEndpoint::Stub; using ClientStub = typename ClientEndpoint::Stub;
using ServerProxy = typename ServerEndpoint::Proxy; using IPCProxy = ServerEndpoint::template Proxy<ClientEndpoint>;
ServerConnection(ClientStub& local_endpoint, const StringView& address) ServerConnection(ClientStub& local_endpoint, const StringView& address)
: Connection<ClientEndpoint, ServerEndpoint>(local_endpoint, Core::LocalSocket::construct()) : Connection<ClientEndpoint, ServerEndpoint>(local_endpoint, Core::LocalSocket::construct())
, ServerEndpoint::template Proxy<ClientEndpoint>(*this, {})
{ {
// We want to rate-limit our clients // We want to rate-limit our clients
this->socket().set_blocking(true); this->socket().set_blocking(true);

View file

@ -23,7 +23,7 @@ void Client::die()
void Client::handshake() void Client::handshake()
{ {
send_sync<Messages::ImageDecoderServer::Greet>(); greet();
} }
void Client::dummy() void Client::dummy()

View file

@ -18,12 +18,12 @@ RequestClient::RequestClient()
void RequestClient::handshake() void RequestClient::handshake()
{ {
send_sync<Messages::RequestServer::Greet>(); greet();
} }
bool RequestClient::is_supported_protocol(const String& protocol) 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> template<typename RequestHashMapTraits>
@ -33,29 +33,30 @@ RefPtr<Request> RequestClient::start_request(const String& method, const String&
for (auto& it : request_headers) for (auto& it : request_headers)
header_dictionary.add(it.key, it.value); header_dictionary.add(it.key, it.value);
auto response = send_sync<Messages::RequestServer::StartRequest>(method, url, header_dictionary, ByteBuffer::copy(request_body)); auto response = IPCProxy::start_request(method, url, header_dictionary, ByteBuffer::copy(request_body));
auto request_id = response->request_id(); auto request_id = response.request_id();
if (request_id < 0 || !response->response_fd().has_value()) if (request_id < 0 || !response.response_fd().has_value())
return nullptr; 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); auto request = Request::create_from_id({}, *this, request_id);
request->set_request_fd({}, response_fd); request->set_request_fd({}, response_fd);
m_requests.set(request_id, request); m_requests.set(request_id, request);
return request; return request;
return nullptr;
} }
bool RequestClient::stop_request(Badge<Request>, Request& request) bool RequestClient::stop_request(Badge<Request>, Request& request)
{ {
if (!m_requests.contains(request.id())) if (!m_requests.contains(request.id()))
return false; 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) bool RequestClient::set_certificate(Badge<Request>, Request& request, String certificate, String key)
{ {
if (!m_requests.contains(request.id())) if (!m_requests.contains(request.id()))
return false; 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) void RequestClient::request_finished(i32 request_id, bool success, u32 total_size)

View file

@ -17,7 +17,7 @@ WebSocketClient::WebSocketClient()
void WebSocketClient::handshake() 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) 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; IPC::Dictionary header_dictionary;
for (auto& it : request_headers) for (auto& it : request_headers)
header_dictionary.add(it.key, it.value); header_dictionary.add(it.key, it.value);
auto response = send_sync<Messages::WebSocketServer::Connect>(url, origin, protocols, extensions, header_dictionary); auto response = IPCProxy::connect(url, origin, protocols, extensions, header_dictionary);
auto connection_id = response->connection_id(); auto connection_id = response.connection_id();
if (connection_id < 0) if (connection_id < 0)
return nullptr; return nullptr;
auto connection = WebSocket::create_from_id({}, *this, connection_id); 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())) if (!m_connections.contains(connection.id()))
return (u32)WebSocket::ReadyState::Closed; 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) void WebSocketClient::send(Badge<WebSocket>, WebSocket& connection, ByteBuffer data, bool is_text)
{ {
if (!m_connections.contains(connection.id())) if (!m_connections.contains(connection.id()))
return; 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) void WebSocketClient::close(Badge<WebSocket>, WebSocket& connection, u16 code, String message)
{ {
if (!m_connections.contains(connection.id())) if (!m_connections.contains(connection.id()))
return; 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) bool WebSocketClient::set_certificate(Badge<WebSocket>, WebSocket& connection, String certificate, String key)
{ {
if (!m_connections.contains(connection.id())) if (!m_connections.contains(connection.id()))
return false; 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) void WebSocketClient::connected(i32 connection_id)

View file

@ -20,7 +20,7 @@ Client::Client()
void Client::handshake() void Client::handshake()
{ {
send_sync<Messages::SymbolServer::Greet>(); greet();
} }
void Client::dummy() void Client::dummy()
@ -29,16 +29,16 @@ void Client::dummy()
Optional<Symbol> Client::symbolicate(const String& path, FlatPtr address) Optional<Symbol> Client::symbolicate(const String& path, FlatPtr address)
{ {
auto response = send_sync<Messages::SymbolServer::Symbolicate>(path, address); auto response = IPCProxy::symbolicate(path, address);
if (!response->success()) if (!response.success())
return {}; return {};
return Symbol { return Symbol {
.address = address, .address = address,
.name = response->name(), .name = response.name(),
.offset = response->offset(), .offset = response.offset(),
.filename = response->filename(), .filename = response.filename(),
.line_number = response->line() .line_number = response.line()
}; };
} }

View file

@ -68,26 +68,26 @@ void OutOfProcessWebView::create_client()
}); });
}; };
client().post_message(Messages::WebContentServer::UpdateSystemTheme(Gfx::current_system_theme_buffer())); client().async_update_system_theme(Gfx::current_system_theme_buffer());
client().post_message(Messages::WebContentServer::UpdateScreenRect(GUI::Desktop::the().rect())); client().async_update_screen_rect(GUI::Desktop::the().rect());
} }
void OutOfProcessWebView::load(const URL& url) void OutOfProcessWebView::load(const URL& url)
{ {
m_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) void OutOfProcessWebView::load_html(const StringView& html, const URL& url)
{ {
m_url = url; m_url = url;
client().post_message(Messages::WebContentServer::LoadHTML(html, url)); client().async_load_html(html, url);
} }
void OutOfProcessWebView::load_empty_document() void OutOfProcessWebView::load_empty_document()
{ {
m_url = {}; m_url = {};
client().post_message(Messages::WebContentServer::LoadHTML("", {})); client().async_load_html("", {});
} }
void OutOfProcessWebView::paint_event(GUI::PaintEvent& event) void OutOfProcessWebView::paint_event(GUI::PaintEvent& event)
@ -119,7 +119,7 @@ void OutOfProcessWebView::resize_event(GUI::ResizeEvent& event)
void OutOfProcessWebView::handle_resize() 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) { 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. // 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) { if (m_client_state.front_bitmap) {
m_client_state.front_bitmap = nullptr; 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) { if (m_client_state.back_bitmap) {
m_client_state.back_bitmap = nullptr; 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; 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())) { 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 = move(new_bitmap);
m_client_state.front_bitmap_id = m_client_state.next_bitmap_id++; 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())) { 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 = move(new_bitmap);
m_client_state.back_bitmap_id = m_client_state.next_bitmap_id++; 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(); request_repaint();
@ -160,39 +160,39 @@ void OutOfProcessWebView::handle_resize()
void OutOfProcessWebView::keydown_event(GUI::KeyEvent& event) 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) 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) 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) 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) 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) void OutOfProcessWebView::theme_change_event(GUI::ThemeChangeEvent& event)
{ {
GUI::AbstractScrollableWidget::theme_change_event(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(); request_repaint();
} }
void OutOfProcessWebView::screen_rect_change_event(GUI::ScreenRectChangeEvent& event) 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) 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() void OutOfProcessWebView::did_scroll()
{ {
client().post_message(Messages::WebContentServer::SetViewportRect(visible_content_rect())); client().async_set_viewport_rect(visible_content_rect());
request_repaint(); 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. // it won't have a back bitmap yet, so we can just skip repaint requests.
if (!m_client_state.back_bitmap) if (!m_client_state.back_bitmap)
return; 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() WebContentClient& OutOfProcessWebView::client()
@ -381,22 +381,22 @@ WebContentClient& OutOfProcessWebView::client()
void OutOfProcessWebView::debug_request(const String& request, const String& argument) 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() void OutOfProcessWebView::get_source()
{ {
client().post_message(Messages::WebContentServer::GetSource()); client().async_get_source();
} }
void OutOfProcessWebView::js_console_initialize() void OutOfProcessWebView::js_console_initialize()
{ {
client().post_message(Messages::WebContentServer::JSConsoleInitialize()); client().async_jsconsole_initialize();
} }
void OutOfProcessWebView::js_console_input(const String& js_source) void OutOfProcessWebView::js_console_input(const String& js_source)
{ {
client().post_message(Messages::WebContentServer::JSConsoleInput(js_source)); client().async_jsconsole_input(js_source);
} }
} }

View file

@ -26,7 +26,7 @@ void WebContentClient::die()
void WebContentClient::handshake() void WebContentClient::handshake()
{ {
send_sync<Messages::WebContentServer::Greet>(); greet();
} }
void WebContentClient::did_paint(const Gfx::IntRect&, i32 bitmap_id) void WebContentClient::did_paint(const Gfx::IntRect&, i32 bitmap_id)

View file

@ -46,17 +46,17 @@ void ClientConnection::die()
void ClientConnection::did_finish_playing_buffer(Badge<BufferQueue>, int buffer_id) 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) 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) 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() void ClientConnection::greet()

View file

@ -20,8 +20,7 @@ namespace AudioServer {
class BufferQueue; class BufferQueue;
class Mixer; class Mixer;
class ClientConnection final : public IPC::ClientConnection<AudioClientEndpoint, AudioServerEndpoint> class ClientConnection final : public IPC::ClientConnection<AudioClientEndpoint, AudioServerEndpoint> {
{
C_OBJECT(ClientConnection) C_OBJECT(ClientConnection)
public: public:
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id, Mixer& mixer); explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id, Mixer& mixer);

View file

@ -52,7 +52,7 @@ Messages::ClipboardServer::GetClipboardDataResponse ClientConnection::get_clipbo
void ClientConnection::notify_about_clipboard_change() void ClientConnection::notify_about_clipboard_change()
{ {
post_message(Messages::ClipboardClient::ClipboardDataChanged(Storage::the().mime_type())); async_clipboard_data_changed(Storage::the().mime_type());
} }
} }

View file

@ -14,8 +14,7 @@
namespace Clipboard { namespace Clipboard {
class ClientConnection final class ClientConnection final
: public IPC::ClientConnection<ClipboardClientEndpoint, ClipboardServerEndpoint> : public IPC::ClientConnection<ClipboardClientEndpoint, ClipboardServerEndpoint> {
{
C_OBJECT(ClientConnection); C_OBJECT(ClientConnection);
public: public:

View file

@ -16,8 +16,7 @@
namespace ImageDecoder { namespace ImageDecoder {
class ClientConnection final class ClientConnection final
: public IPC::ClientConnection<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint> : public IPC::ClientConnection<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint> {
{
C_OBJECT(ClientConnection); C_OBJECT(ClientConnection);
public: public:

View file

@ -12,8 +12,7 @@
namespace LaunchServer { namespace LaunchServer {
class ClientConnection final : public IPC::ClientConnection<LaunchClientEndpoint, LaunchServerEndpoint> class ClientConnection final : public IPC::ClientConnection<LaunchClientEndpoint, LaunchServerEndpoint> {
{
C_OBJECT(ClientConnection) C_OBJECT(ClientConnection)
public: public:
~ClientConnection() override; ~ClientConnection() override;

View file

@ -14,8 +14,7 @@
namespace LookupServer { namespace LookupServer {
class ClientConnection final class ClientConnection final
: public IPC::ClientConnection<LookupClientEndpoint, LookupServerEndpoint> : public IPC::ClientConnection<LookupClientEndpoint, LookupServerEndpoint> {
{
C_OBJECT(ClientConnection); C_OBJECT(ClientConnection);
public: public:

View file

@ -12,8 +12,7 @@
namespace NotificationServer { namespace NotificationServer {
class ClientConnection final : public IPC::ClientConnection<NotificationClientEndpoint, NotificationServerEndpoint> class ClientConnection final : public IPC::ClientConnection<NotificationClientEndpoint, NotificationServerEndpoint> {
{
C_OBJECT(ClientConnection) C_OBJECT(ClientConnection)
public: public:
~ClientConnection() override; ~ClientConnection() override;

View file

@ -77,26 +77,26 @@ void ClientConnection::did_receive_headers(Badge<Request>, Request& request)
for (auto& it : request.response_headers()) for (auto& it : request.response_headers())
response_headers.add(it.key, it.value); 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) void ClientConnection::did_finish_request(Badge<Request>, Request& request, bool success)
{ {
VERIFY(request.total_size().has_value()); 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()); m_requests.remove(request.id());
} }
void ClientConnection::did_progress_request(Badge<Request>, Request& request) 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) void ClientConnection::did_request_certificates(Badge<Request>, Request& request)
{ {
post_message(Messages::RequestClient::CertificateRequested(request.id())); async_certificate_requested(request.id());
} }
void ClientConnection::greet() void ClientConnection::greet()

View file

@ -15,8 +15,7 @@
namespace RequestServer { namespace RequestServer {
class ClientConnection final class ClientConnection final
: public IPC::ClientConnection<RequestClientEndpoint, RequestServerEndpoint> : public IPC::ClientConnection<RequestClientEndpoint, RequestServerEndpoint> {
{
C_OBJECT(ClientConnection); C_OBJECT(ClientConnection);
public: public:

View file

@ -16,8 +16,7 @@
namespace SymbolServer { namespace SymbolServer {
class ClientConnection final class ClientConnection final
: public IPC::ClientConnection<SymbolClientEndpoint, SymbolServerEndpoint> : public IPC::ClientConnection<SymbolClientEndpoint, SymbolServerEndpoint> {
{
C_OBJECT(ClientConnection); C_OBJECT(ClientConnection);
public: public:

View file

@ -26,29 +26,26 @@ TaskbarButton::~TaskbarButton()
void TaskbarButton::context_menu_event(GUI::ContextMenuEvent&) void TaskbarButton::context_menu_event(GUI::ContextMenuEvent&)
{ {
GUI::WindowManagerServerConnection::the().post_message( GUI::WindowManagerServerConnection::the().async_popup_window_menu(
Messages::WindowManagerServer::PopupWindowMenu( m_identifier.client_id(),
m_identifier.client_id(), m_identifier.window_id(),
m_identifier.window_id(), screen_relative_rect().location());
screen_relative_rect().location()));
} }
void TaskbarButton::update_taskbar_rect() void TaskbarButton::update_taskbar_rect()
{ {
GUI::WindowManagerServerConnection::the().post_message( GUI::WindowManagerServerConnection::the().async_set_window_taskbar_rect(
Messages::WindowManagerServer::SetWindowTaskbarRect( m_identifier.client_id(),
m_identifier.client_id(), m_identifier.window_id(),
m_identifier.window_id(), screen_relative_rect());
screen_relative_rect()));
} }
void TaskbarButton::clear_taskbar_rect() void TaskbarButton::clear_taskbar_rect()
{ {
GUI::WindowManagerServerConnection::the().post_message( GUI::WindowManagerServerConnection::the().async_set_window_taskbar_rect(
Messages::WindowManagerServer::SetWindowTaskbarRect( m_identifier.client_id(),
m_identifier.client_id(), m_identifier.window_id(),
m_identifier.window_id(), {});
{}));
} }
void TaskbarButton::resize_event(GUI::ResizeEvent& event) void TaskbarButton::resize_event(GUI::ResizeEvent& event)

View file

@ -164,7 +164,7 @@ void TaskbarWindow::update_applet_area()
main_widget()->do_layout(); main_widget()->do_layout();
Gfx::IntRect new_rect { {}, m_applet_area_size }; Gfx::IntRect new_rect { {}, m_applet_area_size };
new_rect.center_within(m_applet_area_container->screen_relative_rect()); 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) 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 // false because window is the modal window's owner (which is not
// active) // active)
if (window->is_minimized() || !button->is_checked()) { 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 { } 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);
} }
}; };
} }

View file

@ -178,7 +178,7 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
quick_sort(g_themes, [](auto& a, auto& b) { return a.name < b.name; }); quick_sort(g_themes, [](auto& a, auto& b) { return a.name < b.name; });
} }
auto current_theme_name = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::GetSystemTheme>()->theme_name(); auto current_theme_name = GUI::WindowServerConnection::the().get_system_theme().theme_name();
{ {
int theme_identifier = 0; 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 action = GUI::Action::create_checkable(theme.name, [theme_identifier](auto&) {
auto& theme = g_themes[theme_identifier]; auto& theme = g_themes[theme_identifier];
dbgln("Theme switched to {} at path {}", theme.name, theme.path); dbgln("Theme switched to {} at path {}", theme.name, theme.path);
auto response = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetSystemTheme>(theme.path, theme.name); auto response = GUI::WindowServerConnection::the().set_system_theme(theme.path, theme.name);
VERIFY(response->success()); VERIFY(response.success());
}); });
if (theme.name == current_theme_name) if (theme.name == current_theme_name)
action->set_checked(true); action->set_checked(true);

View file

@ -135,7 +135,7 @@ void ClientConnection::flush_pending_paint_requests()
{ {
for (auto& pending_paint : m_pending_paint_requests) { for (auto& pending_paint : m_pending_paint_requests) {
m_page_host->paint(pending_paint.content_rect, *pending_paint.bitmap); 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(); m_pending_paint_requests.clear();
} }
@ -209,7 +209,7 @@ void ClientConnection::debug_request(const String& request, const String& argume
void ClientConnection::get_source() void ClientConnection::get_source()
{ {
if (auto* doc = page().main_frame().document()) { if (auto* doc = page().main_frame().document()) {
post_message(Messages::WebContentClient::DidGetSource(doc->url(), doc->source())); async_did_get_source(doc->url(), doc->source());
} }
} }

View file

@ -19,8 +19,7 @@
namespace WebContent { namespace WebContent {
class ClientConnection final class ClientConnection final
: public IPC::ClientConnection<WebContentClientEndpoint, WebContentServerEndpoint> : public IPC::ClientConnection<WebContentClientEndpoint, WebContentServerEndpoint> {
{
C_OBJECT(ClientConnection); C_OBJECT(ClientConnection);
public: public:

View file

@ -78,17 +78,17 @@ void PageHost::set_viewport_rect(const Gfx::IntRect& rect)
void PageHost::page_did_invalidate(const Gfx::IntRect& content_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() 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) 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() void PageHost::page_did_layout()
@ -96,107 +96,107 @@ void PageHost::page_did_layout()
auto* layout_root = this->layout_root(); auto* layout_root = this->layout_root();
VERIFY(layout_root); VERIFY(layout_root);
auto content_size = enclosing_int_rect(layout_root->absolute_rect()).size(); 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) 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) 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) 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) 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() 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) 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() 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) 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) 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) 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) 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) 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) 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) 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) 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_) 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) 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) 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) 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) 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));
} }
} }

View file

@ -51,12 +51,12 @@ void WebContentConsoleClient::handle_input(const String& js_source)
void WebContentConsoleClient::print_html(const String& line) 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() 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() JS::Value WebContentConsoleClient::log()

View file

@ -115,22 +115,22 @@ Messages::WebSocketServer::SetCertificateResponse ClientConnection::set_certific
void ClientConnection::did_connect(i32 connection_id) 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) 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) 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) 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] { deferred_invoke([this, connection_id] {
m_connections.remove(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) void ClientConnection::did_request_certificates(i32 connection_id)
{ {
post_message(Messages::WebSocketClient::CertificateRequested(connection_id)); async_certificate_requested(connection_id);
} }
} }

View file

@ -15,8 +15,7 @@
namespace WebSocket { namespace WebSocket {
class ClientConnection final class ClientConnection final
: public IPC::ClientConnection<WebSocketClientEndpoint, WebSocketServerEndpoint> : public IPC::ClientConnection<WebSocketClientEndpoint, WebSocketServerEndpoint> {
{
C_OBJECT(ClientConnection); C_OBJECT(ClientConnection);
public: public:

View file

@ -78,7 +78,7 @@ void ClientConnection::die()
void ClientConnection::notify_about_new_screen_rect(Gfx::IntRect const& rect) 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() 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); 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) { 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())) if (window.is_minimized() || (!ignore_occlusion && window.is_occluded()))
return; 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) 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) if (!m_has_display_link)
return; return;
post_message(Messages::WindowClient::DisplayLinkNotification()); async_display_link_notification();
} }
void ClientConnection::set_window_progress(i32 window_id, Optional<i32> const& progress) 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() void ClientConnection::refresh_system_theme()
{ {
// Post the client an UpdateSystemTheme message to refresh its 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() void ClientConnection::pong()
@ -847,7 +847,7 @@ void ClientConnection::set_unresponsive(bool unresponsive)
void ClientConnection::may_have_become_unresponsive() void ClientConnection::may_have_become_unresponsive()
{ {
post_message(Messages::WindowClient::Ping()); async_ping();
m_ping_timer = Core::Timer::create_single_shot(1000, [this] { m_ping_timer = Core::Timer::create_single_shot(1000, [this] {
set_unresponsive(true); set_unresponsive(true);
}); });

View file

@ -28,8 +28,7 @@ class Menubar;
class WMClientConnection; class WMClientConnection;
class ClientConnection final class ClientConnection final
: public IPC::ClientConnection<WindowClientEndpoint, WindowServerEndpoint> : public IPC::ClientConnection<WindowClientEndpoint, WindowServerEndpoint> {
{
C_OBJECT(ClientConnection) C_OBJECT(ClientConnection)
public: public:
~ClientConnection() override; ~ClientConnection() override;
@ -120,7 +119,7 @@ private:
virtual void move_window_to_front(i32) override; virtual void move_window_to_front(i32) override;
virtual void set_fullscreen(i32, bool) override; virtual void set_fullscreen(i32, bool) override;
virtual void set_frameless(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_background_color(String const&) override;
virtual void set_wallpaper_mode(String const&) override; virtual void set_wallpaper_mode(String const&) override;
virtual Messages::WindowServer::GetWallpaperResponse get_wallpaper() override; virtual Messages::WindowServer::GetWallpaperResponse get_wallpaper() override;

View file

@ -507,7 +507,7 @@ void Menu::did_activate(MenuItem& item, bool leave_menu_open)
MenuManager::the().close_everyone(); MenuManager::the().close_everyone();
if (m_client) 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() bool Menu::activate_default()
@ -612,7 +612,7 @@ void Menu::set_visible(bool visible)
return; return;
menu_window()->set_visible(visible); menu_window()->set_visible(visible);
if (m_client) 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) void Menu::add_item(NonnullOwnPtr<MenuItem> item)
@ -637,13 +637,13 @@ void Menu::set_hovered_index(int index, bool make_input)
return; return;
if (auto* old_hovered_item = hovered_item()) { if (auto* old_hovered_item = hovered_item()) {
if (client()) 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; m_hovered_item_index = index;
update_for_new_hovered_item(make_input); update_for_new_hovered_item(make_input);
if (auto* new_hovered_item = hovered_item()) { if (auto* new_hovered_item = hovered_item()) {
if (client()) 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());
} }
} }

View file

@ -15,8 +15,7 @@
namespace WindowServer { namespace WindowServer {
class WMClientConnection final class WMClientConnection final
: public IPC::ClientConnection<WindowManagerClientEndpoint, WindowManagerServerEndpoint> : public IPC::ClientConnection<WindowManagerClientEndpoint, WindowManagerServerEndpoint> {
{
C_OBJECT(WMClientConnection) C_OBJECT(WMClientConnection)
public: public:

View file

@ -226,19 +226,19 @@ void Window::handle_mouse_event(const MouseEvent& event)
switch (event.type()) { switch (event.type()) {
case Event::MouseMove: 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; break;
case Event::MouseDown: 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; break;
case Event::MouseDoubleClick: 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; break;
case Event::MouseUp: 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; break;
case Event::MouseWheel: 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; break;
default: default:
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();
@ -414,39 +414,38 @@ void Window::event(Core::Event& event)
switch (event.type()) { switch (event.type()) {
case Event::WindowEntered: case Event::WindowEntered:
m_client->post_message(Messages::WindowClient::WindowEntered(m_window_id)); m_client->async_window_entered(m_window_id);
break; break;
case Event::WindowLeft: case Event::WindowLeft:
m_client->post_message(Messages::WindowClient::WindowLeft(m_window_id)); m_client->async_window_left(m_window_id);
break; break;
case Event::KeyDown: case Event::KeyDown:
handle_keydown_event(static_cast<const KeyEvent&>(event)); handle_keydown_event(static_cast<const KeyEvent&>(event));
break; break;
case Event::KeyUp: case Event::KeyUp:
m_client->post_message( m_client->async_key_up(m_window_id,
Messages::WindowClient::KeyUp(m_window_id, (u32) static_cast<const KeyEvent&>(event).code_point(),
(u32) static_cast<const KeyEvent&>(event).code_point(), (u32) static_cast<const KeyEvent&>(event).key(),
(u32) static_cast<const KeyEvent&>(event).key(), static_cast<const KeyEvent&>(event).modifiers(),
static_cast<const KeyEvent&>(event).modifiers(), (u32) static_cast<const KeyEvent&>(event).scancode());
(u32) static_cast<const KeyEvent&>(event).scancode()));
break; break;
case Event::WindowActivated: case Event::WindowActivated:
m_client->post_message(Messages::WindowClient::WindowActivated(m_window_id)); m_client->async_window_activated(m_window_id);
break; break;
case Event::WindowDeactivated: case Event::WindowDeactivated:
m_client->post_message(Messages::WindowClient::WindowDeactivated(m_window_id)); m_client->async_window_deactivated(m_window_id);
break; break;
case Event::WindowInputEntered: case Event::WindowInputEntered:
m_client->post_message(Messages::WindowClient::WindowInputEntered(m_window_id)); m_client->async_window_input_entered(m_window_id);
break; break;
case Event::WindowInputLeft: case Event::WindowInputLeft:
m_client->post_message(Messages::WindowClient::WindowInputLeft(m_window_id)); m_client->async_window_input_left(m_window_id);
break; break;
case Event::WindowCloseRequest: case Event::WindowCloseRequest:
m_client->post_message(Messages::WindowClient::WindowCloseRequest(m_window_id)); m_client->async_window_close_request(m_window_id);
break; break;
case Event::WindowResized: 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; break;
default: default:
break; break;
@ -471,7 +470,7 @@ void Window::handle_keydown_event(const KeyEvent& event)
return; 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) 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() 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() void Window::prepare_dirty_rects()

View file

@ -25,7 +25,7 @@ endpoint WindowClient
ScreenRectChanged(Gfx::IntRect rect) =| ScreenRectChanged(Gfx::IntRect rect) =|
AsyncSetWallpaperFinished(bool success) =| SetWallpaperFinished(bool success) =|
DragAccepted() =| DragAccepted() =|
DragCancelled() =| DragCancelled() =|

View file

@ -269,7 +269,7 @@ void WindowManager::remove_window(Window& window)
if (conn.window_id() < 0 || !(conn.event_mask() & WMEventMask::WindowRemovals)) if (conn.window_id() < 0 || !(conn.event_mask() & WMEventMask::WindowRemovals))
return IterationDecision::Continue; return IterationDecision::Continue;
if (!window.is_internal() && !window.is_modal()) 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; return IterationDecision::Continue;
}); });
} }
@ -299,7 +299,7 @@ void WindowManager::tell_wm_about_window(WMClientConnection& conn, Window& windo
if (window.is_internal()) if (window.is_internal())
return; return;
auto* parent = window.parent_window(); 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) 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; return;
if (window.is_internal()) if (window.is_internal())
return; 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) 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; return;
if (window.is_internal()) if (window.is_internal())
return; 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) 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) if (conn.window_id() < 0)
return IterationDecision::Continue; 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; return IterationDecision::Continue;
}); });
} }
@ -365,7 +365,7 @@ void WindowManager::tell_wms_super_key_pressed()
if (conn.window_id() < 0) if (conn.window_id() < 0)
return IterationDecision::Continue; return IterationDecision::Continue;
conn.post_message(Messages::WindowManagerClient::SuperKeyPressed(conn.window_id())); conn.async_super_key_pressed(conn.window_id());
return IterationDecision::Continue; return IterationDecision::Continue;
}); });
} }
@ -427,7 +427,7 @@ void WindowManager::notify_minimization_state_changed(Window& window)
tell_wms_window_state_changed(window); tell_wms_window_state_changed(window);
if (window.client()) 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()) if (window.is_active() && window.is_minimized())
pick_new_active_window(&window); 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) void WindowManager::notify_occlusion_state_changed(Window& window)
{ {
if (window.client()) 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) void WindowManager::notify_progress_changed(Window& window)
@ -769,13 +769,13 @@ bool WindowManager::process_ongoing_drag(MouseEvent& event, Window*& hovered_win
}); });
if (hovered_window) { if (hovered_window) {
m_dnd_client->post_message(Messages::WindowClient::DragAccepted()); m_dnd_client->async_drag_accepted();
if (hovered_window->client()) { if (hovered_window->client()) {
auto translated_event = event.translated(-hovered_window->position()); 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 { } else {
m_dnd_client->post_message(Messages::WindowClient::DragCancelled()); m_dnd_client->async_drag_cancelled();
} }
end_dnd_drag(); end_dnd_drag();
@ -1190,11 +1190,11 @@ void WindowManager::event(Core::Event& event)
// Escape key cancels an ongoing drag. // Escape key cancels an ongoing drag.
if (key_event.type() == Event::KeyDown && key_event.key() == Key_Escape && m_dnd_client) { 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. // 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. // 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) 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(); end_dnd_drag();
return; return;
@ -1538,7 +1538,7 @@ bool WindowManager::update_theme(String theme_path, String theme_name)
for_each_window([&](Window& window) { for_each_window([&](Window& window) {
if (window.client()) { if (window.client()) {
if (!notified_clients.contains(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()); notified_clients.set(window.client());
} }
} }

View file

@ -88,7 +88,7 @@ endpoint WindowServer
PopupMenu(i32 menu_id, Gfx::IntPoint screen_position) => () PopupMenu(i32 menu_id, Gfx::IntPoint screen_position) => ()
DismissMenu(i32 menu_id) => () DismissMenu(i32 menu_id) => ()
AsyncSetWallpaper(String path) =| SetWallpaper(String path) =|
SetBackgroundColor(String background_color) => () SetBackgroundColor(String background_color) => ()
SetWallpaperMode(String mode) => () SetWallpaperMode(String mode) => ()

View file

@ -24,8 +24,8 @@ int main(int argc, char** argv)
// A Core::EventLoop is all we need, but WindowServerConnection needs a full Application object. // A Core::EventLoop is all we need, but WindowServerConnection needs a full Application object.
char* dummy_argv[] = { argv[0] }; char* dummy_argv[] = { argv[0] };
auto app = GUI::Application::construct(1, dummy_argv); auto app = GUI::Application::construct(1, dummy_argv);
auto result = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetResolution>(Gfx::IntSize { width, height }, scale); auto result = GUI::WindowServerConnection::the().set_resolution(Gfx::IntSize { width, height }, scale);
if (!result->success()) { if (!result.success()) {
warnln("failed to set resolution"); warnln("failed to set resolution");
return 1; return 1;
} }

View file

@ -34,9 +34,9 @@ int main(int argc, char** argv)
auto app = GUI::Application::construct(argc, argv); auto app = GUI::Application::construct(argc, argv);
sleep(delay); 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) { if (!bitmap) {
warnln("Failed to grab screenshot"); warnln("Failed to grab screenshot");
return 1; return 1;