mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:27:35 +00:00
IPCCompiler: Put message classes in the Messages namespace
This commit is contained in:
parent
0709c17487
commit
2e219255a2
26 changed files with 321 additions and 319 deletions
|
@ -37,7 +37,7 @@ ClientConnection::ClientConnection()
|
|||
|
||||
void ClientConnection::handshake()
|
||||
{
|
||||
auto response = send_sync<AudioServer::Greet>();
|
||||
auto response = send_sync<Messages::AudioServer::Greet>();
|
||||
set_my_client_id(response->client_id());
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ void ClientConnection::enqueue(const Buffer& buffer)
|
|||
{
|
||||
for (;;) {
|
||||
const_cast<Buffer&>(buffer).shared_buffer().share_with(server_pid());
|
||||
auto response = send_sync<AudioServer::EnqueueBuffer>(buffer.shared_buffer_id(), buffer.sample_count());
|
||||
auto response = send_sync<Messages::AudioServer::EnqueueBuffer>(buffer.shared_buffer_id(), buffer.sample_count());
|
||||
if (response->success())
|
||||
break;
|
||||
sleep(1);
|
||||
|
@ -55,62 +55,62 @@ void ClientConnection::enqueue(const Buffer& buffer)
|
|||
bool ClientConnection::try_enqueue(const Buffer& buffer)
|
||||
{
|
||||
const_cast<Buffer&>(buffer).shared_buffer().share_with(server_pid());
|
||||
auto response = send_sync<AudioServer::EnqueueBuffer>(buffer.shared_buffer_id(), buffer.sample_count());
|
||||
auto response = send_sync<Messages::AudioServer::EnqueueBuffer>(buffer.shared_buffer_id(), buffer.sample_count());
|
||||
return response->success();
|
||||
}
|
||||
|
||||
bool ClientConnection::get_muted()
|
||||
{
|
||||
return send_sync<AudioServer::GetMuted>()->muted();
|
||||
return send_sync<Messages::AudioServer::GetMuted>()->muted();
|
||||
}
|
||||
|
||||
void ClientConnection::set_muted(bool muted)
|
||||
{
|
||||
send_sync<AudioServer::SetMuted>(muted);
|
||||
send_sync<Messages::AudioServer::SetMuted>(muted);
|
||||
}
|
||||
|
||||
int ClientConnection::get_main_mix_volume()
|
||||
{
|
||||
return send_sync<AudioServer::GetMainMixVolume>()->volume();
|
||||
return send_sync<Messages::AudioServer::GetMainMixVolume>()->volume();
|
||||
}
|
||||
|
||||
void ClientConnection::set_main_mix_volume(int volume)
|
||||
{
|
||||
send_sync<AudioServer::SetMainMixVolume>(volume);
|
||||
send_sync<Messages::AudioServer::SetMainMixVolume>(volume);
|
||||
}
|
||||
|
||||
int ClientConnection::get_remaining_samples()
|
||||
{
|
||||
return send_sync<AudioServer::GetRemainingSamples>()->remaining_samples();
|
||||
return send_sync<Messages::AudioServer::GetRemainingSamples>()->remaining_samples();
|
||||
}
|
||||
|
||||
int ClientConnection::get_played_samples()
|
||||
{
|
||||
return send_sync<AudioServer::GetPlayedSamples>()->played_samples();
|
||||
return send_sync<Messages::AudioServer::GetPlayedSamples>()->played_samples();
|
||||
}
|
||||
|
||||
void ClientConnection::set_paused(bool paused)
|
||||
{
|
||||
send_sync<AudioServer::SetPaused>(paused);
|
||||
send_sync<Messages::AudioServer::SetPaused>(paused);
|
||||
}
|
||||
|
||||
void ClientConnection::clear_buffer(bool paused)
|
||||
{
|
||||
send_sync<AudioServer::ClearBuffer>(paused);
|
||||
send_sync<Messages::AudioServer::ClearBuffer>(paused);
|
||||
}
|
||||
|
||||
int ClientConnection::get_playing_buffer()
|
||||
{
|
||||
return send_sync<AudioServer::GetPlayingBuffer>()->buffer_id();
|
||||
return send_sync<Messages::AudioServer::GetPlayingBuffer>()->buffer_id();
|
||||
}
|
||||
|
||||
void ClientConnection::handle(const AudioClient::FinishedPlayingBuffer& message)
|
||||
void ClientConnection::handle(const Messages::AudioClient::FinishedPlayingBuffer& message)
|
||||
{
|
||||
if (on_finish_playing_buffer)
|
||||
on_finish_playing_buffer(message.buffer_id());
|
||||
}
|
||||
|
||||
void ClientConnection::handle(const AudioClient::MutedStateChanged& message)
|
||||
void ClientConnection::handle(const Messages::AudioClient::MutedStateChanged& message)
|
||||
{
|
||||
if (on_muted_state_change)
|
||||
on_muted_state_change(message.muted());
|
||||
|
|
|
@ -61,8 +61,8 @@ public:
|
|||
Function<void(bool muted)> on_muted_state_change;
|
||||
|
||||
private:
|
||||
virtual void handle(const AudioClient::FinishedPlayingBuffer&) override;
|
||||
virtual void handle(const AudioClient::MutedStateChanged&) override;
|
||||
virtual void handle(const Messages::AudioClient::FinishedPlayingBuffer&) override;
|
||||
virtual void handle(const Messages::AudioClient::MutedStateChanged&) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ Clipboard::Clipboard()
|
|||
|
||||
Clipboard::DataAndType Clipboard::data_and_type() const
|
||||
{
|
||||
auto response = WindowServerConnection::the().send_sync<WindowServer::GetClipboardContents>();
|
||||
auto response = WindowServerConnection::the().send_sync<Messages::WindowServer::GetClipboardContents>();
|
||||
if (response->shared_buffer_id() < 0)
|
||||
return {};
|
||||
auto shared_buffer = SharedBuffer::create_from_shared_buffer_id(response->shared_buffer_id());
|
||||
|
@ -75,7 +75,7 @@ void Clipboard::set_data(const StringView& data, const String& type)
|
|||
shared_buffer->seal();
|
||||
shared_buffer->share_with(WindowServerConnection::the().server_pid());
|
||||
|
||||
WindowServerConnection::the().send_sync<WindowServer::SetClipboardContents>(shared_buffer->shared_buffer_id(), data.length(), type);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetClipboardContents>(shared_buffer->shared_buffer_id(), data.length(), type);
|
||||
}
|
||||
|
||||
void Clipboard::did_receive_clipboard_contents_changed(Badge<WindowServerConnection>, const String& data_type)
|
||||
|
|
|
@ -55,8 +55,8 @@ void Desktop::did_receive_screen_rect(Badge<WindowServerConnection>, const Gfx::
|
|||
|
||||
bool Desktop::set_wallpaper(const StringView& path)
|
||||
{
|
||||
WindowServerConnection::the().post_message(WindowServer::AsyncSetWallpaper(path));
|
||||
auto ret_val = WindowServerConnection::the().wait_for_specific_message<WindowClient::AsyncSetWallpaperFinished>()->success();
|
||||
WindowServerConnection::the().post_message(Messages::WindowServer::AsyncSetWallpaper(path));
|
||||
auto ret_val = WindowServerConnection::the().wait_for_specific_message<Messages::WindowClient::AsyncSetWallpaperFinished>()->success();
|
||||
|
||||
if (ret_val) {
|
||||
RefPtr<Core::ConfigFile> config = Core::ConfigFile::get_for_app("WindowManager");
|
||||
|
@ -70,7 +70,7 @@ bool Desktop::set_wallpaper(const StringView& path)
|
|||
|
||||
String Desktop::wallpaper() const
|
||||
{
|
||||
return WindowServerConnection::the().send_sync<WindowServer::GetWallpaper>()->path();
|
||||
return WindowServerConnection::the().send_sync<Messages::WindowServer::GetWallpaper>()->path();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ DragOperation::Outcome DragOperation::exec()
|
|||
bitmap_size = shared_bitmap->size();
|
||||
}
|
||||
|
||||
auto response = WindowServerConnection::the().send_sync<WindowServer::StartDrag>(m_text, m_data_type, m_data, bitmap_id, bitmap_size);
|
||||
auto response = WindowServerConnection::the().send_sync<Messages::WindowServer::StartDrag>(m_text, m_data_type, m_data, bitmap_id, bitmap_size);
|
||||
if (!response->started()) {
|
||||
m_outcome = Outcome::Cancelled;
|
||||
return m_outcome;
|
||||
|
|
|
@ -87,19 +87,19 @@ void Menu::realize_if_needed()
|
|||
void Menu::popup(const Gfx::Point& screen_position)
|
||||
{
|
||||
realize_if_needed();
|
||||
WindowServerConnection::the().post_message(WindowServer::PopupMenu(m_menu_id, screen_position));
|
||||
WindowServerConnection::the().post_message(Messages::WindowServer::PopupMenu(m_menu_id, screen_position));
|
||||
}
|
||||
|
||||
void Menu::dismiss()
|
||||
{
|
||||
if (m_menu_id == -1)
|
||||
return;
|
||||
WindowServerConnection::the().post_message(WindowServer::DismissMenu(m_menu_id));
|
||||
WindowServerConnection::the().post_message(Messages::WindowServer::DismissMenu(m_menu_id));
|
||||
}
|
||||
|
||||
int Menu::realize_menu()
|
||||
{
|
||||
m_menu_id = WindowServerConnection::the().send_sync<WindowServer::CreateMenu>(m_name)->menu_id();
|
||||
m_menu_id = WindowServerConnection::the().send_sync<Messages::WindowServer::CreateMenu>(m_name)->menu_id();
|
||||
|
||||
#ifdef MENU_DEBUG
|
||||
dbgprintf("GUI::Menu::realize_menu(): New menu ID: %d\n", m_menu_id);
|
||||
|
@ -110,13 +110,13 @@ int Menu::realize_menu()
|
|||
item.set_menu_id({}, m_menu_id);
|
||||
item.set_identifier({}, i);
|
||||
if (item.type() == MenuItem::Type::Separator) {
|
||||
WindowServerConnection::the().send_sync<WindowServer::AddMenuSeparator>(m_menu_id);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::AddMenuSeparator>(m_menu_id);
|
||||
continue;
|
||||
}
|
||||
if (item.type() == MenuItem::Type::Submenu) {
|
||||
auto& submenu = *item.submenu();
|
||||
submenu.realize_if_needed();
|
||||
WindowServerConnection::the().send_sync<WindowServer::AddMenuItem>(m_menu_id, i, submenu.menu_id(), submenu.name(), true, false, false, "", -1, false);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::AddMenuItem>(m_menu_id, i, submenu.menu_id(), submenu.name(), true, false, false, "", -1, false);
|
||||
continue;
|
||||
}
|
||||
if (item.type() == MenuItem::Type::Action) {
|
||||
|
@ -138,7 +138,7 @@ int Menu::realize_menu()
|
|||
}
|
||||
auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_string() : String();
|
||||
bool exclusive = action.group() && action.group()->is_exclusive() && action.is_checkable();
|
||||
WindowServerConnection::the().send_sync<WindowServer::AddMenuItem>(m_menu_id, i, -1, action.text(), action.is_enabled(), action.is_checkable(), action.is_checkable() ? action.is_checked() : false, shortcut_text, icon_buffer_id, exclusive);
|
||||
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, shortcut_text, icon_buffer_id, exclusive);
|
||||
}
|
||||
}
|
||||
all_menus().set(m_menu_id, this);
|
||||
|
@ -150,7 +150,7 @@ void Menu::unrealize_menu()
|
|||
if (m_menu_id == -1)
|
||||
return;
|
||||
all_menus().remove(m_menu_id);
|
||||
WindowServerConnection::the().send_sync<WindowServer::DestroyMenu>(m_menu_id);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::DestroyMenu>(m_menu_id);
|
||||
m_menu_id = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,14 +45,14 @@ void MenuBar::add_menu(NonnullRefPtr<Menu> menu)
|
|||
|
||||
int MenuBar::realize_menubar()
|
||||
{
|
||||
return WindowServerConnection::the().send_sync<WindowServer::CreateMenubar>()->menubar_id();
|
||||
return WindowServerConnection::the().send_sync<Messages::WindowServer::CreateMenubar>()->menubar_id();
|
||||
}
|
||||
|
||||
void MenuBar::unrealize_menubar()
|
||||
{
|
||||
if (m_menubar_id == -1)
|
||||
return;
|
||||
WindowServerConnection::the().send_sync<WindowServer::DestroyMenubar>(m_menubar_id);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::DestroyMenubar>(m_menubar_id);
|
||||
m_menubar_id = -1;
|
||||
}
|
||||
|
||||
|
@ -64,9 +64,9 @@ void MenuBar::notify_added_to_application(Badge<Application>)
|
|||
for (auto& menu : m_menus) {
|
||||
int menu_id = menu.realize_menu();
|
||||
ASSERT(menu_id != -1);
|
||||
WindowServerConnection::the().send_sync<WindowServer::AddMenuToMenubar>(m_menubar_id, menu_id);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::AddMenuToMenubar>(m_menubar_id, menu_id);
|
||||
}
|
||||
WindowServerConnection::the().send_sync<WindowServer::SetApplicationMenubar>(m_menubar_id);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetApplicationMenubar>(m_menubar_id);
|
||||
}
|
||||
|
||||
void MenuBar::notify_removed_from_application(Badge<Application>)
|
||||
|
|
|
@ -85,7 +85,7 @@ void MenuItem::update_window_server()
|
|||
return;
|
||||
auto& action = *m_action;
|
||||
auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_string() : String();
|
||||
WindowServerConnection::the().send_sync<WindowServer::UpdateMenuItem>(m_menu_id, m_identifier, -1, action.text(), action.is_enabled(), action.is_checkable(), action.is_checkable() ? action.is_checked() : false, shortcut_text);
|
||||
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, shortcut_text);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,14 +79,14 @@ void Window::move_to_front()
|
|||
if (!m_window_id)
|
||||
return;
|
||||
|
||||
WindowServerConnection::the().send_sync<WindowServer::MoveWindowToFront>(m_window_id);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::MoveWindowToFront>(m_window_id);
|
||||
}
|
||||
|
||||
void Window::show()
|
||||
{
|
||||
if (m_window_id)
|
||||
return;
|
||||
auto response = WindowServerConnection::the().send_sync<WindowServer::CreateWindow>(
|
||||
auto response = WindowServerConnection::the().send_sync<Messages::WindowServer::CreateWindow>(
|
||||
m_rect_when_windowless,
|
||||
m_has_alpha_channel,
|
||||
m_modal,
|
||||
|
@ -113,7 +113,7 @@ void Window::hide()
|
|||
if (!m_window_id)
|
||||
return;
|
||||
reified_windows->remove(m_window_id);
|
||||
WindowServerConnection::the().send_sync<WindowServer::DestroyWindow>(m_window_id);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::DestroyWindow>(m_window_id);
|
||||
m_window_id = 0;
|
||||
m_pending_paint_event_rects.clear();
|
||||
m_back_bitmap = nullptr;
|
||||
|
@ -135,21 +135,21 @@ void Window::set_title(const StringView& title)
|
|||
m_title_when_windowless = title;
|
||||
if (!m_window_id)
|
||||
return;
|
||||
WindowServerConnection::the().send_sync<WindowServer::SetWindowTitle>(m_window_id, title);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowTitle>(m_window_id, title);
|
||||
}
|
||||
|
||||
String Window::title() const
|
||||
{
|
||||
if (!m_window_id)
|
||||
return m_title_when_windowless;
|
||||
return WindowServerConnection::the().send_sync<WindowServer::GetWindowTitle>(m_window_id)->title();
|
||||
return WindowServerConnection::the().send_sync<Messages::WindowServer::GetWindowTitle>(m_window_id)->title();
|
||||
}
|
||||
|
||||
Gfx::Rect Window::rect() const
|
||||
{
|
||||
if (!m_window_id)
|
||||
return m_rect_when_windowless;
|
||||
return WindowServerConnection::the().send_sync<WindowServer::GetWindowRect>(m_window_id)->rect();
|
||||
return WindowServerConnection::the().send_sync<Messages::WindowServer::GetWindowRect>(m_window_id)->rect();
|
||||
}
|
||||
|
||||
void Window::set_rect(const Gfx::Rect& a_rect)
|
||||
|
@ -160,7 +160,7 @@ void Window::set_rect(const Gfx::Rect& a_rect)
|
|||
m_main_widget->resize(m_rect_when_windowless.size());
|
||||
return;
|
||||
}
|
||||
WindowServerConnection::the().send_sync<WindowServer::SetWindowRect>(m_window_id, a_rect);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowRect>(m_window_id, a_rect);
|
||||
if (m_back_bitmap && m_back_bitmap->size() != a_rect.size())
|
||||
m_back_bitmap = nullptr;
|
||||
if (m_front_bitmap && m_front_bitmap->size() != a_rect.size())
|
||||
|
@ -178,7 +178,7 @@ void Window::set_override_cursor(StandardCursor cursor)
|
|||
{
|
||||
if (!m_window_id)
|
||||
return;
|
||||
WindowServerConnection::the().send_sync<WindowServer::SetWindowOverrideCursor>(m_window_id, (u32)cursor);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowOverrideCursor>(m_window_id, (u32)cursor);
|
||||
}
|
||||
|
||||
void Window::event(Core::Event& event)
|
||||
|
@ -267,7 +267,7 @@ void Window::event(Core::Event& event)
|
|||
Vector<Gfx::Rect> rects_to_send;
|
||||
for (auto& r : rects)
|
||||
rects_to_send.append(r);
|
||||
WindowServerConnection::the().post_message(WindowServer::DidFinishPainting(m_window_id, rects_to_send));
|
||||
WindowServerConnection::the().post_message(Messages::WindowServer::DidFinishPainting(m_window_id, rects_to_send));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ void Window::update(const Gfx::Rect& a_rect)
|
|||
Vector<Gfx::Rect> rects_to_send;
|
||||
for (auto& r : rects)
|
||||
rects_to_send.append(r);
|
||||
WindowServerConnection::the().post_message(WindowServer::InvalidateRect(m_window_id, rects_to_send));
|
||||
WindowServerConnection::the().post_message(Messages::WindowServer::InvalidateRect(m_window_id, rects_to_send));
|
||||
});
|
||||
}
|
||||
m_pending_paint_event_rects.append(a_rect);
|
||||
|
@ -424,7 +424,7 @@ void Window::set_has_alpha_channel(bool value)
|
|||
m_back_bitmap = nullptr;
|
||||
m_front_bitmap = nullptr;
|
||||
|
||||
WindowServerConnection::the().send_sync<WindowServer::SetWindowHasAlphaChannel>(m_window_id, value);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowHasAlphaChannel>(m_window_id, value);
|
||||
update();
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ void Window::set_opacity(float opacity)
|
|||
m_opacity_when_windowless = opacity;
|
||||
if (!m_window_id)
|
||||
return;
|
||||
WindowServerConnection::the().send_sync<WindowServer::SetWindowOpacity>(m_window_id, opacity);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowOpacity>(m_window_id, opacity);
|
||||
}
|
||||
|
||||
void Window::set_hovered_widget(Widget* widget)
|
||||
|
@ -458,7 +458,7 @@ void Window::set_hovered_widget(Widget* widget)
|
|||
|
||||
void Window::set_current_backing_bitmap(Gfx::Bitmap& bitmap, bool flush_immediately)
|
||||
{
|
||||
WindowServerConnection::the().send_sync<WindowServer::SetWindowBackingStore>(m_window_id, 32, bitmap.pitch(), bitmap.shared_buffer_id(), bitmap.has_alpha_channel(), bitmap.size(), flush_immediately);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowBackingStore>(m_window_id, 32, bitmap.pitch(), bitmap.shared_buffer_id(), bitmap.has_alpha_channel(), bitmap.size(), flush_immediately);
|
||||
}
|
||||
|
||||
void Window::flip(const Vector<Gfx::Rect, 32>& dirty_rects)
|
||||
|
@ -542,12 +542,12 @@ void Window::apply_icon()
|
|||
if (!has_set_process_icon)
|
||||
set_process_icon(m_icon->shared_buffer_id());
|
||||
|
||||
WindowServerConnection::the().send_sync<WindowServer::SetWindowIconBitmap>(m_window_id, m_icon->shared_buffer_id(), m_icon->size());
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowIconBitmap>(m_window_id, m_icon->shared_buffer_id(), m_icon->size());
|
||||
}
|
||||
|
||||
void Window::start_wm_resize()
|
||||
{
|
||||
WindowServerConnection::the().post_message(WindowServer::WM_StartWindowResize(WindowServerConnection::the().my_client_id(), m_window_id));
|
||||
WindowServerConnection::the().post_message(Messages::WindowServer::WM_StartWindowResize(WindowServerConnection::the().my_client_id(), m_window_id));
|
||||
}
|
||||
|
||||
Vector<Widget*> Window::focusable_widgets() const
|
||||
|
@ -595,7 +595,7 @@ void Window::set_fullscreen(bool fullscreen)
|
|||
m_fullscreen = fullscreen;
|
||||
if (!m_window_id)
|
||||
return;
|
||||
WindowServerConnection::the().send_sync<WindowServer::SetFullscreen>(m_window_id, fullscreen);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetFullscreen>(m_window_id, fullscreen);
|
||||
}
|
||||
|
||||
void Window::schedule_relayout()
|
||||
|
|
|
@ -59,19 +59,19 @@ static void set_system_theme_from_shared_buffer_id(int id)
|
|||
|
||||
void WindowServerConnection::handshake()
|
||||
{
|
||||
auto response = send_sync<WindowServer::Greet>();
|
||||
auto response = send_sync<Messages::WindowServer::Greet>();
|
||||
set_my_client_id(response->client_id());
|
||||
set_system_theme_from_shared_buffer_id(response->system_theme_buffer_id());
|
||||
Desktop::the().did_receive_screen_rect({}, response->screen_rect());
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::UpdateSystemTheme& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::UpdateSystemTheme& message)
|
||||
{
|
||||
set_system_theme_from_shared_buffer_id(message.system_theme_buffer_id());
|
||||
Window::update_all_windows({});
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::Paint& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::Paint& message)
|
||||
{
|
||||
#ifdef GEVENTLOOP_DEBUG
|
||||
dbgprintf("WID=%d Paint\n", message.window_id());
|
||||
|
@ -80,14 +80,14 @@ void WindowServerConnection::handle(const WindowClient::Paint& message)
|
|||
Core::EventLoop::current().post_event(*window, make<MultiPaintEvent>(message.rects(), message.window_size()));
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::WindowResized& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::WindowResized& message)
|
||||
{
|
||||
if (auto* window = Window::from_window_id(message.window_id())) {
|
||||
Core::EventLoop::current().post_event(*window, make<ResizeEvent>(message.old_rect().size(), message.new_rect().size()));
|
||||
}
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::WindowActivated& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::WindowActivated& message)
|
||||
{
|
||||
#ifdef GEVENTLOOP_DEBUG
|
||||
dbgprintf("(%d) WID=%d WindowActivated\n", getpid(), message.window_id());
|
||||
|
@ -96,7 +96,7 @@ void WindowServerConnection::handle(const WindowClient::WindowActivated& message
|
|||
Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowBecameActive));
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::WindowDeactivated& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::WindowDeactivated& message)
|
||||
{
|
||||
#ifdef GEVENTLOOP_DEBUG
|
||||
dbgprintf("(%d) WID=%d WindowDeactivated\n", getpid(), message.window_id());
|
||||
|
@ -105,25 +105,25 @@ void WindowServerConnection::handle(const WindowClient::WindowDeactivated& messa
|
|||
Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowBecameInactive));
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::WindowCloseRequest& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::WindowCloseRequest& message)
|
||||
{
|
||||
if (auto* window = Window::from_window_id(message.window_id()))
|
||||
Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowCloseRequest));
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::WindowEntered& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::WindowEntered& message)
|
||||
{
|
||||
if (auto* window = Window::from_window_id(message.window_id()))
|
||||
Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowEntered));
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::WindowLeft& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::WindowLeft& message)
|
||||
{
|
||||
if (auto* window = Window::from_window_id(message.window_id()))
|
||||
Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowLeft));
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::KeyDown& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::KeyDown& message)
|
||||
{
|
||||
#ifdef GEVENTLOOP_DEBUG
|
||||
dbgprintf("WID=%d KeyDown character=0x%02x\n", message.window_id(), message.character());
|
||||
|
@ -156,7 +156,7 @@ void WindowServerConnection::handle(const WindowClient::KeyDown& message)
|
|||
Core::EventLoop::current().post_event(*window, move(key_event));
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::KeyUp& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::KeyUp& message)
|
||||
{
|
||||
#ifdef GEVENTLOOP_DEBUG
|
||||
dbgprintf("WID=%d KeyUp character=0x%02x\n", message.window_id(), message.character());
|
||||
|
@ -191,7 +191,7 @@ MouseButton to_gmousebutton(u32 button)
|
|||
}
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::MouseDown& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::MouseDown& message)
|
||||
{
|
||||
#ifdef GEVENTLOOP_DEBUG
|
||||
dbgprintf("WID=%d MouseDown %d,%d,%d\n", message.window_id(), message.mouse_position().x(), message.mouse_position().y(), message.wheel_delta();
|
||||
|
@ -201,7 +201,7 @@ void WindowServerConnection::handle(const WindowClient::MouseDown& message)
|
|||
Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseDown, message.mouse_position(), message.buttons(), to_gmousebutton(message.button()), message.modifiers(), message.wheel_delta()));
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::MouseUp& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::MouseUp& message)
|
||||
{
|
||||
#ifdef GEVENTLOOP_DEBUG
|
||||
dbgprintf("WID=%d MouseUp %d,%d,%d\n", message.window_id(), message.mouse_position().x(), message.mouse_position().y(), message.wheel_delta();
|
||||
|
@ -211,7 +211,7 @@ void WindowServerConnection::handle(const WindowClient::MouseUp& message)
|
|||
Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseUp, message.mouse_position(), message.buttons(), to_gmousebutton(message.button()), message.modifiers(), message.wheel_delta()));
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::MouseMove& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::MouseMove& message)
|
||||
{
|
||||
#ifdef GEVENTLOOP_DEBUG
|
||||
dbgprintf("WID=%d MouseMove %d,%d,%d\n", message.window_id(), message.mouse_position().x(), message.mouse_position().y(), message.wheel_delta();
|
||||
|
@ -221,7 +221,7 @@ void WindowServerConnection::handle(const WindowClient::MouseMove& message)
|
|||
Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseMove, message.mouse_position(), message.buttons(), to_gmousebutton(message.button()), message.modifiers(), message.wheel_delta()));
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::MouseDoubleClick& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::MouseDoubleClick& message)
|
||||
{
|
||||
#ifdef GEVENTLOOP_DEBUG
|
||||
dbgprintf("WID=%d MouseDoubleClick %d,%d,%d\n", message.window_id(), message.mouse_position().x(), message.mouse_position().y(), message.wheel_delta();
|
||||
|
@ -231,7 +231,7 @@ void WindowServerConnection::handle(const WindowClient::MouseDoubleClick& messag
|
|||
Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseDoubleClick, message.mouse_position(), message.buttons(), to_gmousebutton(message.button()), message.modifiers(), message.wheel_delta()));
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::MouseWheel& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::MouseWheel& message)
|
||||
{
|
||||
#ifdef GEVENTLOOP_DEBUG
|
||||
dbgprintf("WID=%d MouseWheel %d,%d,%d\n", message.window_id(), message.mouse_position().x(), message.mouse_position().y(), message.wheel_delta();
|
||||
|
@ -241,7 +241,7 @@ void WindowServerConnection::handle(const WindowClient::MouseWheel& message)
|
|||
Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseWheel, message.mouse_position(), message.buttons(), to_gmousebutton(message.button()), message.modifiers(), message.wheel_delta()));
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::MenuItemActivated& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::MenuItemActivated& message)
|
||||
{
|
||||
auto* menu = Menu::from_menu_id(message.menu_id());
|
||||
if (!menu) {
|
||||
|
@ -252,7 +252,7 @@ void WindowServerConnection::handle(const WindowClient::MenuItemActivated& messa
|
|||
action->activate(menu);
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::WM_WindowStateChanged& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::WM_WindowStateChanged& message)
|
||||
{
|
||||
#ifdef GEVENTLOOP_DEBUG
|
||||
dbgprintf("EventLoop: handle_wm_event: %d\n", (int)event.type);
|
||||
|
@ -261,7 +261,7 @@ void WindowServerConnection::handle(const WindowClient::WM_WindowStateChanged& m
|
|||
Core::EventLoop::current().post_event(*window, make<WMWindowStateChangedEvent>(message.client_id(), message.window_id(), message.title(), message.rect(), message.is_active(), static_cast<WindowType>(message.window_type()), message.is_minimized()));
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::WM_WindowRectChanged& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::WM_WindowRectChanged& message)
|
||||
{
|
||||
#ifdef GEVENTLOOP_DEBUG
|
||||
dbgprintf("EventLoop: handle_wm_event: %d\n", (int)event.type);
|
||||
|
@ -270,7 +270,7 @@ void WindowServerConnection::handle(const WindowClient::WM_WindowRectChanged& me
|
|||
Core::EventLoop::current().post_event(*window, make<WMWindowRectChangedEvent>(message.client_id(), message.window_id(), message.rect()));
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::WM_WindowIconBitmapChanged& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::WM_WindowIconBitmapChanged& message)
|
||||
{
|
||||
#ifdef GEVENTLOOP_DEBUG
|
||||
dbgprintf("EventLoop: handle_wm_event: %d\n", (int)event.type);
|
||||
|
@ -279,7 +279,7 @@ void WindowServerConnection::handle(const WindowClient::WM_WindowIconBitmapChang
|
|||
Core::EventLoop::current().post_event(*window, make<WMWindowIconBitmapChangedEvent>(message.client_id(), message.window_id(), message.icon_buffer_id(), message.icon_size()));
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::WM_WindowRemoved& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::WM_WindowRemoved& message)
|
||||
{
|
||||
#ifdef GEVENTLOOP_DEBUG
|
||||
dbgprintf("EventLoop: handle_wm_event: %d\n", (int)event.type);
|
||||
|
@ -288,38 +288,38 @@ void WindowServerConnection::handle(const WindowClient::WM_WindowRemoved& messag
|
|||
Core::EventLoop::current().post_event(*window, make<WMWindowRemovedEvent>(message.client_id(), message.window_id()));
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::ScreenRectChanged& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::ScreenRectChanged& message)
|
||||
{
|
||||
Desktop::the().did_receive_screen_rect({}, message.rect());
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::ClipboardContentsChanged& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::ClipboardContentsChanged& message)
|
||||
{
|
||||
Clipboard::the().did_receive_clipboard_contents_changed({}, message.content_type());
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::AsyncSetWallpaperFinished&)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::AsyncSetWallpaperFinished&)
|
||||
{
|
||||
// This is handled manually by Desktop::set_wallpaper().
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::DragDropped& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::DragDropped& message)
|
||||
{
|
||||
if (auto* window = Window::from_window_id(message.window_id()))
|
||||
Core::EventLoop::current().post_event(*window, make<DropEvent>(message.mouse_position(), message.text(), message.data_type(), message.data()));
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::DragAccepted&)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::DragAccepted&)
|
||||
{
|
||||
DragOperation::notify_accepted({});
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::DragCancelled&)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::DragCancelled&)
|
||||
{
|
||||
DragOperation::notify_cancelled({});
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const WindowClient::WindowStateChanged& message)
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::WindowStateChanged& message)
|
||||
{
|
||||
if (auto* window = Window::from_window_id(message.window_id()))
|
||||
window->notify_state_changed({}, message.minimized(), message.occluded());
|
||||
|
|
|
@ -47,33 +47,33 @@ public:
|
|||
static WindowServerConnection& the();
|
||||
|
||||
private:
|
||||
virtual void handle(const WindowClient::Paint&) override;
|
||||
virtual void handle(const WindowClient::MouseMove&) override;
|
||||
virtual void handle(const WindowClient::MouseDown&) override;
|
||||
virtual void handle(const WindowClient::MouseDoubleClick&) override;
|
||||
virtual void handle(const WindowClient::MouseUp&) override;
|
||||
virtual void handle(const WindowClient::MouseWheel&) override;
|
||||
virtual void handle(const WindowClient::WindowEntered&) override;
|
||||
virtual void handle(const WindowClient::WindowLeft&) override;
|
||||
virtual void handle(const WindowClient::KeyDown&) override;
|
||||
virtual void handle(const WindowClient::KeyUp&) override;
|
||||
virtual void handle(const WindowClient::WindowActivated&) override;
|
||||
virtual void handle(const WindowClient::WindowDeactivated&) override;
|
||||
virtual void handle(const WindowClient::WindowCloseRequest&) override;
|
||||
virtual void handle(const WindowClient::WindowResized&) override;
|
||||
virtual void handle(const WindowClient::MenuItemActivated&) override;
|
||||
virtual void handle(const WindowClient::ScreenRectChanged&) override;
|
||||
virtual void handle(const WindowClient::ClipboardContentsChanged&) override;
|
||||
virtual void handle(const WindowClient::WM_WindowRemoved&) override;
|
||||
virtual void handle(const WindowClient::WM_WindowStateChanged&) override;
|
||||
virtual void handle(const WindowClient::WM_WindowIconBitmapChanged&) override;
|
||||
virtual void handle(const WindowClient::WM_WindowRectChanged&) override;
|
||||
virtual void handle(const WindowClient::AsyncSetWallpaperFinished&) override;
|
||||
virtual void handle(const WindowClient::DragDropped&) override;
|
||||
virtual void handle(const WindowClient::DragAccepted&) override;
|
||||
virtual void handle(const WindowClient::DragCancelled&) override;
|
||||
virtual void handle(const WindowClient::UpdateSystemTheme&) override;
|
||||
virtual void handle(const WindowClient::WindowStateChanged&) override;
|
||||
virtual void handle(const Messages::WindowClient::Paint&) override;
|
||||
virtual void handle(const Messages::WindowClient::MouseMove&) override;
|
||||
virtual void handle(const Messages::WindowClient::MouseDown&) override;
|
||||
virtual void handle(const Messages::WindowClient::MouseDoubleClick&) override;
|
||||
virtual void handle(const Messages::WindowClient::MouseUp&) override;
|
||||
virtual void handle(const Messages::WindowClient::MouseWheel&) override;
|
||||
virtual void handle(const Messages::WindowClient::WindowEntered&) override;
|
||||
virtual void handle(const Messages::WindowClient::WindowLeft&) override;
|
||||
virtual void handle(const Messages::WindowClient::KeyDown&) override;
|
||||
virtual void handle(const Messages::WindowClient::KeyUp&) override;
|
||||
virtual void handle(const Messages::WindowClient::WindowActivated&) override;
|
||||
virtual void handle(const Messages::WindowClient::WindowDeactivated&) override;
|
||||
virtual void handle(const Messages::WindowClient::WindowCloseRequest&) override;
|
||||
virtual void handle(const Messages::WindowClient::WindowResized&) override;
|
||||
virtual void handle(const Messages::WindowClient::MenuItemActivated&) override;
|
||||
virtual void handle(const Messages::WindowClient::ScreenRectChanged&) override;
|
||||
virtual void handle(const Messages::WindowClient::ClipboardContentsChanged&) override;
|
||||
virtual void handle(const Messages::WindowClient::WM_WindowRemoved&) override;
|
||||
virtual void handle(const Messages::WindowClient::WM_WindowStateChanged&) override;
|
||||
virtual void handle(const Messages::WindowClient::WM_WindowIconBitmapChanged&) override;
|
||||
virtual void handle(const Messages::WindowClient::WM_WindowRectChanged&) override;
|
||||
virtual void handle(const Messages::WindowClient::AsyncSetWallpaperFinished&) override;
|
||||
virtual void handle(const Messages::WindowClient::DragDropped&) override;
|
||||
virtual void handle(const Messages::WindowClient::DragAccepted&) override;
|
||||
virtual void handle(const Messages::WindowClient::DragCancelled&) override;
|
||||
virtual void handle(const Messages::WindowClient::UpdateSystemTheme&) override;
|
||||
virtual void handle(const Messages::WindowClient::WindowStateChanged&) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -38,18 +38,18 @@ Client::Client()
|
|||
|
||||
void Client::handshake()
|
||||
{
|
||||
auto response = send_sync<ProtocolServer::Greet>();
|
||||
auto response = send_sync<Messages::ProtocolServer::Greet>();
|
||||
set_my_client_id(response->client_id());
|
||||
}
|
||||
|
||||
bool Client::is_supported_protocol(const String& protocol)
|
||||
{
|
||||
return send_sync<ProtocolServer::IsSupportedProtocol>(protocol)->supported();
|
||||
return send_sync<Messages::ProtocolServer::IsSupportedProtocol>(protocol)->supported();
|
||||
}
|
||||
|
||||
RefPtr<Download> Client::start_download(const String& url)
|
||||
{
|
||||
i32 download_id = send_sync<ProtocolServer::StartDownload>(url)->download_id();
|
||||
i32 download_id = send_sync<Messages::ProtocolServer::StartDownload>(url)->download_id();
|
||||
auto download = Download::create_from_id({}, *this, download_id);
|
||||
m_downloads.set(download_id, download);
|
||||
return download;
|
||||
|
@ -59,20 +59,20 @@ bool Client::stop_download(Badge<Download>, Download& download)
|
|||
{
|
||||
if (!m_downloads.contains(download.id()))
|
||||
return false;
|
||||
return send_sync<ProtocolServer::StopDownload>(download.id())->success();
|
||||
return send_sync<Messages::ProtocolServer::StopDownload>(download.id())->success();
|
||||
}
|
||||
|
||||
void Client::handle(const ProtocolClient::DownloadFinished& message)
|
||||
void Client::handle(const Messages::ProtocolClient::DownloadFinished& message)
|
||||
{
|
||||
RefPtr<Download> download;
|
||||
if ((download = m_downloads.get(message.download_id()).value_or(nullptr))) {
|
||||
download->did_finish({}, message.success(), message.total_size(), message.shared_buffer_id());
|
||||
}
|
||||
send_sync<ProtocolServer::DisownSharedBuffer>(message.shared_buffer_id());
|
||||
send_sync<Messages::ProtocolServer::DisownSharedBuffer>(message.shared_buffer_id());
|
||||
m_downloads.remove(message.download_id());
|
||||
}
|
||||
|
||||
void Client::handle(const ProtocolClient::DownloadProgress& message)
|
||||
void Client::handle(const Messages::ProtocolClient::DownloadProgress& message)
|
||||
{
|
||||
if (auto download = m_downloads.get(message.download_id()).value_or(nullptr)) {
|
||||
download->did_progress({}, message.total_size(), message.downloaded_size());
|
||||
|
|
|
@ -48,8 +48,8 @@ public:
|
|||
bool stop_download(Badge<Download>, Download&);
|
||||
|
||||
private:
|
||||
virtual void handle(const ProtocolClient::DownloadProgress&) override;
|
||||
virtual void handle(const ProtocolClient::DownloadFinished&) override;
|
||||
virtual void handle(const Messages::ProtocolClient::DownloadProgress&) override;
|
||||
virtual void handle(const Messages::ProtocolClient::DownloadFinished&) override;
|
||||
|
||||
HashMap<i32, RefPtr<Download>> m_downloads;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue