mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 18:57:36 +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
|
@ -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