mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 22:47:45 +00:00
Userland: Update IPC calls to use proxies
This updates all existing code to use the auto-generated client methods instead of post_message/send_sync.
This commit is contained in:
parent
78803ce384
commit
5bb79ea0a7
63 changed files with 303 additions and 316 deletions
|
@ -46,17 +46,17 @@ void ClientConnection::die()
|
|||
|
||||
void ClientConnection::did_finish_playing_buffer(Badge<BufferQueue>, int buffer_id)
|
||||
{
|
||||
post_message(Messages::AudioClient::FinishedPlayingBuffer(buffer_id));
|
||||
async_finished_playing_buffer(buffer_id);
|
||||
}
|
||||
|
||||
void ClientConnection::did_change_muted_state(Badge<Mixer>, bool muted)
|
||||
{
|
||||
post_message(Messages::AudioClient::MutedStateChanged(muted));
|
||||
async_muted_state_changed(muted);
|
||||
}
|
||||
|
||||
void ClientConnection::did_change_main_mix_volume(Badge<Mixer>, int volume)
|
||||
{
|
||||
post_message(Messages::AudioClient::MainMixVolumeChanged(volume));
|
||||
async_main_mix_volume_changed(volume);
|
||||
}
|
||||
|
||||
void ClientConnection::greet()
|
||||
|
|
|
@ -20,8 +20,7 @@ namespace AudioServer {
|
|||
class BufferQueue;
|
||||
class Mixer;
|
||||
|
||||
class ClientConnection final : public IPC::ClientConnection<AudioClientEndpoint, AudioServerEndpoint>
|
||||
{
|
||||
class ClientConnection final : public IPC::ClientConnection<AudioClientEndpoint, AudioServerEndpoint> {
|
||||
C_OBJECT(ClientConnection)
|
||||
public:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id, Mixer& mixer);
|
||||
|
|
|
@ -52,7 +52,7 @@ Messages::ClipboardServer::GetClipboardDataResponse ClientConnection::get_clipbo
|
|||
|
||||
void ClientConnection::notify_about_clipboard_change()
|
||||
{
|
||||
post_message(Messages::ClipboardClient::ClipboardDataChanged(Storage::the().mime_type()));
|
||||
async_clipboard_data_changed(Storage::the().mime_type());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
namespace Clipboard {
|
||||
|
||||
class ClientConnection final
|
||||
: public IPC::ClientConnection<ClipboardClientEndpoint, ClipboardServerEndpoint>
|
||||
{
|
||||
: public IPC::ClientConnection<ClipboardClientEndpoint, ClipboardServerEndpoint> {
|
||||
C_OBJECT(ClientConnection);
|
||||
|
||||
public:
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
namespace ImageDecoder {
|
||||
|
||||
class ClientConnection final
|
||||
: public IPC::ClientConnection<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint>
|
||||
{
|
||||
: public IPC::ClientConnection<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint> {
|
||||
C_OBJECT(ClientConnection);
|
||||
|
||||
public:
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
|
||||
namespace LaunchServer {
|
||||
|
||||
class ClientConnection final : public IPC::ClientConnection<LaunchClientEndpoint, LaunchServerEndpoint>
|
||||
{
|
||||
class ClientConnection final : public IPC::ClientConnection<LaunchClientEndpoint, LaunchServerEndpoint> {
|
||||
C_OBJECT(ClientConnection)
|
||||
public:
|
||||
~ClientConnection() override;
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
namespace LookupServer {
|
||||
|
||||
class ClientConnection final
|
||||
: public IPC::ClientConnection<LookupClientEndpoint, LookupServerEndpoint>
|
||||
{
|
||||
: public IPC::ClientConnection<LookupClientEndpoint, LookupServerEndpoint> {
|
||||
C_OBJECT(ClientConnection);
|
||||
|
||||
public:
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
|
||||
namespace NotificationServer {
|
||||
|
||||
class ClientConnection final : public IPC::ClientConnection<NotificationClientEndpoint, NotificationServerEndpoint>
|
||||
{
|
||||
class ClientConnection final : public IPC::ClientConnection<NotificationClientEndpoint, NotificationServerEndpoint> {
|
||||
C_OBJECT(ClientConnection)
|
||||
public:
|
||||
~ClientConnection() override;
|
||||
|
|
|
@ -77,26 +77,26 @@ void ClientConnection::did_receive_headers(Badge<Request>, Request& request)
|
|||
for (auto& it : request.response_headers())
|
||||
response_headers.add(it.key, it.value);
|
||||
|
||||
post_message(Messages::RequestClient::HeadersBecameAvailable(request.id(), move(response_headers), request.status_code()));
|
||||
async_headers_became_available(request.id(), move(response_headers), request.status_code());
|
||||
}
|
||||
|
||||
void ClientConnection::did_finish_request(Badge<Request>, Request& request, bool success)
|
||||
{
|
||||
VERIFY(request.total_size().has_value());
|
||||
|
||||
post_message(Messages::RequestClient::RequestFinished(request.id(), success, request.total_size().value()));
|
||||
async_request_finished(request.id(), success, request.total_size().value());
|
||||
|
||||
m_requests.remove(request.id());
|
||||
}
|
||||
|
||||
void ClientConnection::did_progress_request(Badge<Request>, Request& request)
|
||||
{
|
||||
post_message(Messages::RequestClient::RequestProgress(request.id(), request.total_size(), request.downloaded_size()));
|
||||
async_request_progress(request.id(), request.total_size(), request.downloaded_size());
|
||||
}
|
||||
|
||||
void ClientConnection::did_request_certificates(Badge<Request>, Request& request)
|
||||
{
|
||||
post_message(Messages::RequestClient::CertificateRequested(request.id()));
|
||||
async_certificate_requested(request.id());
|
||||
}
|
||||
|
||||
void ClientConnection::greet()
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
namespace RequestServer {
|
||||
|
||||
class ClientConnection final
|
||||
: public IPC::ClientConnection<RequestClientEndpoint, RequestServerEndpoint>
|
||||
{
|
||||
: public IPC::ClientConnection<RequestClientEndpoint, RequestServerEndpoint> {
|
||||
C_OBJECT(ClientConnection);
|
||||
|
||||
public:
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
namespace SymbolServer {
|
||||
|
||||
class ClientConnection final
|
||||
: public IPC::ClientConnection<SymbolClientEndpoint, SymbolServerEndpoint>
|
||||
{
|
||||
: public IPC::ClientConnection<SymbolClientEndpoint, SymbolServerEndpoint> {
|
||||
C_OBJECT(ClientConnection);
|
||||
|
||||
public:
|
||||
|
|
|
@ -26,29 +26,26 @@ TaskbarButton::~TaskbarButton()
|
|||
|
||||
void TaskbarButton::context_menu_event(GUI::ContextMenuEvent&)
|
||||
{
|
||||
GUI::WindowManagerServerConnection::the().post_message(
|
||||
Messages::WindowManagerServer::PopupWindowMenu(
|
||||
m_identifier.client_id(),
|
||||
m_identifier.window_id(),
|
||||
screen_relative_rect().location()));
|
||||
GUI::WindowManagerServerConnection::the().async_popup_window_menu(
|
||||
m_identifier.client_id(),
|
||||
m_identifier.window_id(),
|
||||
screen_relative_rect().location());
|
||||
}
|
||||
|
||||
void TaskbarButton::update_taskbar_rect()
|
||||
{
|
||||
GUI::WindowManagerServerConnection::the().post_message(
|
||||
Messages::WindowManagerServer::SetWindowTaskbarRect(
|
||||
m_identifier.client_id(),
|
||||
m_identifier.window_id(),
|
||||
screen_relative_rect()));
|
||||
GUI::WindowManagerServerConnection::the().async_set_window_taskbar_rect(
|
||||
m_identifier.client_id(),
|
||||
m_identifier.window_id(),
|
||||
screen_relative_rect());
|
||||
}
|
||||
|
||||
void TaskbarButton::clear_taskbar_rect()
|
||||
{
|
||||
GUI::WindowManagerServerConnection::the().post_message(
|
||||
Messages::WindowManagerServer::SetWindowTaskbarRect(
|
||||
m_identifier.client_id(),
|
||||
m_identifier.window_id(),
|
||||
{}));
|
||||
GUI::WindowManagerServerConnection::the().async_set_window_taskbar_rect(
|
||||
m_identifier.client_id(),
|
||||
m_identifier.window_id(),
|
||||
{});
|
||||
}
|
||||
|
||||
void TaskbarButton::resize_event(GUI::ResizeEvent& event)
|
||||
|
|
|
@ -164,7 +164,7 @@ void TaskbarWindow::update_applet_area()
|
|||
main_widget()->do_layout();
|
||||
Gfx::IntRect new_rect { {}, m_applet_area_size };
|
||||
new_rect.center_within(m_applet_area_container->screen_relative_rect());
|
||||
GUI::WindowManagerServerConnection::the().send_sync<Messages::WindowManagerServer::SetAppletAreaPosition>(new_rect.location());
|
||||
GUI::WindowManagerServerConnection::the().set_applet_area_position(new_rect.location());
|
||||
}
|
||||
|
||||
NonnullRefPtr<GUI::Button> TaskbarWindow::create_button(const WindowIdentifier& identifier)
|
||||
|
@ -191,9 +191,9 @@ void TaskbarWindow::add_window_button(::Window& window, const WindowIdentifier&
|
|||
// false because window is the modal window's owner (which is not
|
||||
// active)
|
||||
if (window->is_minimized() || !button->is_checked()) {
|
||||
GUI::WindowManagerServerConnection::the().post_message(Messages::WindowManagerServer::SetActiveWindow(identifier.client_id(), identifier.window_id()));
|
||||
GUI::WindowManagerServerConnection::the().async_set_active_window(identifier.client_id(), identifier.window_id());
|
||||
} else {
|
||||
GUI::WindowManagerServerConnection::the().post_message(Messages::WindowManagerServer::SetWindowMinimized(identifier.client_id(), identifier.window_id(), true));
|
||||
GUI::WindowManagerServerConnection::the().async_set_window_minimized(identifier.client_id(), identifier.window_id(), true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
|
|||
quick_sort(g_themes, [](auto& a, auto& b) { return a.name < b.name; });
|
||||
}
|
||||
|
||||
auto current_theme_name = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::GetSystemTheme>()->theme_name();
|
||||
auto current_theme_name = GUI::WindowServerConnection::the().get_system_theme().theme_name();
|
||||
|
||||
{
|
||||
int theme_identifier = 0;
|
||||
|
@ -186,8 +186,8 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
|
|||
auto action = GUI::Action::create_checkable(theme.name, [theme_identifier](auto&) {
|
||||
auto& theme = g_themes[theme_identifier];
|
||||
dbgln("Theme switched to {} at path {}", theme.name, theme.path);
|
||||
auto response = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetSystemTheme>(theme.path, theme.name);
|
||||
VERIFY(response->success());
|
||||
auto response = GUI::WindowServerConnection::the().set_system_theme(theme.path, theme.name);
|
||||
VERIFY(response.success());
|
||||
});
|
||||
if (theme.name == current_theme_name)
|
||||
action->set_checked(true);
|
||||
|
|
|
@ -135,7 +135,7 @@ void ClientConnection::flush_pending_paint_requests()
|
|||
{
|
||||
for (auto& pending_paint : m_pending_paint_requests) {
|
||||
m_page_host->paint(pending_paint.content_rect, *pending_paint.bitmap);
|
||||
post_message(Messages::WebContentClient::DidPaint(pending_paint.content_rect, pending_paint.bitmap_id));
|
||||
async_did_paint(pending_paint.content_rect, pending_paint.bitmap_id);
|
||||
}
|
||||
m_pending_paint_requests.clear();
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ void ClientConnection::debug_request(const String& request, const String& argume
|
|||
void ClientConnection::get_source()
|
||||
{
|
||||
if (auto* doc = page().main_frame().document()) {
|
||||
post_message(Messages::WebContentClient::DidGetSource(doc->url(), doc->source()));
|
||||
async_did_get_source(doc->url(), doc->source());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,7 @@
|
|||
namespace WebContent {
|
||||
|
||||
class ClientConnection final
|
||||
: public IPC::ClientConnection<WebContentClientEndpoint, WebContentServerEndpoint>
|
||||
{
|
||||
: public IPC::ClientConnection<WebContentClientEndpoint, WebContentServerEndpoint> {
|
||||
C_OBJECT(ClientConnection);
|
||||
|
||||
public:
|
||||
|
|
|
@ -78,17 +78,17 @@ void PageHost::set_viewport_rect(const Gfx::IntRect& rect)
|
|||
|
||||
void PageHost::page_did_invalidate(const Gfx::IntRect& content_rect)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidInvalidateContentRect(content_rect));
|
||||
m_client.async_did_invalidate_content_rect(content_rect);
|
||||
}
|
||||
|
||||
void PageHost::page_did_change_selection()
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidChangeSelection());
|
||||
m_client.async_did_change_selection();
|
||||
}
|
||||
|
||||
void PageHost::page_did_request_cursor_change(Gfx::StandardCursor cursor)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidRequestCursorChange((u32)cursor));
|
||||
m_client.async_did_request_cursor_change((u32)cursor);
|
||||
}
|
||||
|
||||
void PageHost::page_did_layout()
|
||||
|
@ -96,107 +96,107 @@ void PageHost::page_did_layout()
|
|||
auto* layout_root = this->layout_root();
|
||||
VERIFY(layout_root);
|
||||
auto content_size = enclosing_int_rect(layout_root->absolute_rect()).size();
|
||||
m_client.post_message(Messages::WebContentClient::DidLayout(content_size));
|
||||
m_client.async_did_layout(content_size);
|
||||
}
|
||||
|
||||
void PageHost::page_did_change_title(const String& title)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidChangeTitle(title));
|
||||
m_client.async_did_change_title(title);
|
||||
}
|
||||
|
||||
void PageHost::page_did_request_scroll(int wheel_delta)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidRequestScroll(wheel_delta));
|
||||
m_client.async_did_request_scroll(wheel_delta);
|
||||
}
|
||||
|
||||
void PageHost::page_did_request_scroll_into_view(const Gfx::IntRect& rect)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidRequestScrollIntoView(rect));
|
||||
m_client.async_did_request_scroll_into_view(rect);
|
||||
}
|
||||
|
||||
void PageHost::page_did_enter_tooltip_area(const Gfx::IntPoint& content_position, const String& title)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidEnterTooltipArea(content_position, title));
|
||||
m_client.async_did_enter_tooltip_area(content_position, title);
|
||||
}
|
||||
|
||||
void PageHost::page_did_leave_tooltip_area()
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidLeaveTooltipArea());
|
||||
m_client.async_did_leave_tooltip_area();
|
||||
}
|
||||
|
||||
void PageHost::page_did_hover_link(const URL& url)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidHoverLink(url));
|
||||
m_client.async_did_hover_link(url);
|
||||
}
|
||||
|
||||
void PageHost::page_did_unhover_link()
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidUnhoverLink());
|
||||
m_client.async_did_unhover_link();
|
||||
}
|
||||
|
||||
void PageHost::page_did_click_link(const URL& url, const String& target, unsigned modifiers)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidClickLink(url, target, modifiers));
|
||||
m_client.async_did_click_link(url, target, modifiers);
|
||||
}
|
||||
|
||||
void PageHost::page_did_middle_click_link(const URL& url, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidMiddleClickLink(url, target, modifiers));
|
||||
m_client.async_did_middle_click_link(url, target, modifiers);
|
||||
}
|
||||
|
||||
void PageHost::page_did_start_loading(const URL& url)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidStartLoading(url));
|
||||
m_client.async_did_start_loading(url);
|
||||
}
|
||||
|
||||
void PageHost::page_did_finish_loading(const URL& url)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidFinishLoading(url));
|
||||
m_client.async_did_finish_loading(url);
|
||||
}
|
||||
|
||||
void PageHost::page_did_request_context_menu(const Gfx::IntPoint& content_position)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidRequestContextMenu(content_position));
|
||||
m_client.async_did_request_context_menu(content_position);
|
||||
}
|
||||
|
||||
void PageHost::page_did_request_link_context_menu(const Gfx::IntPoint& content_position, const URL& url, const String& target, unsigned modifiers)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidRequestLinkContextMenu(content_position, url, target, modifiers));
|
||||
m_client.async_did_request_link_context_menu(content_position, url, target, modifiers);
|
||||
}
|
||||
|
||||
void PageHost::page_did_request_alert(const String& message)
|
||||
{
|
||||
m_client.send_sync<Messages::WebContentClient::DidRequestAlert>(message);
|
||||
m_client.did_request_alert(message);
|
||||
}
|
||||
|
||||
bool PageHost::page_did_request_confirm(const String& message)
|
||||
{
|
||||
return m_client.send_sync<Messages::WebContentClient::DidRequestConfirm>(message)->result();
|
||||
return m_client.did_request_confirm(message).result();
|
||||
}
|
||||
|
||||
String PageHost::page_did_request_prompt(const String& message, const String& default_)
|
||||
{
|
||||
return m_client.send_sync<Messages::WebContentClient::DidRequestPrompt>(message, default_)->response();
|
||||
return m_client.did_request_prompt(message, default_).response();
|
||||
}
|
||||
|
||||
void PageHost::page_did_change_favicon(const Gfx::Bitmap& favicon)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidChangeFavicon(favicon.to_shareable_bitmap()));
|
||||
m_client.async_did_change_favicon(favicon.to_shareable_bitmap());
|
||||
}
|
||||
|
||||
void PageHost::page_did_request_image_context_menu(const Gfx::IntPoint& content_position, const URL& url, const String& target, unsigned modifiers, const Gfx::Bitmap* bitmap)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidRequestImageContextMenu(content_position, url, target, modifiers, bitmap->to_shareable_bitmap()));
|
||||
m_client.async_did_request_image_context_menu(content_position, url, target, modifiers, bitmap->to_shareable_bitmap());
|
||||
}
|
||||
|
||||
String PageHost::page_did_request_cookie(const URL& url, Web::Cookie::Source source)
|
||||
{
|
||||
return m_client.send_sync<Messages::WebContentClient::DidRequestCookie>(url, static_cast<u8>(source))->cookie();
|
||||
return m_client.did_request_cookie(url, static_cast<u8>(source)).cookie();
|
||||
}
|
||||
|
||||
void PageHost::page_did_set_cookie(const URL& url, const Web::Cookie::ParsedCookie& cookie, Web::Cookie::Source source)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidSetCookie(url, cookie, static_cast<u8>(source)));
|
||||
m_client.async_did_set_cookie(url, cookie, static_cast<u8>(source));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,12 +51,12 @@ void WebContentConsoleClient::handle_input(const String& js_source)
|
|||
|
||||
void WebContentConsoleClient::print_html(const String& line)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidJSConsoleOutput("html", line));
|
||||
m_client.async_did_jsconsole_output("html", line);
|
||||
}
|
||||
|
||||
void WebContentConsoleClient::clear_output()
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidJSConsoleOutput("clear_output", {}));
|
||||
m_client.async_did_jsconsole_output("clear_output", {});
|
||||
}
|
||||
|
||||
JS::Value WebContentConsoleClient::log()
|
||||
|
|
|
@ -115,22 +115,22 @@ Messages::WebSocketServer::SetCertificateResponse ClientConnection::set_certific
|
|||
|
||||
void ClientConnection::did_connect(i32 connection_id)
|
||||
{
|
||||
post_message(Messages::WebSocketClient::Connected(connection_id));
|
||||
async_connected(connection_id);
|
||||
}
|
||||
|
||||
void ClientConnection::did_receive_message(i32 connection_id, Message message)
|
||||
{
|
||||
post_message(Messages::WebSocketClient::Received(connection_id, message.is_text(), message.data()));
|
||||
async_received(connection_id, message.is_text(), message.data());
|
||||
}
|
||||
|
||||
void ClientConnection::did_error(i32 connection_id, i32 message)
|
||||
{
|
||||
post_message(Messages::WebSocketClient::Errored(connection_id, message));
|
||||
async_errored(connection_id, message);
|
||||
}
|
||||
|
||||
void ClientConnection::did_close(i32 connection_id, u16 code, String reason, bool was_clean)
|
||||
{
|
||||
post_message(Messages::WebSocketClient::Closed(connection_id, code, reason, was_clean));
|
||||
async_closed(connection_id, code, reason, was_clean);
|
||||
deferred_invoke([this, connection_id] {
|
||||
m_connections.remove(connection_id);
|
||||
});
|
||||
|
@ -138,7 +138,7 @@ void ClientConnection::did_close(i32 connection_id, u16 code, String reason, boo
|
|||
|
||||
void ClientConnection::did_request_certificates(i32 connection_id)
|
||||
{
|
||||
post_message(Messages::WebSocketClient::CertificateRequested(connection_id));
|
||||
async_certificate_requested(connection_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
namespace WebSocket {
|
||||
|
||||
class ClientConnection final
|
||||
: public IPC::ClientConnection<WebSocketClientEndpoint, WebSocketServerEndpoint>
|
||||
{
|
||||
: public IPC::ClientConnection<WebSocketClientEndpoint, WebSocketServerEndpoint> {
|
||||
C_OBJECT(ClientConnection);
|
||||
|
||||
public:
|
||||
|
|
|
@ -78,7 +78,7 @@ void ClientConnection::die()
|
|||
|
||||
void ClientConnection::notify_about_new_screen_rect(Gfx::IntRect const& rect)
|
||||
{
|
||||
post_message(Messages::WindowClient::ScreenRectChanged(rect));
|
||||
async_screen_rect_changed(rect);
|
||||
}
|
||||
|
||||
Messages::WindowServer::CreateMenubarResponse ClientConnection::create_menubar()
|
||||
|
@ -278,10 +278,10 @@ void ClientConnection::set_window_opacity(i32 window_id, float opacity)
|
|||
it->value->set_opacity(opacity);
|
||||
}
|
||||
|
||||
void ClientConnection::async_set_wallpaper(String const& path)
|
||||
void ClientConnection::set_wallpaper(String const& path)
|
||||
{
|
||||
Compositor::the().set_wallpaper(path, [&](bool success) {
|
||||
post_message(Messages::WindowClient::AsyncSetWallpaperFinished(success));
|
||||
async_set_wallpaper_finished(success);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -544,7 +544,7 @@ void ClientConnection::post_paint_message(Window& window, bool ignore_occlusion)
|
|||
if (window.is_minimized() || (!ignore_occlusion && window.is_occluded()))
|
||||
return;
|
||||
|
||||
post_message(Messages::WindowClient::Paint(window.window_id(), window.size(), rect_set.rects()));
|
||||
async_paint(window.window_id(), window.size(), rect_set.rects());
|
||||
}
|
||||
|
||||
void ClientConnection::invalidate_rect(i32 window_id, Vector<Gfx::IntRect> const& rects, bool ignore_occlusion)
|
||||
|
@ -755,7 +755,7 @@ void ClientConnection::notify_display_link(Badge<Compositor>)
|
|||
if (!m_has_display_link)
|
||||
return;
|
||||
|
||||
post_message(Messages::WindowClient::DisplayLinkNotification());
|
||||
async_display_link_notification();
|
||||
}
|
||||
|
||||
void ClientConnection::set_window_progress(i32 window_id, Optional<i32> const& progress)
|
||||
|
@ -771,7 +771,7 @@ void ClientConnection::set_window_progress(i32 window_id, Optional<i32> const& p
|
|||
void ClientConnection::refresh_system_theme()
|
||||
{
|
||||
// Post the client an UpdateSystemTheme message to refresh its theme.
|
||||
post_message(Messages::WindowClient::UpdateSystemTheme(Gfx::current_system_theme_buffer()));
|
||||
async_update_system_theme(Gfx::current_system_theme_buffer());
|
||||
}
|
||||
|
||||
void ClientConnection::pong()
|
||||
|
@ -847,7 +847,7 @@ void ClientConnection::set_unresponsive(bool unresponsive)
|
|||
|
||||
void ClientConnection::may_have_become_unresponsive()
|
||||
{
|
||||
post_message(Messages::WindowClient::Ping());
|
||||
async_ping();
|
||||
m_ping_timer = Core::Timer::create_single_shot(1000, [this] {
|
||||
set_unresponsive(true);
|
||||
});
|
||||
|
|
|
@ -28,8 +28,7 @@ class Menubar;
|
|||
class WMClientConnection;
|
||||
|
||||
class ClientConnection final
|
||||
: public IPC::ClientConnection<WindowClientEndpoint, WindowServerEndpoint>
|
||||
{
|
||||
: public IPC::ClientConnection<WindowClientEndpoint, WindowServerEndpoint> {
|
||||
C_OBJECT(ClientConnection)
|
||||
public:
|
||||
~ClientConnection() override;
|
||||
|
@ -120,7 +119,7 @@ private:
|
|||
virtual void move_window_to_front(i32) override;
|
||||
virtual void set_fullscreen(i32, bool) override;
|
||||
virtual void set_frameless(i32, bool) override;
|
||||
virtual void async_set_wallpaper(String const&) override;
|
||||
virtual void set_wallpaper(String const&) override;
|
||||
virtual void set_background_color(String const&) override;
|
||||
virtual void set_wallpaper_mode(String const&) override;
|
||||
virtual Messages::WindowServer::GetWallpaperResponse get_wallpaper() override;
|
||||
|
|
|
@ -507,7 +507,7 @@ void Menu::did_activate(MenuItem& item, bool leave_menu_open)
|
|||
MenuManager::the().close_everyone();
|
||||
|
||||
if (m_client)
|
||||
m_client->post_message(Messages::WindowClient::MenuItemActivated(m_menu_id, item.identifier()));
|
||||
m_client->async_menu_item_activated(m_menu_id, item.identifier());
|
||||
}
|
||||
|
||||
bool Menu::activate_default()
|
||||
|
@ -612,7 +612,7 @@ void Menu::set_visible(bool visible)
|
|||
return;
|
||||
menu_window()->set_visible(visible);
|
||||
if (m_client)
|
||||
m_client->post_message(Messages::WindowClient::MenuVisibilityDidChange(m_menu_id, visible));
|
||||
m_client->async_menu_visibility_did_change(m_menu_id, visible);
|
||||
}
|
||||
|
||||
void Menu::add_item(NonnullOwnPtr<MenuItem> item)
|
||||
|
@ -637,13 +637,13 @@ void Menu::set_hovered_index(int index, bool make_input)
|
|||
return;
|
||||
if (auto* old_hovered_item = hovered_item()) {
|
||||
if (client())
|
||||
client()->post_message(Messages::WindowClient::MenuItemLeft(m_menu_id, old_hovered_item->identifier()));
|
||||
client()->async_menu_item_left(m_menu_id, old_hovered_item->identifier());
|
||||
}
|
||||
m_hovered_item_index = index;
|
||||
update_for_new_hovered_item(make_input);
|
||||
if (auto* new_hovered_item = hovered_item()) {
|
||||
if (client())
|
||||
client()->post_message(Messages::WindowClient::MenuItemEntered(m_menu_id, new_hovered_item->identifier()));
|
||||
client()->async_menu_item_entered(m_menu_id, new_hovered_item->identifier());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
namespace WindowServer {
|
||||
|
||||
class WMClientConnection final
|
||||
: public IPC::ClientConnection<WindowManagerClientEndpoint, WindowManagerServerEndpoint>
|
||||
{
|
||||
: public IPC::ClientConnection<WindowManagerClientEndpoint, WindowManagerServerEndpoint> {
|
||||
C_OBJECT(WMClientConnection)
|
||||
|
||||
public:
|
||||
|
|
|
@ -226,19 +226,19 @@ void Window::handle_mouse_event(const MouseEvent& event)
|
|||
|
||||
switch (event.type()) {
|
||||
case Event::MouseMove:
|
||||
m_client->post_message(Messages::WindowClient::MouseMove(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta(), event.is_drag(), event.mime_types()));
|
||||
m_client->async_mouse_move(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta(), event.is_drag(), event.mime_types());
|
||||
break;
|
||||
case Event::MouseDown:
|
||||
m_client->post_message(Messages::WindowClient::MouseDown(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta()));
|
||||
m_client->async_mouse_down(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta());
|
||||
break;
|
||||
case Event::MouseDoubleClick:
|
||||
m_client->post_message(Messages::WindowClient::MouseDoubleClick(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta()));
|
||||
m_client->async_mouse_double_click(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta());
|
||||
break;
|
||||
case Event::MouseUp:
|
||||
m_client->post_message(Messages::WindowClient::MouseUp(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta()));
|
||||
m_client->async_mouse_up(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta());
|
||||
break;
|
||||
case Event::MouseWheel:
|
||||
m_client->post_message(Messages::WindowClient::MouseWheel(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta()));
|
||||
m_client->async_mouse_wheel(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta());
|
||||
break;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
|
@ -414,39 +414,38 @@ void Window::event(Core::Event& event)
|
|||
|
||||
switch (event.type()) {
|
||||
case Event::WindowEntered:
|
||||
m_client->post_message(Messages::WindowClient::WindowEntered(m_window_id));
|
||||
m_client->async_window_entered(m_window_id);
|
||||
break;
|
||||
case Event::WindowLeft:
|
||||
m_client->post_message(Messages::WindowClient::WindowLeft(m_window_id));
|
||||
m_client->async_window_left(m_window_id);
|
||||
break;
|
||||
case Event::KeyDown:
|
||||
handle_keydown_event(static_cast<const KeyEvent&>(event));
|
||||
break;
|
||||
case Event::KeyUp:
|
||||
m_client->post_message(
|
||||
Messages::WindowClient::KeyUp(m_window_id,
|
||||
(u32) static_cast<const KeyEvent&>(event).code_point(),
|
||||
(u32) static_cast<const KeyEvent&>(event).key(),
|
||||
static_cast<const KeyEvent&>(event).modifiers(),
|
||||
(u32) static_cast<const KeyEvent&>(event).scancode()));
|
||||
m_client->async_key_up(m_window_id,
|
||||
(u32) static_cast<const KeyEvent&>(event).code_point(),
|
||||
(u32) static_cast<const KeyEvent&>(event).key(),
|
||||
static_cast<const KeyEvent&>(event).modifiers(),
|
||||
(u32) static_cast<const KeyEvent&>(event).scancode());
|
||||
break;
|
||||
case Event::WindowActivated:
|
||||
m_client->post_message(Messages::WindowClient::WindowActivated(m_window_id));
|
||||
m_client->async_window_activated(m_window_id);
|
||||
break;
|
||||
case Event::WindowDeactivated:
|
||||
m_client->post_message(Messages::WindowClient::WindowDeactivated(m_window_id));
|
||||
m_client->async_window_deactivated(m_window_id);
|
||||
break;
|
||||
case Event::WindowInputEntered:
|
||||
m_client->post_message(Messages::WindowClient::WindowInputEntered(m_window_id));
|
||||
m_client->async_window_input_entered(m_window_id);
|
||||
break;
|
||||
case Event::WindowInputLeft:
|
||||
m_client->post_message(Messages::WindowClient::WindowInputLeft(m_window_id));
|
||||
m_client->async_window_input_left(m_window_id);
|
||||
break;
|
||||
case Event::WindowCloseRequest:
|
||||
m_client->post_message(Messages::WindowClient::WindowCloseRequest(m_window_id));
|
||||
m_client->async_window_close_request(m_window_id);
|
||||
break;
|
||||
case Event::WindowResized:
|
||||
m_client->post_message(Messages::WindowClient::WindowResized(m_window_id, static_cast<const ResizeEvent&>(event).rect()));
|
||||
m_client->async_window_resized(m_window_id, static_cast<const ResizeEvent&>(event).rect());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -471,7 +470,7 @@ void Window::handle_keydown_event(const KeyEvent& event)
|
|||
return;
|
||||
}
|
||||
}
|
||||
m_client->post_message(Messages::WindowClient::KeyDown(m_window_id, (u32)event.code_point(), (u32)event.key(), event.modifiers(), (u32)event.scancode()));
|
||||
m_client->async_key_down(m_window_id, (u32)event.code_point(), (u32)event.key(), event.modifiers(), (u32)event.scancode());
|
||||
}
|
||||
|
||||
void Window::set_global_cursor_tracking_enabled(bool enabled)
|
||||
|
@ -556,7 +555,7 @@ bool Window::invalidate_no_notify(const Gfx::IntRect& rect, bool with_frame)
|
|||
|
||||
void Window::refresh_client_size()
|
||||
{
|
||||
client()->post_message(Messages::WindowClient::WindowResized(m_window_id, m_rect));
|
||||
client()->async_window_resized(m_window_id, m_rect);
|
||||
}
|
||||
|
||||
void Window::prepare_dirty_rects()
|
||||
|
|
|
@ -25,7 +25,7 @@ endpoint WindowClient
|
|||
|
||||
ScreenRectChanged(Gfx::IntRect rect) =|
|
||||
|
||||
AsyncSetWallpaperFinished(bool success) =|
|
||||
SetWallpaperFinished(bool success) =|
|
||||
|
||||
DragAccepted() =|
|
||||
DragCancelled() =|
|
||||
|
|
|
@ -269,7 +269,7 @@ void WindowManager::remove_window(Window& window)
|
|||
if (conn.window_id() < 0 || !(conn.event_mask() & WMEventMask::WindowRemovals))
|
||||
return IterationDecision::Continue;
|
||||
if (!window.is_internal() && !window.is_modal())
|
||||
conn.post_message(Messages::WindowManagerClient::WindowRemoved(conn.window_id(), window.client_id(), window.window_id()));
|
||||
conn.async_window_removed(conn.window_id(), window.client_id(), window.window_id());
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ void WindowManager::tell_wm_about_window(WMClientConnection& conn, Window& windo
|
|||
if (window.is_internal())
|
||||
return;
|
||||
auto* parent = window.parent_window();
|
||||
conn.post_message(Messages::WindowManagerClient::WindowStateChanged(conn.window_id(), window.client_id(), window.window_id(), parent ? parent->client_id() : -1, parent ? parent->window_id() : -1, window.is_active(), window.is_minimized(), window.is_modal_dont_unparent(), window.is_frameless(), (i32)window.type(), window.title(), window.rect(), window.progress()));
|
||||
conn.async_window_state_changed(conn.window_id(), window.client_id(), window.window_id(), parent ? parent->client_id() : -1, parent ? parent->window_id() : -1, window.is_active(), window.is_minimized(), window.is_modal_dont_unparent(), window.is_frameless(), (i32)window.type(), window.title(), window.rect(), window.progress());
|
||||
}
|
||||
|
||||
void WindowManager::tell_wm_about_window_rect(WMClientConnection& conn, Window& window)
|
||||
|
@ -310,7 +310,7 @@ void WindowManager::tell_wm_about_window_rect(WMClientConnection& conn, Window&
|
|||
return;
|
||||
if (window.is_internal())
|
||||
return;
|
||||
conn.post_message(Messages::WindowManagerClient::WindowRectChanged(conn.window_id(), window.client_id(), window.window_id(), window.rect()));
|
||||
conn.async_window_rect_changed(conn.window_id(), window.client_id(), window.window_id(), window.rect());
|
||||
}
|
||||
|
||||
void WindowManager::tell_wm_about_window_icon(WMClientConnection& conn, Window& window)
|
||||
|
@ -321,7 +321,7 @@ void WindowManager::tell_wm_about_window_icon(WMClientConnection& conn, Window&
|
|||
return;
|
||||
if (window.is_internal())
|
||||
return;
|
||||
conn.post_message(Messages::WindowManagerClient::WindowIconBitmapChanged(conn.window_id(), window.client_id(), window.window_id(), window.icon().to_shareable_bitmap()));
|
||||
conn.async_window_icon_bitmap_changed(conn.window_id(), window.client_id(), window.window_id(), window.icon().to_shareable_bitmap());
|
||||
}
|
||||
|
||||
void WindowManager::tell_wms_window_state_changed(Window& window)
|
||||
|
@ -354,7 +354,7 @@ void WindowManager::tell_wms_applet_area_size_changed(const Gfx::IntSize& size)
|
|||
if (conn.window_id() < 0)
|
||||
return IterationDecision::Continue;
|
||||
|
||||
conn.post_message(Messages::WindowManagerClient::AppletAreaSizeChanged(conn.window_id(), size));
|
||||
conn.async_applet_area_size_changed(conn.window_id(), size);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ void WindowManager::tell_wms_super_key_pressed()
|
|||
if (conn.window_id() < 0)
|
||||
return IterationDecision::Continue;
|
||||
|
||||
conn.post_message(Messages::WindowManagerClient::SuperKeyPressed(conn.window_id()));
|
||||
conn.async_super_key_pressed(conn.window_id());
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ void WindowManager::notify_minimization_state_changed(Window& window)
|
|||
tell_wms_window_state_changed(window);
|
||||
|
||||
if (window.client())
|
||||
window.client()->post_message(Messages::WindowClient::WindowStateChanged(window.window_id(), window.is_minimized(), window.is_occluded()));
|
||||
window.client()->async_window_state_changed(window.window_id(), window.is_minimized(), window.is_occluded());
|
||||
|
||||
if (window.is_active() && window.is_minimized())
|
||||
pick_new_active_window(&window);
|
||||
|
@ -436,7 +436,7 @@ void WindowManager::notify_minimization_state_changed(Window& window)
|
|||
void WindowManager::notify_occlusion_state_changed(Window& window)
|
||||
{
|
||||
if (window.client())
|
||||
window.client()->post_message(Messages::WindowClient::WindowStateChanged(window.window_id(), window.is_minimized(), window.is_occluded()));
|
||||
window.client()->async_window_state_changed(window.window_id(), window.is_minimized(), window.is_occluded());
|
||||
}
|
||||
|
||||
void WindowManager::notify_progress_changed(Window& window)
|
||||
|
@ -769,13 +769,13 @@ bool WindowManager::process_ongoing_drag(MouseEvent& event, Window*& hovered_win
|
|||
});
|
||||
|
||||
if (hovered_window) {
|
||||
m_dnd_client->post_message(Messages::WindowClient::DragAccepted());
|
||||
m_dnd_client->async_drag_accepted();
|
||||
if (hovered_window->client()) {
|
||||
auto translated_event = event.translated(-hovered_window->position());
|
||||
hovered_window->client()->post_message(Messages::WindowClient::DragDropped(hovered_window->window_id(), translated_event.position(), m_dnd_text, m_dnd_mime_data->all_data()));
|
||||
hovered_window->client()->async_drag_dropped(hovered_window->window_id(), translated_event.position(), m_dnd_text, m_dnd_mime_data->all_data());
|
||||
}
|
||||
} else {
|
||||
m_dnd_client->post_message(Messages::WindowClient::DragCancelled());
|
||||
m_dnd_client->async_drag_cancelled();
|
||||
}
|
||||
|
||||
end_dnd_drag();
|
||||
|
@ -1190,11 +1190,11 @@ void WindowManager::event(Core::Event& event)
|
|||
// Escape key cancels an ongoing drag.
|
||||
if (key_event.type() == Event::KeyDown && key_event.key() == Key_Escape && m_dnd_client) {
|
||||
// Notify the drag-n-drop client that the drag was cancelled.
|
||||
m_dnd_client->post_message(Messages::WindowClient::DragCancelled());
|
||||
m_dnd_client->async_drag_cancelled();
|
||||
|
||||
// Also notify the currently hovered window (if any) that the ongoing drag was cancelled.
|
||||
if (m_hovered_window && m_hovered_window->client() && m_hovered_window->client() != m_dnd_client)
|
||||
m_hovered_window->client()->post_message(Messages::WindowClient::DragCancelled());
|
||||
m_hovered_window->client()->async_drag_cancelled();
|
||||
|
||||
end_dnd_drag();
|
||||
return;
|
||||
|
@ -1538,7 +1538,7 @@ bool WindowManager::update_theme(String theme_path, String theme_name)
|
|||
for_each_window([&](Window& window) {
|
||||
if (window.client()) {
|
||||
if (!notified_clients.contains(window.client())) {
|
||||
window.client()->post_message(Messages::WindowClient::UpdateSystemTheme(Gfx::current_system_theme_buffer()));
|
||||
window.client()->async_update_system_theme(Gfx::current_system_theme_buffer());
|
||||
notified_clients.set(window.client());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ endpoint WindowServer
|
|||
PopupMenu(i32 menu_id, Gfx::IntPoint screen_position) => ()
|
||||
DismissMenu(i32 menu_id) => ()
|
||||
|
||||
AsyncSetWallpaper(String path) =|
|
||||
SetWallpaper(String path) =|
|
||||
|
||||
SetBackgroundColor(String background_color) => ()
|
||||
SetWallpaperMode(String mode) => ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue