mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 09:42:45 +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
				
			
		|  | @ -224,7 +224,7 @@ void DisplayPropertiesWidget::send_settings_to_window_server(int tab_index) | ||||||
|         GUI::Desktop::the().set_wallpaper(builder.to_string()); |         GUI::Desktop::the().set_wallpaper(builder.to_string()); | ||||||
|     } else if (tab_index == TabIndices::Settings) { |     } else if (tab_index == TabIndices::Settings) { | ||||||
|         dbg() << "Attempting to set resolution " << m_selected_resolution; |         dbg() << "Attempting to set resolution " << m_selected_resolution; | ||||||
|         GUI::WindowServerConnection::the().send_sync<WindowServer::SetResolution>(m_selected_resolution); |         GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetResolution>(m_selected_resolution); | ||||||
|     } else { |     } else { | ||||||
|         dbg() << "Invalid tab index " << tab_index; |         dbg() << "Invalid tab index " << tab_index; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -40,13 +40,13 @@ TaskbarButton::~TaskbarButton() | ||||||
| 
 | 
 | ||||||
| void TaskbarButton::context_menu_event(GUI::ContextMenuEvent&) | void TaskbarButton::context_menu_event(GUI::ContextMenuEvent&) | ||||||
| { | { | ||||||
|     GUI::WindowServerConnection::the().post_message(WindowServer::WM_PopupWindowMenu(m_identifier.client_id(), m_identifier.window_id(), screen_relative_rect().location())); |     GUI::WindowServerConnection::the().post_message(Messages::WindowServer::WM_PopupWindowMenu(m_identifier.client_id(), m_identifier.window_id(), screen_relative_rect().location())); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void TaskbarButton::resize_event(GUI::ResizeEvent& event) | void TaskbarButton::resize_event(GUI::ResizeEvent& event) | ||||||
| { | { | ||||||
|     GUI::WindowServerConnection::the().post_message( |     GUI::WindowServerConnection::the().post_message( | ||||||
|         WindowServer::WM_SetWindowTaskbarRect( |         Messages::WindowServer::WM_SetWindowTaskbarRect( | ||||||
|             m_identifier.client_id(), |             m_identifier.client_id(), | ||||||
|             m_identifier.window_id(), |             m_identifier.window_id(), | ||||||
|             screen_relative_rect())); |             screen_relative_rect())); | ||||||
|  |  | ||||||
|  | @ -52,9 +52,9 @@ Window& WindowList::ensure_window(const WindowIdentifier& identifier) | ||||||
|     window->set_button(aid_create_button(identifier)); |     window->set_button(aid_create_button(identifier)); | ||||||
|     window->button()->on_click = [window = window.ptr(), identifier](auto&) { |     window->button()->on_click = [window = window.ptr(), identifier](auto&) { | ||||||
|         if (window->is_minimized() || !window->is_active()) { |         if (window->is_minimized() || !window->is_active()) { | ||||||
|             GUI::WindowServerConnection::the().post_message(WindowServer::WM_SetActiveWindow(identifier.client_id(), identifier.window_id())); |             GUI::WindowServerConnection::the().post_message(Messages::WindowServer::WM_SetActiveWindow(identifier.client_id(), identifier.window_id())); | ||||||
|         } else { |         } else { | ||||||
|             GUI::WindowServerConnection::the().post_message(WindowServer::WM_SetWindowMinimized(identifier.client_id(), identifier.window_id(), true)); |             GUI::WindowServerConnection::the().post_message(Messages::WindowServer::WM_SetWindowMinimized(identifier.client_id(), identifier.window_id(), true)); | ||||||
|         } |         } | ||||||
|     }; |     }; | ||||||
|     auto& window_ref = *window; |     auto& window_ref = *window; | ||||||
|  |  | ||||||
|  | @ -233,6 +233,7 @@ int main(int argc, char** argv) | ||||||
|     dbg(); |     dbg(); | ||||||
| 
 | 
 | ||||||
|     for (auto& endpoint : endpoints) { |     for (auto& endpoint : endpoints) { | ||||||
|  |         dbg() << "namespace Messages {"; | ||||||
|         dbg() << "namespace " << endpoint.name << " {"; |         dbg() << "namespace " << endpoint.name << " {"; | ||||||
|         dbg(); |         dbg(); | ||||||
| 
 | 
 | ||||||
|  | @ -445,6 +446,7 @@ int main(int argc, char** argv) | ||||||
|             do_message(message.name, message.inputs, response_name); |             do_message(message.name, message.inputs, response_name); | ||||||
|         } |         } | ||||||
|         dbg() << "} // namespace " << endpoint.name; |         dbg() << "} // namespace " << endpoint.name; | ||||||
|  |         dbg() << "} // namespace Messages"; | ||||||
|         dbg(); |         dbg(); | ||||||
| 
 | 
 | ||||||
|         dbg() << "class " << endpoint.name << "Endpoint : public IPC::Endpoint {"; |         dbg() << "class " << endpoint.name << "Endpoint : public IPC::Endpoint {"; | ||||||
|  | @ -471,8 +473,8 @@ int main(int argc, char** argv) | ||||||
|         dbg() << "        switch (message_id) {"; |         dbg() << "        switch (message_id) {"; | ||||||
|         for (auto& message : endpoint.messages) { |         for (auto& message : endpoint.messages) { | ||||||
|             auto do_decode_message = [&](const String& name) { |             auto do_decode_message = [&](const String& name) { | ||||||
|                 dbg() << "        case (int)" << endpoint.name << "::MessageID::" << name << ":"; |                 dbg() << "        case (int)Messages::" << endpoint.name << "::MessageID::" << name << ":"; | ||||||
|                 dbg() << "            return " << endpoint.name << "::" << name << "::decode(stream, size_in_bytes);"; |                 dbg() << "            return Messages::" << endpoint.name << "::" << name << "::decode(stream, size_in_bytes);"; | ||||||
|             }; |             }; | ||||||
|             do_decode_message(message.name); |             do_decode_message(message.name); | ||||||
|             if (message.is_synchronous) |             if (message.is_synchronous) | ||||||
|  | @ -492,11 +494,11 @@ int main(int argc, char** argv) | ||||||
|         dbg() << "        switch (message.message_id()) {"; |         dbg() << "        switch (message.message_id()) {"; | ||||||
|         for (auto& message : endpoint.messages) { |         for (auto& message : endpoint.messages) { | ||||||
|             auto do_decode_message = [&](const String& name, bool returns_something) { |             auto do_decode_message = [&](const String& name, bool returns_something) { | ||||||
|                 dbg() << "        case (int)" << endpoint.name << "::MessageID::" << name << ":"; |                 dbg() << "        case (int)Messages::" << endpoint.name << "::MessageID::" << name << ":"; | ||||||
|                 if (returns_something) { |                 if (returns_something) { | ||||||
|                     dbg() << "            return handle(static_cast<const " << endpoint.name << "::" << name << "&>(message));"; |                     dbg() << "            return handle(static_cast<const Messages::" << endpoint.name << "::" << name << "&>(message));"; | ||||||
|                 } else { |                 } else { | ||||||
|                     dbg() << "            handle(static_cast<const " << endpoint.name << "::" << name << "&>(message));"; |                     dbg() << "            handle(static_cast<const Messages::" << endpoint.name << "::" << name << "&>(message));"; | ||||||
|                     dbg() << "            return nullptr;"; |                     dbg() << "            return nullptr;"; | ||||||
|                 } |                 } | ||||||
|             }; |             }; | ||||||
|  | @ -514,7 +516,7 @@ int main(int argc, char** argv) | ||||||
|             String return_type = "void"; |             String return_type = "void"; | ||||||
|             if (message.is_synchronous) { |             if (message.is_synchronous) { | ||||||
|                 StringBuilder builder; |                 StringBuilder builder; | ||||||
|                 builder.append("OwnPtr<"); |                 builder.append("OwnPtr<Messages::"); | ||||||
|                 builder.append(endpoint.name); |                 builder.append(endpoint.name); | ||||||
|                 builder.append("::"); |                 builder.append("::"); | ||||||
|                 builder.append(message.name); |                 builder.append(message.name); | ||||||
|  | @ -522,7 +524,7 @@ int main(int argc, char** argv) | ||||||
|                 builder.append(">"); |                 builder.append(">"); | ||||||
|                 return_type = builder.to_string(); |                 return_type = builder.to_string(); | ||||||
|             } |             } | ||||||
|             dbg() << "    virtual " << return_type << " handle(const " << endpoint.name << "::" << message.name << "&) = 0;"; |             dbg() << "    virtual " << return_type << " handle(const Messages::" << endpoint.name << "::" << message.name << "&) = 0;"; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         dbg() << "private:"; |         dbg() << "private:"; | ||||||
|  |  | ||||||
|  | @ -37,7 +37,7 @@ ClientConnection::ClientConnection() | ||||||
| 
 | 
 | ||||||
| void ClientConnection::handshake() | void ClientConnection::handshake() | ||||||
| { | { | ||||||
|     auto response = send_sync<AudioServer::Greet>(); |     auto response = send_sync<Messages::AudioServer::Greet>(); | ||||||
|     set_my_client_id(response->client_id()); |     set_my_client_id(response->client_id()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -45,7 +45,7 @@ void ClientConnection::enqueue(const Buffer& buffer) | ||||||
| { | { | ||||||
|     for (;;) { |     for (;;) { | ||||||
|         const_cast<Buffer&>(buffer).shared_buffer().share_with(server_pid()); |         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()) |         if (response->success()) | ||||||
|             break; |             break; | ||||||
|         sleep(1); |         sleep(1); | ||||||
|  | @ -55,62 +55,62 @@ void ClientConnection::enqueue(const Buffer& buffer) | ||||||
| bool ClientConnection::try_enqueue(const Buffer& buffer) | bool ClientConnection::try_enqueue(const Buffer& buffer) | ||||||
| { | { | ||||||
|     const_cast<Buffer&>(buffer).shared_buffer().share_with(server_pid()); |     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(); |     return response->success(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool ClientConnection::get_muted() | bool ClientConnection::get_muted() | ||||||
| { | { | ||||||
|     return send_sync<AudioServer::GetMuted>()->muted(); |     return send_sync<Messages::AudioServer::GetMuted>()->muted(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ClientConnection::set_muted(bool muted) | void ClientConnection::set_muted(bool muted) | ||||||
| { | { | ||||||
|     send_sync<AudioServer::SetMuted>(muted); |     send_sync<Messages::AudioServer::SetMuted>(muted); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int ClientConnection::get_main_mix_volume() | 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) | void ClientConnection::set_main_mix_volume(int volume) | ||||||
| { | { | ||||||
|     send_sync<AudioServer::SetMainMixVolume>(volume); |     send_sync<Messages::AudioServer::SetMainMixVolume>(volume); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int ClientConnection::get_remaining_samples() | 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() | 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) | void ClientConnection::set_paused(bool paused) | ||||||
| { | { | ||||||
|     send_sync<AudioServer::SetPaused>(paused); |     send_sync<Messages::AudioServer::SetPaused>(paused); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ClientConnection::clear_buffer(bool paused) | void ClientConnection::clear_buffer(bool paused) | ||||||
| { | { | ||||||
|     send_sync<AudioServer::ClearBuffer>(paused); |     send_sync<Messages::AudioServer::ClearBuffer>(paused); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int ClientConnection::get_playing_buffer() | 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) |     if (on_finish_playing_buffer) | ||||||
|         on_finish_playing_buffer(message.buffer_id()); |         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) |     if (on_muted_state_change) | ||||||
|         on_muted_state_change(message.muted()); |         on_muted_state_change(message.muted()); | ||||||
|  |  | ||||||
|  | @ -61,8 +61,8 @@ public: | ||||||
|     Function<void(bool muted)> on_muted_state_change; |     Function<void(bool muted)> on_muted_state_change; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     virtual void handle(const AudioClient::FinishedPlayingBuffer&) override; |     virtual void handle(const Messages::AudioClient::FinishedPlayingBuffer&) override; | ||||||
|     virtual void handle(const AudioClient::MutedStateChanged&) override; |     virtual void handle(const Messages::AudioClient::MutedStateChanged&) override; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -44,7 +44,7 @@ Clipboard::Clipboard() | ||||||
| 
 | 
 | ||||||
| Clipboard::DataAndType Clipboard::data_and_type() const | 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) |     if (response->shared_buffer_id() < 0) | ||||||
|         return {}; |         return {}; | ||||||
|     auto shared_buffer = SharedBuffer::create_from_shared_buffer_id(response->shared_buffer_id()); |     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->seal(); | ||||||
|     shared_buffer->share_with(WindowServerConnection::the().server_pid()); |     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) | 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) | bool Desktop::set_wallpaper(const StringView& path) | ||||||
| { | { | ||||||
|     WindowServerConnection::the().post_message(WindowServer::AsyncSetWallpaper(path)); |     WindowServerConnection::the().post_message(Messages::WindowServer::AsyncSetWallpaper(path)); | ||||||
|     auto ret_val = WindowServerConnection::the().wait_for_specific_message<WindowClient::AsyncSetWallpaperFinished>()->success(); |     auto ret_val = WindowServerConnection::the().wait_for_specific_message<Messages::WindowClient::AsyncSetWallpaperFinished>()->success(); | ||||||
| 
 | 
 | ||||||
|     if (ret_val) { |     if (ret_val) { | ||||||
|         RefPtr<Core::ConfigFile> config = Core::ConfigFile::get_for_app("WindowManager"); |         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 | 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(); |         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()) { |     if (!response->started()) { | ||||||
|         m_outcome = Outcome::Cancelled; |         m_outcome = Outcome::Cancelled; | ||||||
|         return m_outcome; |         return m_outcome; | ||||||
|  |  | ||||||
|  | @ -87,19 +87,19 @@ void Menu::realize_if_needed() | ||||||
| void Menu::popup(const Gfx::Point& screen_position) | void Menu::popup(const Gfx::Point& screen_position) | ||||||
| { | { | ||||||
|     realize_if_needed(); |     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() | void Menu::dismiss() | ||||||
| { | { | ||||||
|     if (m_menu_id == -1) |     if (m_menu_id == -1) | ||||||
|         return; |         return; | ||||||
|     WindowServerConnection::the().post_message(WindowServer::DismissMenu(m_menu_id)); |     WindowServerConnection::the().post_message(Messages::WindowServer::DismissMenu(m_menu_id)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int Menu::realize_menu() | 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 | #ifdef MENU_DEBUG | ||||||
|     dbgprintf("GUI::Menu::realize_menu(): New menu ID: %d\n", m_menu_id); |     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_menu_id({}, m_menu_id); | ||||||
|         item.set_identifier({}, i); |         item.set_identifier({}, i); | ||||||
|         if (item.type() == MenuItem::Type::Separator) { |         if (item.type() == MenuItem::Type::Separator) { | ||||||
|             WindowServerConnection::the().send_sync<WindowServer::AddMenuSeparator>(m_menu_id); |             WindowServerConnection::the().send_sync<Messages::WindowServer::AddMenuSeparator>(m_menu_id); | ||||||
|             continue; |             continue; | ||||||
|         } |         } | ||||||
|         if (item.type() == MenuItem::Type::Submenu) { |         if (item.type() == MenuItem::Type::Submenu) { | ||||||
|             auto& submenu = *item.submenu(); |             auto& submenu = *item.submenu(); | ||||||
|             submenu.realize_if_needed(); |             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; |             continue; | ||||||
|         } |         } | ||||||
|         if (item.type() == MenuItem::Type::Action) { |         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(); |             auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_string() : String(); | ||||||
|             bool exclusive = action.group() && action.group()->is_exclusive() && action.is_checkable(); |             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); |     all_menus().set(m_menu_id, this); | ||||||
|  | @ -150,7 +150,7 @@ void Menu::unrealize_menu() | ||||||
|     if (m_menu_id == -1) |     if (m_menu_id == -1) | ||||||
|         return; |         return; | ||||||
|     all_menus().remove(m_menu_id); |     all_menus().remove(m_menu_id); | ||||||
|     WindowServerConnection::the().send_sync<WindowServer::DestroyMenu>(m_menu_id); |     WindowServerConnection::the().send_sync<Messages::WindowServer::DestroyMenu>(m_menu_id); | ||||||
|     m_menu_id = 0; |     m_menu_id = 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -45,14 +45,14 @@ void MenuBar::add_menu(NonnullRefPtr<Menu> menu) | ||||||
| 
 | 
 | ||||||
| int MenuBar::realize_menubar() | 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() | void MenuBar::unrealize_menubar() | ||||||
| { | { | ||||||
|     if (m_menubar_id == -1) |     if (m_menubar_id == -1) | ||||||
|         return; |         return; | ||||||
|     WindowServerConnection::the().send_sync<WindowServer::DestroyMenubar>(m_menubar_id); |     WindowServerConnection::the().send_sync<Messages::WindowServer::DestroyMenubar>(m_menubar_id); | ||||||
|     m_menubar_id = -1; |     m_menubar_id = -1; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -64,9 +64,9 @@ void MenuBar::notify_added_to_application(Badge<Application>) | ||||||
|     for (auto& menu : m_menus) { |     for (auto& menu : m_menus) { | ||||||
|         int menu_id = menu.realize_menu(); |         int menu_id = menu.realize_menu(); | ||||||
|         ASSERT(menu_id != -1); |         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>) | void MenuBar::notify_removed_from_application(Badge<Application>) | ||||||
|  |  | ||||||
|  | @ -85,7 +85,7 @@ void MenuItem::update_window_server() | ||||||
|         return; |         return; | ||||||
|     auto& action = *m_action; |     auto& action = *m_action; | ||||||
|     auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_string() : String(); |     auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_string() : String(); | ||||||
|     WindowServerConnection::the().send_sync<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) |     if (!m_window_id) | ||||||
|         return; |         return; | ||||||
| 
 | 
 | ||||||
|     WindowServerConnection::the().send_sync<WindowServer::MoveWindowToFront>(m_window_id); |     WindowServerConnection::the().send_sync<Messages::WindowServer::MoveWindowToFront>(m_window_id); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Window::show() | void Window::show() | ||||||
| { | { | ||||||
|     if (m_window_id) |     if (m_window_id) | ||||||
|         return; |         return; | ||||||
|     auto response = WindowServerConnection::the().send_sync<WindowServer::CreateWindow>( |     auto response = WindowServerConnection::the().send_sync<Messages::WindowServer::CreateWindow>( | ||||||
|         m_rect_when_windowless, |         m_rect_when_windowless, | ||||||
|         m_has_alpha_channel, |         m_has_alpha_channel, | ||||||
|         m_modal, |         m_modal, | ||||||
|  | @ -113,7 +113,7 @@ void Window::hide() | ||||||
|     if (!m_window_id) |     if (!m_window_id) | ||||||
|         return; |         return; | ||||||
|     reified_windows->remove(m_window_id); |     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_window_id = 0; | ||||||
|     m_pending_paint_event_rects.clear(); |     m_pending_paint_event_rects.clear(); | ||||||
|     m_back_bitmap = nullptr; |     m_back_bitmap = nullptr; | ||||||
|  | @ -135,21 +135,21 @@ void Window::set_title(const StringView& title) | ||||||
|     m_title_when_windowless = title; |     m_title_when_windowless = title; | ||||||
|     if (!m_window_id) |     if (!m_window_id) | ||||||
|         return; |         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 | String Window::title() const | ||||||
| { | { | ||||||
|     if (!m_window_id) |     if (!m_window_id) | ||||||
|         return m_title_when_windowless; |         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 | Gfx::Rect Window::rect() const | ||||||
| { | { | ||||||
|     if (!m_window_id) |     if (!m_window_id) | ||||||
|         return m_rect_when_windowless; |         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) | 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()); |             m_main_widget->resize(m_rect_when_windowless.size()); | ||||||
|         return; |         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()) |     if (m_back_bitmap && m_back_bitmap->size() != a_rect.size()) | ||||||
|         m_back_bitmap = nullptr; |         m_back_bitmap = nullptr; | ||||||
|     if (m_front_bitmap && m_front_bitmap->size() != a_rect.size()) |     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) |     if (!m_window_id) | ||||||
|         return; |         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) | void Window::event(Core::Event& event) | ||||||
|  | @ -267,7 +267,7 @@ void Window::event(Core::Event& event) | ||||||
|             Vector<Gfx::Rect> rects_to_send; |             Vector<Gfx::Rect> rects_to_send; | ||||||
|             for (auto& r : rects) |             for (auto& r : rects) | ||||||
|                 rects_to_send.append(r); |                 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; |         return; | ||||||
|     } |     } | ||||||
|  | @ -354,7 +354,7 @@ void Window::update(const Gfx::Rect& a_rect) | ||||||
|             Vector<Gfx::Rect> rects_to_send; |             Vector<Gfx::Rect> rects_to_send; | ||||||
|             for (auto& r : rects) |             for (auto& r : rects) | ||||||
|                 rects_to_send.append(r); |                 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); |     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_back_bitmap = nullptr; | ||||||
|     m_front_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(); |     update(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -439,7 +439,7 @@ void Window::set_opacity(float opacity) | ||||||
|     m_opacity_when_windowless = opacity; |     m_opacity_when_windowless = opacity; | ||||||
|     if (!m_window_id) |     if (!m_window_id) | ||||||
|         return; |         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) | 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) | 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) | void Window::flip(const Vector<Gfx::Rect, 32>& dirty_rects) | ||||||
|  | @ -542,12 +542,12 @@ void Window::apply_icon() | ||||||
|     if (!has_set_process_icon) |     if (!has_set_process_icon) | ||||||
|         set_process_icon(m_icon->shared_buffer_id()); |         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() | 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 | Vector<Widget*> Window::focusable_widgets() const | ||||||
|  | @ -595,7 +595,7 @@ void Window::set_fullscreen(bool fullscreen) | ||||||
|     m_fullscreen = fullscreen; |     m_fullscreen = fullscreen; | ||||||
|     if (!m_window_id) |     if (!m_window_id) | ||||||
|         return; |         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() | void Window::schedule_relayout() | ||||||
|  |  | ||||||
|  | @ -59,19 +59,19 @@ static void set_system_theme_from_shared_buffer_id(int id) | ||||||
| 
 | 
 | ||||||
| void WindowServerConnection::handshake() | void WindowServerConnection::handshake() | ||||||
| { | { | ||||||
|     auto response = send_sync<WindowServer::Greet>(); |     auto response = send_sync<Messages::WindowServer::Greet>(); | ||||||
|     set_my_client_id(response->client_id()); |     set_my_client_id(response->client_id()); | ||||||
|     set_system_theme_from_shared_buffer_id(response->system_theme_buffer_id()); |     set_system_theme_from_shared_buffer_id(response->system_theme_buffer_id()); | ||||||
|     Desktop::the().did_receive_screen_rect({}, response->screen_rect()); |     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()); |     set_system_theme_from_shared_buffer_id(message.system_theme_buffer_id()); | ||||||
|     Window::update_all_windows({}); |     Window::update_all_windows({}); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void WindowServerConnection::handle(const WindowClient::Paint& message) | void WindowServerConnection::handle(const Messages::WindowClient::Paint& message) | ||||||
| { | { | ||||||
| #ifdef GEVENTLOOP_DEBUG | #ifdef GEVENTLOOP_DEBUG | ||||||
|     dbgprintf("WID=%d Paint\n", message.window_id()); |     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())); |         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())) { |     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())); |         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 | #ifdef GEVENTLOOP_DEBUG | ||||||
|     dbgprintf("(%d) WID=%d WindowActivated\n", getpid(), message.window_id()); |     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)); |         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 | #ifdef GEVENTLOOP_DEBUG | ||||||
|     dbgprintf("(%d) WID=%d WindowDeactivated\n", getpid(), message.window_id()); |     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)); |         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())) |     if (auto* window = Window::from_window_id(message.window_id())) | ||||||
|         Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowCloseRequest)); |         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())) |     if (auto* window = Window::from_window_id(message.window_id())) | ||||||
|         Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowEntered)); |         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())) |     if (auto* window = Window::from_window_id(message.window_id())) | ||||||
|         Core::EventLoop::current().post_event(*window, make<Event>(Event::WindowLeft)); |         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 | #ifdef GEVENTLOOP_DEBUG | ||||||
|     dbgprintf("WID=%d KeyDown character=0x%02x\n", message.window_id(), message.character()); |     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)); |     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 | #ifdef GEVENTLOOP_DEBUG | ||||||
|     dbgprintf("WID=%d KeyUp character=0x%02x\n", message.window_id(), message.character()); |     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 | #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(); |     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())); |         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 | #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(); |     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())); |         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 | #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(); |     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())); |         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 | #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(); |     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())); |         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 | #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(); |     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())); |         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()); |     auto* menu = Menu::from_menu_id(message.menu_id()); | ||||||
|     if (!menu) { |     if (!menu) { | ||||||
|  | @ -252,7 +252,7 @@ void WindowServerConnection::handle(const WindowClient::MenuItemActivated& messa | ||||||
|         action->activate(menu); |         action->activate(menu); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void WindowServerConnection::handle(const WindowClient::WM_WindowStateChanged& message) | void WindowServerConnection::handle(const Messages::WindowClient::WM_WindowStateChanged& message) | ||||||
| { | { | ||||||
| #ifdef GEVENTLOOP_DEBUG | #ifdef GEVENTLOOP_DEBUG | ||||||
|     dbgprintf("EventLoop: handle_wm_event: %d\n", (int)event.type); |     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())); |         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 | #ifdef GEVENTLOOP_DEBUG | ||||||
|     dbgprintf("EventLoop: handle_wm_event: %d\n", (int)event.type); |     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())); |         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 | #ifdef GEVENTLOOP_DEBUG | ||||||
|     dbgprintf("EventLoop: handle_wm_event: %d\n", (int)event.type); |     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())); |         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 | #ifdef GEVENTLOOP_DEBUG | ||||||
|     dbgprintf("EventLoop: handle_wm_event: %d\n", (int)event.type); |     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())); |         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()); |     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()); |     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().
 |     // 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())) |     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())); |         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({}); |     DragOperation::notify_accepted({}); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void WindowServerConnection::handle(const WindowClient::DragCancelled&) | void WindowServerConnection::handle(const Messages::WindowClient::DragCancelled&) | ||||||
| { | { | ||||||
|     DragOperation::notify_cancelled({}); |     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())) |     if (auto* window = Window::from_window_id(message.window_id())) | ||||||
|         window->notify_state_changed({}, message.minimized(), message.occluded()); |         window->notify_state_changed({}, message.minimized(), message.occluded()); | ||||||
|  |  | ||||||
|  | @ -47,33 +47,33 @@ public: | ||||||
|     static WindowServerConnection& the(); |     static WindowServerConnection& the(); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     virtual void handle(const WindowClient::Paint&) override; |     virtual void handle(const Messages::WindowClient::Paint&) override; | ||||||
|     virtual void handle(const WindowClient::MouseMove&) override; |     virtual void handle(const Messages::WindowClient::MouseMove&) override; | ||||||
|     virtual void handle(const WindowClient::MouseDown&) override; |     virtual void handle(const Messages::WindowClient::MouseDown&) override; | ||||||
|     virtual void handle(const WindowClient::MouseDoubleClick&) override; |     virtual void handle(const Messages::WindowClient::MouseDoubleClick&) override; | ||||||
|     virtual void handle(const WindowClient::MouseUp&) override; |     virtual void handle(const Messages::WindowClient::MouseUp&) override; | ||||||
|     virtual void handle(const WindowClient::MouseWheel&) override; |     virtual void handle(const Messages::WindowClient::MouseWheel&) override; | ||||||
|     virtual void handle(const WindowClient::WindowEntered&) override; |     virtual void handle(const Messages::WindowClient::WindowEntered&) override; | ||||||
|     virtual void handle(const WindowClient::WindowLeft&) override; |     virtual void handle(const Messages::WindowClient::WindowLeft&) override; | ||||||
|     virtual void handle(const WindowClient::KeyDown&) override; |     virtual void handle(const Messages::WindowClient::KeyDown&) override; | ||||||
|     virtual void handle(const WindowClient::KeyUp&) override; |     virtual void handle(const Messages::WindowClient::KeyUp&) override; | ||||||
|     virtual void handle(const WindowClient::WindowActivated&) override; |     virtual void handle(const Messages::WindowClient::WindowActivated&) override; | ||||||
|     virtual void handle(const WindowClient::WindowDeactivated&) override; |     virtual void handle(const Messages::WindowClient::WindowDeactivated&) override; | ||||||
|     virtual void handle(const WindowClient::WindowCloseRequest&) override; |     virtual void handle(const Messages::WindowClient::WindowCloseRequest&) override; | ||||||
|     virtual void handle(const WindowClient::WindowResized&) override; |     virtual void handle(const Messages::WindowClient::WindowResized&) override; | ||||||
|     virtual void handle(const WindowClient::MenuItemActivated&) override; |     virtual void handle(const Messages::WindowClient::MenuItemActivated&) override; | ||||||
|     virtual void handle(const WindowClient::ScreenRectChanged&) override; |     virtual void handle(const Messages::WindowClient::ScreenRectChanged&) override; | ||||||
|     virtual void handle(const WindowClient::ClipboardContentsChanged&) override; |     virtual void handle(const Messages::WindowClient::ClipboardContentsChanged&) override; | ||||||
|     virtual void handle(const WindowClient::WM_WindowRemoved&) override; |     virtual void handle(const Messages::WindowClient::WM_WindowRemoved&) override; | ||||||
|     virtual void handle(const WindowClient::WM_WindowStateChanged&) override; |     virtual void handle(const Messages::WindowClient::WM_WindowStateChanged&) override; | ||||||
|     virtual void handle(const WindowClient::WM_WindowIconBitmapChanged&) override; |     virtual void handle(const Messages::WindowClient::WM_WindowIconBitmapChanged&) override; | ||||||
|     virtual void handle(const WindowClient::WM_WindowRectChanged&) override; |     virtual void handle(const Messages::WindowClient::WM_WindowRectChanged&) override; | ||||||
|     virtual void handle(const WindowClient::AsyncSetWallpaperFinished&) override; |     virtual void handle(const Messages::WindowClient::AsyncSetWallpaperFinished&) override; | ||||||
|     virtual void handle(const WindowClient::DragDropped&) override; |     virtual void handle(const Messages::WindowClient::DragDropped&) override; | ||||||
|     virtual void handle(const WindowClient::DragAccepted&) override; |     virtual void handle(const Messages::WindowClient::DragAccepted&) override; | ||||||
|     virtual void handle(const WindowClient::DragCancelled&) override; |     virtual void handle(const Messages::WindowClient::DragCancelled&) override; | ||||||
|     virtual void handle(const WindowClient::UpdateSystemTheme&) override; |     virtual void handle(const Messages::WindowClient::UpdateSystemTheme&) override; | ||||||
|     virtual void handle(const WindowClient::WindowStateChanged&) override; |     virtual void handle(const Messages::WindowClient::WindowStateChanged&) override; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -38,18 +38,18 @@ Client::Client() | ||||||
| 
 | 
 | ||||||
| void Client::handshake() | void Client::handshake() | ||||||
| { | { | ||||||
|     auto response = send_sync<ProtocolServer::Greet>(); |     auto response = send_sync<Messages::ProtocolServer::Greet>(); | ||||||
|     set_my_client_id(response->client_id()); |     set_my_client_id(response->client_id()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool Client::is_supported_protocol(const String& protocol) | 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) | 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); |     auto download = Download::create_from_id({}, *this, download_id); | ||||||
|     m_downloads.set(download_id, download); |     m_downloads.set(download_id, download); | ||||||
|     return download; |     return download; | ||||||
|  | @ -59,20 +59,20 @@ bool Client::stop_download(Badge<Download>, Download& download) | ||||||
| { | { | ||||||
|     if (!m_downloads.contains(download.id())) |     if (!m_downloads.contains(download.id())) | ||||||
|         return false; |         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; |     RefPtr<Download> download; | ||||||
|     if ((download = m_downloads.get(message.download_id()).value_or(nullptr))) { |     if ((download = m_downloads.get(message.download_id()).value_or(nullptr))) { | ||||||
|         download->did_finish({}, message.success(), message.total_size(), message.shared_buffer_id()); |         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()); |     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)) { |     if (auto download = m_downloads.get(message.download_id()).value_or(nullptr)) { | ||||||
|         download->did_progress({}, message.total_size(), message.downloaded_size()); |         download->did_progress({}, message.total_size(), message.downloaded_size()); | ||||||
|  |  | ||||||
|  | @ -48,8 +48,8 @@ public: | ||||||
|     bool stop_download(Badge<Download>, Download&); |     bool stop_download(Badge<Download>, Download&); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     virtual void handle(const ProtocolClient::DownloadProgress&) override; |     virtual void handle(const Messages::ProtocolClient::DownloadProgress&) override; | ||||||
|     virtual void handle(const ProtocolClient::DownloadFinished&) override; |     virtual void handle(const Messages::ProtocolClient::DownloadFinished&) override; | ||||||
| 
 | 
 | ||||||
|     HashMap<i32, RefPtr<Download>> m_downloads; |     HashMap<i32, RefPtr<Download>> m_downloads; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -66,31 +66,31 @@ void ASClientConnection::die() | ||||||
| 
 | 
 | ||||||
| void ASClientConnection::did_finish_playing_buffer(Badge<ASBufferQueue>, int buffer_id) | void ASClientConnection::did_finish_playing_buffer(Badge<ASBufferQueue>, int buffer_id) | ||||||
| { | { | ||||||
|     post_message(AudioClient::FinishedPlayingBuffer(buffer_id)); |     post_message(Messages::AudioClient::FinishedPlayingBuffer(buffer_id)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ASClientConnection::did_change_muted_state(Badge<ASMixer>, bool muted) | void ASClientConnection::did_change_muted_state(Badge<ASMixer>, bool muted) | ||||||
| { | { | ||||||
|     post_message(AudioClient::MutedStateChanged(muted)); |     post_message(Messages::AudioClient::MutedStateChanged(muted)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<AudioServer::GreetResponse> ASClientConnection::handle(const AudioServer::Greet&) | OwnPtr<Messages::AudioServer::GreetResponse> ASClientConnection::handle(const Messages::AudioServer::Greet&) | ||||||
| { | { | ||||||
|     return make<AudioServer::GreetResponse>(client_id()); |     return make<Messages::AudioServer::GreetResponse>(client_id()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<AudioServer::GetMainMixVolumeResponse> ASClientConnection::handle(const AudioServer::GetMainMixVolume&) | OwnPtr<Messages::AudioServer::GetMainMixVolumeResponse> ASClientConnection::handle(const Messages::AudioServer::GetMainMixVolume&) | ||||||
| { | { | ||||||
|     return make<AudioServer::GetMainMixVolumeResponse>(m_mixer.main_volume()); |     return make<Messages::AudioServer::GetMainMixVolumeResponse>(m_mixer.main_volume()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<AudioServer::SetMainMixVolumeResponse> ASClientConnection::handle(const AudioServer::SetMainMixVolume& message) | OwnPtr<Messages::AudioServer::SetMainMixVolumeResponse> ASClientConnection::handle(const Messages::AudioServer::SetMainMixVolume& message) | ||||||
| { | { | ||||||
|     m_mixer.set_main_volume(message.volume()); |     m_mixer.set_main_volume(message.volume()); | ||||||
|     return make<AudioServer::SetMainMixVolumeResponse>(); |     return make<Messages::AudioServer::SetMainMixVolumeResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<AudioServer::EnqueueBufferResponse> ASClientConnection::handle(const AudioServer::EnqueueBuffer& message) | OwnPtr<Messages::AudioServer::EnqueueBufferResponse> ASClientConnection::handle(const Messages::AudioServer::EnqueueBuffer& message) | ||||||
| { | { | ||||||
|     auto shared_buffer = SharedBuffer::create_from_shared_buffer_id(message.buffer_id()); |     auto shared_buffer = SharedBuffer::create_from_shared_buffer_id(message.buffer_id()); | ||||||
|     if (!shared_buffer) { |     if (!shared_buffer) { | ||||||
|  | @ -103,59 +103,59 @@ OwnPtr<AudioServer::EnqueueBufferResponse> ASClientConnection::handle(const Audi | ||||||
|         m_queue = m_mixer.create_queue(*this); |         m_queue = m_mixer.create_queue(*this); | ||||||
| 
 | 
 | ||||||
|     if (m_queue->is_full()) |     if (m_queue->is_full()) | ||||||
|         return make<AudioServer::EnqueueBufferResponse>(false); |         return make<Messages::AudioServer::EnqueueBufferResponse>(false); | ||||||
| 
 | 
 | ||||||
|     m_queue->enqueue(Audio::Buffer::create_with_shared_buffer(*shared_buffer, message.sample_count())); |     m_queue->enqueue(Audio::Buffer::create_with_shared_buffer(*shared_buffer, message.sample_count())); | ||||||
|     return make<AudioServer::EnqueueBufferResponse>(true); |     return make<Messages::AudioServer::EnqueueBufferResponse>(true); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<AudioServer::GetRemainingSamplesResponse> ASClientConnection::handle(const AudioServer::GetRemainingSamples&) | OwnPtr<Messages::AudioServer::GetRemainingSamplesResponse> ASClientConnection::handle(const Messages::AudioServer::GetRemainingSamples&) | ||||||
| { | { | ||||||
|     int remaining = 0; |     int remaining = 0; | ||||||
|     if (m_queue) |     if (m_queue) | ||||||
|         remaining = m_queue->get_remaining_samples(); |         remaining = m_queue->get_remaining_samples(); | ||||||
| 
 | 
 | ||||||
|     return make<AudioServer::GetRemainingSamplesResponse>(remaining); |     return make<Messages::AudioServer::GetRemainingSamplesResponse>(remaining); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<AudioServer::GetPlayedSamplesResponse> ASClientConnection::handle(const AudioServer::GetPlayedSamples&) | OwnPtr<Messages::AudioServer::GetPlayedSamplesResponse> ASClientConnection::handle(const Messages::AudioServer::GetPlayedSamples&) | ||||||
| { | { | ||||||
|     int played = 0; |     int played = 0; | ||||||
|     if (m_queue) |     if (m_queue) | ||||||
|         played = m_queue->get_played_samples(); |         played = m_queue->get_played_samples(); | ||||||
| 
 | 
 | ||||||
|     return make<AudioServer::GetPlayedSamplesResponse>(played); |     return make<Messages::AudioServer::GetPlayedSamplesResponse>(played); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<AudioServer::SetPausedResponse> ASClientConnection::handle(const AudioServer::SetPaused& message) | OwnPtr<Messages::AudioServer::SetPausedResponse> ASClientConnection::handle(const Messages::AudioServer::SetPaused& message) | ||||||
| { | { | ||||||
|     if (m_queue) |     if (m_queue) | ||||||
|         m_queue->set_paused(message.paused()); |         m_queue->set_paused(message.paused()); | ||||||
|     return make<AudioServer::SetPausedResponse>(); |     return make<Messages::AudioServer::SetPausedResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<AudioServer::ClearBufferResponse> ASClientConnection::handle(const AudioServer::ClearBuffer& message) | OwnPtr<Messages::AudioServer::ClearBufferResponse> ASClientConnection::handle(const Messages::AudioServer::ClearBuffer& message) | ||||||
| { | { | ||||||
|     if (m_queue) |     if (m_queue) | ||||||
|         m_queue->clear(message.paused()); |         m_queue->clear(message.paused()); | ||||||
|     return make<AudioServer::ClearBufferResponse>(); |     return make<Messages::AudioServer::ClearBufferResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<AudioServer::GetPlayingBufferResponse> ASClientConnection::handle(const AudioServer::GetPlayingBuffer&) | OwnPtr<Messages::AudioServer::GetPlayingBufferResponse> ASClientConnection::handle(const Messages::AudioServer::GetPlayingBuffer&) | ||||||
| { | { | ||||||
|     int id = -1; |     int id = -1; | ||||||
|     if (m_queue) |     if (m_queue) | ||||||
|         id = m_queue->get_playing_buffer(); |         id = m_queue->get_playing_buffer(); | ||||||
|     return make<AudioServer::GetPlayingBufferResponse>(id); |     return make<Messages::AudioServer::GetPlayingBufferResponse>(id); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<AudioServer::GetMutedResponse> ASClientConnection::handle(const AudioServer::GetMuted&) | OwnPtr<Messages::AudioServer::GetMutedResponse> ASClientConnection::handle(const Messages::AudioServer::GetMuted&) | ||||||
| { | { | ||||||
|     return make<AudioServer::GetMutedResponse>(m_mixer.is_muted()); |     return make<Messages::AudioServer::GetMutedResponse>(m_mixer.is_muted()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<AudioServer::SetMutedResponse> ASClientConnection::handle(const AudioServer::SetMuted& message) | OwnPtr<Messages::AudioServer::SetMutedResponse> ASClientConnection::handle(const Messages::AudioServer::SetMuted& message) | ||||||
| { | { | ||||||
|     m_mixer.set_muted(message.muted()); |     m_mixer.set_muted(message.muted()); | ||||||
|     return make<AudioServer::SetMutedResponse>(); |     return make<Messages::AudioServer::SetMutedResponse>(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -51,17 +51,17 @@ public: | ||||||
|     static void for_each(Function<void(ASClientConnection&)>); |     static void for_each(Function<void(ASClientConnection&)>); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     virtual OwnPtr<AudioServer::GreetResponse> handle(const AudioServer::Greet&) override; |     virtual OwnPtr<Messages::AudioServer::GreetResponse> handle(const Messages::AudioServer::Greet&) override; | ||||||
|     virtual OwnPtr<AudioServer::GetMainMixVolumeResponse> handle(const AudioServer::GetMainMixVolume&) override; |     virtual OwnPtr<Messages::AudioServer::GetMainMixVolumeResponse> handle(const Messages::AudioServer::GetMainMixVolume&) override; | ||||||
|     virtual OwnPtr<AudioServer::SetMainMixVolumeResponse> handle(const AudioServer::SetMainMixVolume&) override; |     virtual OwnPtr<Messages::AudioServer::SetMainMixVolumeResponse> handle(const Messages::AudioServer::SetMainMixVolume&) override; | ||||||
|     virtual OwnPtr<AudioServer::EnqueueBufferResponse> handle(const AudioServer::EnqueueBuffer&) override; |     virtual OwnPtr<Messages::AudioServer::EnqueueBufferResponse> handle(const Messages::AudioServer::EnqueueBuffer&) override; | ||||||
|     virtual OwnPtr<AudioServer::GetRemainingSamplesResponse> handle(const AudioServer::GetRemainingSamples&) override; |     virtual OwnPtr<Messages::AudioServer::GetRemainingSamplesResponse> handle(const Messages::AudioServer::GetRemainingSamples&) override; | ||||||
|     virtual OwnPtr<AudioServer::GetPlayedSamplesResponse> handle(const AudioServer::GetPlayedSamples&) override; |     virtual OwnPtr<Messages::AudioServer::GetPlayedSamplesResponse> handle(const Messages::AudioServer::GetPlayedSamples&) override; | ||||||
|     virtual OwnPtr<AudioServer::SetPausedResponse> handle(const AudioServer::SetPaused&) override; |     virtual OwnPtr<Messages::AudioServer::SetPausedResponse> handle(const Messages::AudioServer::SetPaused&) override; | ||||||
|     virtual OwnPtr<AudioServer::ClearBufferResponse> handle(const AudioServer::ClearBuffer&) override; |     virtual OwnPtr<Messages::AudioServer::ClearBufferResponse> handle(const Messages::AudioServer::ClearBuffer&) override; | ||||||
|     virtual OwnPtr<AudioServer::GetPlayingBufferResponse> handle(const AudioServer::GetPlayingBuffer&) override; |     virtual OwnPtr<Messages::AudioServer::GetPlayingBufferResponse> handle(const Messages::AudioServer::GetPlayingBuffer&) override; | ||||||
|     virtual OwnPtr<AudioServer::GetMutedResponse> handle(const AudioServer::GetMuted&) override; |     virtual OwnPtr<Messages::AudioServer::GetMutedResponse> handle(const Messages::AudioServer::GetMuted&) override; | ||||||
|     virtual OwnPtr<AudioServer::SetMutedResponse> handle(const AudioServer::SetMuted&) override; |     virtual OwnPtr<Messages::AudioServer::SetMutedResponse> handle(const Messages::AudioServer::SetMuted&) override; | ||||||
| 
 | 
 | ||||||
|     ASMixer& m_mixer; |     ASMixer& m_mixer; | ||||||
|     RefPtr<ASBufferQueue> m_queue; |     RefPtr<ASBufferQueue> m_queue; | ||||||
|  |  | ||||||
|  | @ -47,30 +47,30 @@ void PSClientConnection::die() | ||||||
|     s_connections.remove(client_id()); |     s_connections.remove(client_id()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<ProtocolServer::IsSupportedProtocolResponse> PSClientConnection::handle(const ProtocolServer::IsSupportedProtocol& message) | OwnPtr<Messages::ProtocolServer::IsSupportedProtocolResponse> PSClientConnection::handle(const Messages::ProtocolServer::IsSupportedProtocol& message) | ||||||
| { | { | ||||||
|     bool supported = Protocol::find_by_name(message.protocol().to_lowercase()); |     bool supported = Protocol::find_by_name(message.protocol().to_lowercase()); | ||||||
|     return make<ProtocolServer::IsSupportedProtocolResponse>(supported); |     return make<Messages::ProtocolServer::IsSupportedProtocolResponse>(supported); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<ProtocolServer::StartDownloadResponse> PSClientConnection::handle(const ProtocolServer::StartDownload& message) | OwnPtr<Messages::ProtocolServer::StartDownloadResponse> PSClientConnection::handle(const Messages::ProtocolServer::StartDownload& message) | ||||||
| { | { | ||||||
|     URL url(message.url()); |     URL url(message.url()); | ||||||
|     ASSERT(url.is_valid()); |     ASSERT(url.is_valid()); | ||||||
|     auto* protocol = Protocol::find_by_name(url.protocol()); |     auto* protocol = Protocol::find_by_name(url.protocol()); | ||||||
|     ASSERT(protocol); |     ASSERT(protocol); | ||||||
|     auto download = protocol->start_download(*this, url); |     auto download = protocol->start_download(*this, url); | ||||||
|     return make<ProtocolServer::StartDownloadResponse>(download->id()); |     return make<Messages::ProtocolServer::StartDownloadResponse>(download->id()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<ProtocolServer::StopDownloadResponse> PSClientConnection::handle(const ProtocolServer::StopDownload& message) | OwnPtr<Messages::ProtocolServer::StopDownloadResponse> PSClientConnection::handle(const Messages::ProtocolServer::StopDownload& message) | ||||||
| { | { | ||||||
|     auto* download = Download::find_by_id(message.download_id()); |     auto* download = Download::find_by_id(message.download_id()); | ||||||
|     bool success = false; |     bool success = false; | ||||||
|     if (download) { |     if (download) { | ||||||
|         download->stop(); |         download->stop(); | ||||||
|     } |     } | ||||||
|     return make<ProtocolServer::StopDownloadResponse>(success); |     return make<Messages::ProtocolServer::StopDownloadResponse>(success); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void PSClientConnection::did_finish_download(Badge<Download>, Download& download, bool success) | void PSClientConnection::did_finish_download(Badge<Download>, Download& download, bool success) | ||||||
|  | @ -83,21 +83,21 @@ void PSClientConnection::did_finish_download(Badge<Download>, Download& download | ||||||
|         buffer->share_with(client_pid()); |         buffer->share_with(client_pid()); | ||||||
|         m_shared_buffers.set(buffer->shared_buffer_id(), buffer); |         m_shared_buffers.set(buffer->shared_buffer_id(), buffer); | ||||||
|     } |     } | ||||||
|     post_message(ProtocolClient::DownloadFinished(download.id(), success, download.total_size(), buffer ? buffer->shared_buffer_id() : -1)); |     post_message(Messages::ProtocolClient::DownloadFinished(download.id(), success, download.total_size(), buffer ? buffer->shared_buffer_id() : -1)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void PSClientConnection::did_progress_download(Badge<Download>, Download& download) | void PSClientConnection::did_progress_download(Badge<Download>, Download& download) | ||||||
| { | { | ||||||
|     post_message(ProtocolClient::DownloadProgress(download.id(), download.total_size(), download.downloaded_size())); |     post_message(Messages::ProtocolClient::DownloadProgress(download.id(), download.total_size(), download.downloaded_size())); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<ProtocolServer::GreetResponse> PSClientConnection::handle(const ProtocolServer::Greet&) | OwnPtr<Messages::ProtocolServer::GreetResponse> PSClientConnection::handle(const Messages::ProtocolServer::Greet&) | ||||||
| { | { | ||||||
|     return make<ProtocolServer::GreetResponse>(client_id()); |     return make<Messages::ProtocolServer::GreetResponse>(client_id()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<ProtocolServer::DisownSharedBufferResponse> PSClientConnection::handle(const ProtocolServer::DisownSharedBuffer& message) | OwnPtr<Messages::ProtocolServer::DisownSharedBufferResponse> PSClientConnection::handle(const Messages::ProtocolServer::DisownSharedBuffer& message) | ||||||
| { | { | ||||||
|     m_shared_buffers.remove(message.shared_buffer_id()); |     m_shared_buffers.remove(message.shared_buffer_id()); | ||||||
|     return make<ProtocolServer::DisownSharedBufferResponse>(); |     return make<Messages::ProtocolServer::DisownSharedBufferResponse>(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -49,11 +49,11 @@ public: | ||||||
|     void did_progress_download(Badge<Download>, Download&); |     void did_progress_download(Badge<Download>, Download&); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     virtual OwnPtr<ProtocolServer::GreetResponse> handle(const ProtocolServer::Greet&) override; |     virtual OwnPtr<Messages::ProtocolServer::GreetResponse> handle(const Messages::ProtocolServer::Greet&) override; | ||||||
|     virtual OwnPtr<ProtocolServer::IsSupportedProtocolResponse> handle(const ProtocolServer::IsSupportedProtocol&) override; |     virtual OwnPtr<Messages::ProtocolServer::IsSupportedProtocolResponse> handle(const Messages::ProtocolServer::IsSupportedProtocol&) override; | ||||||
|     virtual OwnPtr<ProtocolServer::StartDownloadResponse> handle(const ProtocolServer::StartDownload&) override; |     virtual OwnPtr<Messages::ProtocolServer::StartDownloadResponse> handle(const Messages::ProtocolServer::StartDownload&) override; | ||||||
|     virtual OwnPtr<ProtocolServer::StopDownloadResponse> handle(const ProtocolServer::StopDownload&) override; |     virtual OwnPtr<Messages::ProtocolServer::StopDownloadResponse> handle(const Messages::ProtocolServer::StopDownload&) override; | ||||||
|     virtual OwnPtr<ProtocolServer::DisownSharedBufferResponse> handle(const ProtocolServer::DisownSharedBuffer&) override; |     virtual OwnPtr<Messages::ProtocolServer::DisownSharedBufferResponse> handle(const Messages::ProtocolServer::DisownSharedBuffer&) override; | ||||||
| 
 | 
 | ||||||
|     HashMap<i32, RefPtr<AK::SharedBuffer>> m_shared_buffers; |     HashMap<i32, RefPtr<AK::SharedBuffer>> m_shared_buffers; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -92,23 +92,23 @@ void ClientConnection::die() | ||||||
| 
 | 
 | ||||||
| void ClientConnection::notify_about_new_screen_rect(const Gfx::Rect& rect) | void ClientConnection::notify_about_new_screen_rect(const Gfx::Rect& rect) | ||||||
| { | { | ||||||
|     post_message(WindowClient::ScreenRectChanged(rect)); |     post_message(Messages::WindowClient::ScreenRectChanged(rect)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ClientConnection::notify_about_clipboard_contents_changed() | void ClientConnection::notify_about_clipboard_contents_changed() | ||||||
| { | { | ||||||
|     post_message(WindowClient::ClipboardContentsChanged(Clipboard::the().data_type())); |     post_message(Messages::WindowClient::ClipboardContentsChanged(Clipboard::the().data_type())); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::CreateMenubarResponse> ClientConnection::handle(const WindowServer::CreateMenubar&) | OwnPtr<Messages::WindowServer::CreateMenubarResponse> ClientConnection::handle(const Messages::WindowServer::CreateMenubar&) | ||||||
| { | { | ||||||
|     int menubar_id = m_next_menubar_id++; |     int menubar_id = m_next_menubar_id++; | ||||||
|     auto menubar = make<MenuBar>(*this, menubar_id); |     auto menubar = make<MenuBar>(*this, menubar_id); | ||||||
|     m_menubars.set(menubar_id, move(menubar)); |     m_menubars.set(menubar_id, move(menubar)); | ||||||
|     return make<WindowServer::CreateMenubarResponse>(menubar_id); |     return make<Messages::WindowServer::CreateMenubarResponse>(menubar_id); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::DestroyMenubarResponse> ClientConnection::handle(const WindowServer::DestroyMenubar& message) | OwnPtr<Messages::WindowServer::DestroyMenubarResponse> ClientConnection::handle(const Messages::WindowServer::DestroyMenubar& message) | ||||||
| { | { | ||||||
|     int menubar_id = message.menubar_id(); |     int menubar_id = message.menubar_id(); | ||||||
|     auto it = m_menubars.find(menubar_id); |     auto it = m_menubars.find(menubar_id); | ||||||
|  | @ -119,18 +119,18 @@ OwnPtr<WindowServer::DestroyMenubarResponse> ClientConnection::handle(const Wind | ||||||
|     auto& menubar = *(*it).value; |     auto& menubar = *(*it).value; | ||||||
|     MenuManager::the().close_menubar(menubar); |     MenuManager::the().close_menubar(menubar); | ||||||
|     m_menubars.remove(it); |     m_menubars.remove(it); | ||||||
|     return make<WindowServer::DestroyMenubarResponse>(); |     return make<Messages::WindowServer::DestroyMenubarResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::CreateMenuResponse> ClientConnection::handle(const WindowServer::CreateMenu& message) | OwnPtr<Messages::WindowServer::CreateMenuResponse> ClientConnection::handle(const Messages::WindowServer::CreateMenu& message) | ||||||
| { | { | ||||||
|     int menu_id = m_next_menu_id++; |     int menu_id = m_next_menu_id++; | ||||||
|     auto menu = Menu::construct(this, menu_id, message.menu_title()); |     auto menu = Menu::construct(this, menu_id, message.menu_title()); | ||||||
|     m_menus.set(menu_id, move(menu)); |     m_menus.set(menu_id, move(menu)); | ||||||
|     return make<WindowServer::CreateMenuResponse>(menu_id); |     return make<Messages::WindowServer::CreateMenuResponse>(menu_id); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::DestroyMenuResponse> ClientConnection::handle(const WindowServer::DestroyMenu& message) | OwnPtr<Messages::WindowServer::DestroyMenuResponse> ClientConnection::handle(const Messages::WindowServer::DestroyMenu& message) | ||||||
| { | { | ||||||
|     int menu_id = message.menu_id(); |     int menu_id = message.menu_id(); | ||||||
|     auto it = m_menus.find(menu_id); |     auto it = m_menus.find(menu_id); | ||||||
|  | @ -142,10 +142,10 @@ OwnPtr<WindowServer::DestroyMenuResponse> ClientConnection::handle(const WindowS | ||||||
|     menu.close(); |     menu.close(); | ||||||
|     m_menus.remove(it); |     m_menus.remove(it); | ||||||
|     remove_child(menu); |     remove_child(menu); | ||||||
|     return make<WindowServer::DestroyMenuResponse>(); |     return make<Messages::WindowServer::DestroyMenuResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::SetApplicationMenubarResponse> ClientConnection::handle(const WindowServer::SetApplicationMenubar& message) | OwnPtr<Messages::WindowServer::SetApplicationMenubarResponse> ClientConnection::handle(const Messages::WindowServer::SetApplicationMenubar& message) | ||||||
| { | { | ||||||
|     int menubar_id = message.menubar_id(); |     int menubar_id = message.menubar_id(); | ||||||
|     auto it = m_menubars.find(menubar_id); |     auto it = m_menubars.find(menubar_id); | ||||||
|  | @ -156,10 +156,10 @@ OwnPtr<WindowServer::SetApplicationMenubarResponse> ClientConnection::handle(con | ||||||
|     auto& menubar = *(*it).value; |     auto& menubar = *(*it).value; | ||||||
|     m_app_menubar = menubar.make_weak_ptr(); |     m_app_menubar = menubar.make_weak_ptr(); | ||||||
|     WindowManager::the().notify_client_changed_app_menubar(*this); |     WindowManager::the().notify_client_changed_app_menubar(*this); | ||||||
|     return make<WindowServer::SetApplicationMenubarResponse>(); |     return make<Messages::WindowServer::SetApplicationMenubarResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::AddMenuToMenubarResponse> ClientConnection::handle(const WindowServer::AddMenuToMenubar& message) | OwnPtr<Messages::WindowServer::AddMenuToMenubarResponse> ClientConnection::handle(const Messages::WindowServer::AddMenuToMenubar& message) | ||||||
| { | { | ||||||
|     int menubar_id = message.menubar_id(); |     int menubar_id = message.menubar_id(); | ||||||
|     int menu_id = message.menu_id(); |     int menu_id = message.menu_id(); | ||||||
|  | @ -176,10 +176,10 @@ OwnPtr<WindowServer::AddMenuToMenubarResponse> ClientConnection::handle(const Wi | ||||||
|     auto& menubar = *(*it).value; |     auto& menubar = *(*it).value; | ||||||
|     auto& menu = *(*jt).value; |     auto& menu = *(*jt).value; | ||||||
|     menubar.add_menu(menu); |     menubar.add_menu(menu); | ||||||
|     return make<WindowServer::AddMenuToMenubarResponse>(); |     return make<Messages::WindowServer::AddMenuToMenubarResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::AddMenuItemResponse> ClientConnection::handle(const WindowServer::AddMenuItem& message) | OwnPtr<Messages::WindowServer::AddMenuItemResponse> ClientConnection::handle(const Messages::WindowServer::AddMenuItem& message) | ||||||
| { | { | ||||||
|     int menu_id = message.menu_id(); |     int menu_id = message.menu_id(); | ||||||
|     unsigned identifier = message.identifier(); |     unsigned identifier = message.identifier(); | ||||||
|  | @ -201,10 +201,10 @@ OwnPtr<WindowServer::AddMenuItemResponse> ClientConnection::handle(const WindowS | ||||||
|     menu_item->set_submenu_id(message.submenu_id()); |     menu_item->set_submenu_id(message.submenu_id()); | ||||||
|     menu_item->set_exclusive(message.exclusive()); |     menu_item->set_exclusive(message.exclusive()); | ||||||
|     menu.add_item(move(menu_item)); |     menu.add_item(move(menu_item)); | ||||||
|     return make<WindowServer::AddMenuItemResponse>(); |     return make<Messages::WindowServer::AddMenuItemResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::PopupMenuResponse> ClientConnection::handle(const WindowServer::PopupMenu& message) | OwnPtr<Messages::WindowServer::PopupMenuResponse> ClientConnection::handle(const Messages::WindowServer::PopupMenu& message) | ||||||
| { | { | ||||||
|     int menu_id = message.menu_id(); |     int menu_id = message.menu_id(); | ||||||
|     auto position = message.screen_position(); |     auto position = message.screen_position(); | ||||||
|  | @ -215,10 +215,10 @@ OwnPtr<WindowServer::PopupMenuResponse> ClientConnection::handle(const WindowSer | ||||||
|     } |     } | ||||||
|     auto& menu = *(*it).value; |     auto& menu = *(*it).value; | ||||||
|     menu.popup(position); |     menu.popup(position); | ||||||
|     return make<WindowServer::PopupMenuResponse>(); |     return make<Messages::WindowServer::PopupMenuResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::DismissMenuResponse> ClientConnection::handle(const WindowServer::DismissMenu& message) | OwnPtr<Messages::WindowServer::DismissMenuResponse> ClientConnection::handle(const Messages::WindowServer::DismissMenu& message) | ||||||
| { | { | ||||||
|     int menu_id = message.menu_id(); |     int menu_id = message.menu_id(); | ||||||
|     auto it = m_menus.find(menu_id); |     auto it = m_menus.find(menu_id); | ||||||
|  | @ -228,10 +228,10 @@ OwnPtr<WindowServer::DismissMenuResponse> ClientConnection::handle(const WindowS | ||||||
|     } |     } | ||||||
|     auto& menu = *(*it).value; |     auto& menu = *(*it).value; | ||||||
|     menu.close(); |     menu.close(); | ||||||
|     return make<WindowServer::DismissMenuResponse>(); |     return make<Messages::WindowServer::DismissMenuResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::UpdateMenuItemResponse> ClientConnection::handle(const WindowServer::UpdateMenuItem& message) | OwnPtr<Messages::WindowServer::UpdateMenuItemResponse> ClientConnection::handle(const Messages::WindowServer::UpdateMenuItem& message) | ||||||
| { | { | ||||||
|     int menu_id = message.menu_id(); |     int menu_id = message.menu_id(); | ||||||
|     auto it = m_menus.find(menu_id); |     auto it = m_menus.find(menu_id); | ||||||
|  | @ -251,10 +251,10 @@ OwnPtr<WindowServer::UpdateMenuItemResponse> ClientConnection::handle(const Wind | ||||||
|     menu_item->set_checkable(message.checkable()); |     menu_item->set_checkable(message.checkable()); | ||||||
|     if (message.checkable()) |     if (message.checkable()) | ||||||
|         menu_item->set_checked(message.checked()); |         menu_item->set_checked(message.checked()); | ||||||
|     return make<WindowServer::UpdateMenuItemResponse>(); |     return make<Messages::WindowServer::UpdateMenuItemResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::AddMenuSeparatorResponse> ClientConnection::handle(const WindowServer::AddMenuSeparator& message) | OwnPtr<Messages::WindowServer::AddMenuSeparatorResponse> ClientConnection::handle(const Messages::WindowServer::AddMenuSeparator& message) | ||||||
| { | { | ||||||
|     int menu_id = message.menu_id(); |     int menu_id = message.menu_id(); | ||||||
|     auto it = m_menus.find(menu_id); |     auto it = m_menus.find(menu_id); | ||||||
|  | @ -264,10 +264,10 @@ OwnPtr<WindowServer::AddMenuSeparatorResponse> ClientConnection::handle(const Wi | ||||||
|     } |     } | ||||||
|     auto& menu = *(*it).value; |     auto& menu = *(*it).value; | ||||||
|     menu.add_item(make<MenuItem>(menu, MenuItem::Separator)); |     menu.add_item(make<MenuItem>(menu, MenuItem::Separator)); | ||||||
|     return make<WindowServer::AddMenuSeparatorResponse>(); |     return make<Messages::WindowServer::AddMenuSeparatorResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::MoveWindowToFrontResponse> ClientConnection::handle(const WindowServer::MoveWindowToFront& message) | OwnPtr<Messages::WindowServer::MoveWindowToFrontResponse> ClientConnection::handle(const Messages::WindowServer::MoveWindowToFront& message) | ||||||
| { | { | ||||||
|     auto it = m_windows.find(message.window_id()); |     auto it = m_windows.find(message.window_id()); | ||||||
|     if (it == m_windows.end()) { |     if (it == m_windows.end()) { | ||||||
|  | @ -275,10 +275,10 @@ OwnPtr<WindowServer::MoveWindowToFrontResponse> ClientConnection::handle(const W | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     WindowManager::the().move_to_front_and_make_active(*(*it).value); |     WindowManager::the().move_to_front_and_make_active(*(*it).value); | ||||||
|     return make<WindowServer::MoveWindowToFrontResponse>(); |     return make<Messages::WindowServer::MoveWindowToFrontResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::SetFullscreenResponse> ClientConnection::handle(const WindowServer::SetFullscreen& message) | OwnPtr<Messages::WindowServer::SetFullscreenResponse> ClientConnection::handle(const Messages::WindowServer::SetFullscreen& message) | ||||||
| { | { | ||||||
|     auto it = m_windows.find(message.window_id()); |     auto it = m_windows.find(message.window_id()); | ||||||
|     if (it == m_windows.end()) { |     if (it == m_windows.end()) { | ||||||
|  | @ -286,10 +286,10 @@ OwnPtr<WindowServer::SetFullscreenResponse> ClientConnection::handle(const Windo | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     it->value->set_fullscreen(message.fullscreen()); |     it->value->set_fullscreen(message.fullscreen()); | ||||||
|     return make<WindowServer::SetFullscreenResponse>(); |     return make<Messages::WindowServer::SetFullscreenResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::SetWindowOpacityResponse> ClientConnection::handle(const WindowServer::SetWindowOpacity& message) | OwnPtr<Messages::WindowServer::SetWindowOpacityResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowOpacity& message) | ||||||
| { | { | ||||||
|     auto it = m_windows.find(message.window_id()); |     auto it = m_windows.find(message.window_id()); | ||||||
|     if (it == m_windows.end()) { |     if (it == m_windows.end()) { | ||||||
|  | @ -297,28 +297,28 @@ OwnPtr<WindowServer::SetWindowOpacityResponse> ClientConnection::handle(const Wi | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     it->value->set_opacity(message.opacity()); |     it->value->set_opacity(message.opacity()); | ||||||
|     return make<WindowServer::SetWindowOpacityResponse>(); |     return make<Messages::WindowServer::SetWindowOpacityResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ClientConnection::handle(const WindowServer::AsyncSetWallpaper& message) | void ClientConnection::handle(const Messages::WindowServer::AsyncSetWallpaper& message) | ||||||
| { | { | ||||||
|     Compositor::the().set_wallpaper(message.path(), [&](bool success) { |     Compositor::the().set_wallpaper(message.path(), [&](bool success) { | ||||||
|         post_message(WindowClient::AsyncSetWallpaperFinished(success)); |         post_message(Messages::WindowClient::AsyncSetWallpaperFinished(success)); | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::GetWallpaperResponse> ClientConnection::handle(const WindowServer::GetWallpaper&) | OwnPtr<Messages::WindowServer::GetWallpaperResponse> ClientConnection::handle(const Messages::WindowServer::GetWallpaper&) | ||||||
| { | { | ||||||
|     return make<WindowServer::GetWallpaperResponse>(Compositor::the().wallpaper_path()); |     return make<Messages::WindowServer::GetWallpaperResponse>(Compositor::the().wallpaper_path()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::SetResolutionResponse> ClientConnection::handle(const WindowServer::SetResolution& message) | OwnPtr<Messages::WindowServer::SetResolutionResponse> ClientConnection::handle(const Messages::WindowServer::SetResolution& message) | ||||||
| { | { | ||||||
|     WindowManager::the().set_resolution(message.resolution().width(), message.resolution().height()); |     WindowManager::the().set_resolution(message.resolution().width(), message.resolution().height()); | ||||||
|     return make<WindowServer::SetResolutionResponse>(); |     return make<Messages::WindowServer::SetResolutionResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::SetWindowTitleResponse> ClientConnection::handle(const WindowServer::SetWindowTitle& message) | OwnPtr<Messages::WindowServer::SetWindowTitleResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowTitle& message) | ||||||
| { | { | ||||||
|     auto it = m_windows.find(message.window_id()); |     auto it = m_windows.find(message.window_id()); | ||||||
|     if (it == m_windows.end()) { |     if (it == m_windows.end()) { | ||||||
|  | @ -326,20 +326,20 @@ OwnPtr<WindowServer::SetWindowTitleResponse> ClientConnection::handle(const Wind | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     it->value->set_title(message.title()); |     it->value->set_title(message.title()); | ||||||
|     return make<WindowServer::SetWindowTitleResponse>(); |     return make<Messages::WindowServer::SetWindowTitleResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::GetWindowTitleResponse> ClientConnection::handle(const WindowServer::GetWindowTitle& message) | OwnPtr<Messages::WindowServer::GetWindowTitleResponse> ClientConnection::handle(const Messages::WindowServer::GetWindowTitle& message) | ||||||
| { | { | ||||||
|     auto it = m_windows.find(message.window_id()); |     auto it = m_windows.find(message.window_id()); | ||||||
|     if (it == m_windows.end()) { |     if (it == m_windows.end()) { | ||||||
|         did_misbehave("GetWindowTitle: Bad window ID"); |         did_misbehave("GetWindowTitle: Bad window ID"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     return make<WindowServer::GetWindowTitleResponse>(it->value->title()); |     return make<Messages::WindowServer::GetWindowTitleResponse>(it->value->title()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::SetWindowIconBitmapResponse> ClientConnection::handle(const WindowServer::SetWindowIconBitmap& message) | OwnPtr<Messages::WindowServer::SetWindowIconBitmapResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowIconBitmap& message) | ||||||
| { | { | ||||||
|     auto it = m_windows.find(message.window_id()); |     auto it = m_windows.find(message.window_id()); | ||||||
|     if (it == m_windows.end()) { |     if (it == m_windows.end()) { | ||||||
|  | @ -358,10 +358,10 @@ OwnPtr<WindowServer::SetWindowIconBitmapResponse> ClientConnection::handle(const | ||||||
| 
 | 
 | ||||||
|     window.frame().invalidate_title_bar(); |     window.frame().invalidate_title_bar(); | ||||||
|     WindowManager::the().tell_wm_listeners_window_icon_changed(window); |     WindowManager::the().tell_wm_listeners_window_icon_changed(window); | ||||||
|     return make<WindowServer::SetWindowIconBitmapResponse>(); |     return make<Messages::WindowServer::SetWindowIconBitmapResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::SetWindowRectResponse> ClientConnection::handle(const WindowServer::SetWindowRect& message) | OwnPtr<Messages::WindowServer::SetWindowRectResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowRect& message) | ||||||
| { | { | ||||||
|     int window_id = message.window_id(); |     int window_id = message.window_id(); | ||||||
|     auto it = m_windows.find(window_id); |     auto it = m_windows.find(window_id); | ||||||
|  | @ -376,10 +376,10 @@ OwnPtr<WindowServer::SetWindowRectResponse> ClientConnection::handle(const Windo | ||||||
|     } |     } | ||||||
|     window.set_rect(message.rect()); |     window.set_rect(message.rect()); | ||||||
|     window.request_update(message.rect()); |     window.request_update(message.rect()); | ||||||
|     return make<WindowServer::SetWindowRectResponse>(); |     return make<Messages::WindowServer::SetWindowRectResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::GetWindowRectResponse> ClientConnection::handle(const WindowServer::GetWindowRect& message) | OwnPtr<Messages::WindowServer::GetWindowRectResponse> ClientConnection::handle(const Messages::WindowServer::GetWindowRect& message) | ||||||
| { | { | ||||||
|     int window_id = message.window_id(); |     int window_id = message.window_id(); | ||||||
|     auto it = m_windows.find(window_id); |     auto it = m_windows.find(window_id); | ||||||
|  | @ -387,10 +387,10 @@ OwnPtr<WindowServer::GetWindowRectResponse> ClientConnection::handle(const Windo | ||||||
|         did_misbehave("GetWindowRect: Bad window ID"); |         did_misbehave("GetWindowRect: Bad window ID"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     return make<WindowServer::GetWindowRectResponse>(it->value->rect()); |     return make<Messages::WindowServer::GetWindowRectResponse>(it->value->rect()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::SetClipboardContentsResponse> ClientConnection::handle(const WindowServer::SetClipboardContents& message) | OwnPtr<Messages::WindowServer::SetClipboardContentsResponse> ClientConnection::handle(const Messages::WindowServer::SetClipboardContents& message) | ||||||
| { | { | ||||||
|     auto shared_buffer = SharedBuffer::create_from_shared_buffer_id(message.shared_buffer_id()); |     auto shared_buffer = SharedBuffer::create_from_shared_buffer_id(message.shared_buffer_id()); | ||||||
|     if (!shared_buffer) { |     if (!shared_buffer) { | ||||||
|  | @ -398,10 +398,10 @@ OwnPtr<WindowServer::SetClipboardContentsResponse> ClientConnection::handle(cons | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     Clipboard::the().set_data(*shared_buffer, message.content_size(), message.content_type()); |     Clipboard::the().set_data(*shared_buffer, message.content_size(), message.content_type()); | ||||||
|     return make<WindowServer::SetClipboardContentsResponse>(); |     return make<Messages::WindowServer::SetClipboardContentsResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::GetClipboardContentsResponse> ClientConnection::handle(const WindowServer::GetClipboardContents&) | OwnPtr<Messages::WindowServer::GetClipboardContentsResponse> ClientConnection::handle(const Messages::WindowServer::GetClipboardContents&) | ||||||
| { | { | ||||||
|     auto& clipboard = Clipboard::the(); |     auto& clipboard = Clipboard::the(); | ||||||
| 
 | 
 | ||||||
|  | @ -421,10 +421,10 @@ OwnPtr<WindowServer::GetClipboardContentsResponse> ClientConnection::handle(cons | ||||||
|         //        After we respond to GetClipboardContents, we have to wait for the client to ref the buffer on his side.
 |         //        After we respond to GetClipboardContents, we have to wait for the client to ref the buffer on his side.
 | ||||||
|         m_last_sent_clipboard_content = move(shared_buffer); |         m_last_sent_clipboard_content = move(shared_buffer); | ||||||
|     } |     } | ||||||
|     return make<WindowServer::GetClipboardContentsResponse>(shared_buffer_id, clipboard.size(), clipboard.data_type()); |     return make<Messages::WindowServer::GetClipboardContentsResponse>(shared_buffer_id, clipboard.size(), clipboard.data_type()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::CreateWindowResponse> ClientConnection::handle(const WindowServer::CreateWindow& message) | OwnPtr<Messages::WindowServer::CreateWindowResponse> ClientConnection::handle(const Messages::WindowServer::CreateWindow& message) | ||||||
| { | { | ||||||
|     int window_id = m_next_window_id++; |     int window_id = m_next_window_id++; | ||||||
|     auto window = Window::construct(*this, (WindowType)message.type(), window_id, message.modal(), message.minimizable(), message.resizable(), message.fullscreen()); |     auto window = Window::construct(*this, (WindowType)message.type(), window_id, message.modal(), message.minimizable(), message.resizable(), message.fullscreen()); | ||||||
|  | @ -440,10 +440,10 @@ OwnPtr<WindowServer::CreateWindowResponse> ClientConnection::handle(const Window | ||||||
|     if (window->type() == WindowType::MenuApplet) |     if (window->type() == WindowType::MenuApplet) | ||||||
|         MenuManager::the().add_applet(*window); |         MenuManager::the().add_applet(*window); | ||||||
|     m_windows.set(window_id, move(window)); |     m_windows.set(window_id, move(window)); | ||||||
|     return make<WindowServer::CreateWindowResponse>(window_id); |     return make<Messages::WindowServer::CreateWindowResponse>(window_id); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::DestroyWindowResponse> ClientConnection::handle(const WindowServer::DestroyWindow& message) | OwnPtr<Messages::WindowServer::DestroyWindowResponse> ClientConnection::handle(const Messages::WindowServer::DestroyWindow& message) | ||||||
| { | { | ||||||
|     auto it = m_windows.find(message.window_id()); |     auto it = m_windows.find(message.window_id()); | ||||||
|     if (it == m_windows.end()) { |     if (it == m_windows.end()) { | ||||||
|  | @ -460,7 +460,7 @@ OwnPtr<WindowServer::DestroyWindowResponse> ClientConnection::handle(const Windo | ||||||
|     ASSERT(it->value.ptr() == &window); |     ASSERT(it->value.ptr() == &window); | ||||||
|     m_windows.remove(message.window_id()); |     m_windows.remove(message.window_id()); | ||||||
| 
 | 
 | ||||||
|     return make<WindowServer::DestroyWindowResponse>(); |     return make<Messages::WindowServer::DestroyWindowResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ClientConnection::post_paint_message(Window& window) | void ClientConnection::post_paint_message(Window& window) | ||||||
|  | @ -469,10 +469,10 @@ void ClientConnection::post_paint_message(Window& window) | ||||||
|     if (window.is_minimized() || window.is_occluded()) |     if (window.is_minimized() || window.is_occluded()) | ||||||
|         return; |         return; | ||||||
| 
 | 
 | ||||||
|     post_message(WindowClient::Paint(window.window_id(), window.size(), rect_set.rects())); |     post_message(Messages::WindowClient::Paint(window.window_id(), window.size(), rect_set.rects())); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ClientConnection::handle(const WindowServer::InvalidateRect& message) | void ClientConnection::handle(const Messages::WindowServer::InvalidateRect& message) | ||||||
| { | { | ||||||
|     auto it = m_windows.find(message.window_id()); |     auto it = m_windows.find(message.window_id()); | ||||||
|     if (it == m_windows.end()) { |     if (it == m_windows.end()) { | ||||||
|  | @ -484,7 +484,7 @@ void ClientConnection::handle(const WindowServer::InvalidateRect& message) | ||||||
|         window.request_update(message.rects()[i].intersected({ {}, window.size() })); |         window.request_update(message.rects()[i].intersected({ {}, window.size() })); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ClientConnection::handle(const WindowServer::DidFinishPainting& message) | void ClientConnection::handle(const Messages::WindowServer::DidFinishPainting& message) | ||||||
| { | { | ||||||
|     int window_id = message.window_id(); |     int window_id = message.window_id(); | ||||||
|     auto it = m_windows.find(window_id); |     auto it = m_windows.find(window_id); | ||||||
|  | @ -499,7 +499,7 @@ void ClientConnection::handle(const WindowServer::DidFinishPainting& message) | ||||||
|     WindowSwitcher::the().refresh_if_needed(); |     WindowSwitcher::the().refresh_if_needed(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::SetWindowBackingStoreResponse> ClientConnection::handle(const WindowServer::SetWindowBackingStore& message) | OwnPtr<Messages::WindowServer::SetWindowBackingStoreResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowBackingStore& message) | ||||||
| { | { | ||||||
|     int window_id = message.window_id(); |     int window_id = message.window_id(); | ||||||
|     auto it = m_windows.find(window_id); |     auto it = m_windows.find(window_id); | ||||||
|  | @ -513,7 +513,7 @@ OwnPtr<WindowServer::SetWindowBackingStoreResponse> ClientConnection::handle(con | ||||||
|     } else { |     } else { | ||||||
|         auto shared_buffer = SharedBuffer::create_from_shared_buffer_id(message.shared_buffer_id()); |         auto shared_buffer = SharedBuffer::create_from_shared_buffer_id(message.shared_buffer_id()); | ||||||
|         if (!shared_buffer) |         if (!shared_buffer) | ||||||
|             return make<WindowServer::SetWindowBackingStoreResponse>(); |             return make<Messages::WindowServer::SetWindowBackingStoreResponse>(); | ||||||
|         auto backing_store = Gfx::Bitmap::create_with_shared_buffer( |         auto backing_store = Gfx::Bitmap::create_with_shared_buffer( | ||||||
|             message.has_alpha_channel() ? Gfx::Bitmap::Format::RGBA32 : Gfx::Bitmap::Format::RGB32, |             message.has_alpha_channel() ? Gfx::Bitmap::Format::RGBA32 : Gfx::Bitmap::Format::RGB32, | ||||||
|             *shared_buffer, |             *shared_buffer, | ||||||
|  | @ -524,10 +524,10 @@ OwnPtr<WindowServer::SetWindowBackingStoreResponse> ClientConnection::handle(con | ||||||
|     if (message.flush_immediately()) |     if (message.flush_immediately()) | ||||||
|         window.invalidate(); |         window.invalidate(); | ||||||
| 
 | 
 | ||||||
|     return make<WindowServer::SetWindowBackingStoreResponse>(); |     return make<Messages::WindowServer::SetWindowBackingStoreResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::SetGlobalCursorTrackingResponse> ClientConnection::handle(const WindowServer::SetGlobalCursorTracking& message) | OwnPtr<Messages::WindowServer::SetGlobalCursorTrackingResponse> ClientConnection::handle(const Messages::WindowServer::SetGlobalCursorTracking& message) | ||||||
| { | { | ||||||
|     int window_id = message.window_id(); |     int window_id = message.window_id(); | ||||||
|     auto it = m_windows.find(window_id); |     auto it = m_windows.find(window_id); | ||||||
|  | @ -536,10 +536,10 @@ OwnPtr<WindowServer::SetGlobalCursorTrackingResponse> ClientConnection::handle(c | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     it->value->set_global_cursor_tracking_enabled(message.enabled()); |     it->value->set_global_cursor_tracking_enabled(message.enabled()); | ||||||
|     return make<WindowServer::SetGlobalCursorTrackingResponse>(); |     return make<Messages::WindowServer::SetGlobalCursorTrackingResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::SetWindowOverrideCursorResponse> ClientConnection::handle(const WindowServer::SetWindowOverrideCursor& message) | OwnPtr<Messages::WindowServer::SetWindowOverrideCursorResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowOverrideCursor& message) | ||||||
| { | { | ||||||
|     auto it = m_windows.find(message.window_id()); |     auto it = m_windows.find(message.window_id()); | ||||||
|     if (it == m_windows.end()) { |     if (it == m_windows.end()) { | ||||||
|  | @ -548,10 +548,10 @@ OwnPtr<WindowServer::SetWindowOverrideCursorResponse> ClientConnection::handle(c | ||||||
|     } |     } | ||||||
|     auto& window = *(*it).value; |     auto& window = *(*it).value; | ||||||
|     window.set_override_cursor(Cursor::create((StandardCursor)message.cursor_type())); |     window.set_override_cursor(Cursor::create((StandardCursor)message.cursor_type())); | ||||||
|     return make<WindowServer::SetWindowOverrideCursorResponse>(); |     return make<Messages::WindowServer::SetWindowOverrideCursorResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::SetWindowHasAlphaChannelResponse> ClientConnection::handle(const WindowServer::SetWindowHasAlphaChannel& message) | OwnPtr<Messages::WindowServer::SetWindowHasAlphaChannelResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowHasAlphaChannel& message) | ||||||
| { | { | ||||||
|     auto it = m_windows.find(message.window_id()); |     auto it = m_windows.find(message.window_id()); | ||||||
|     if (it == m_windows.end()) { |     if (it == m_windows.end()) { | ||||||
|  | @ -559,10 +559,10 @@ OwnPtr<WindowServer::SetWindowHasAlphaChannelResponse> ClientConnection::handle( | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     it->value->set_has_alpha_channel(message.has_alpha_channel()); |     it->value->set_has_alpha_channel(message.has_alpha_channel()); | ||||||
|     return make<WindowServer::SetWindowHasAlphaChannelResponse>(); |     return make<Messages::WindowServer::SetWindowHasAlphaChannelResponse>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ClientConnection::handle(const WindowServer::WM_SetActiveWindow& message) | void ClientConnection::handle(const Messages::WindowServer::WM_SetActiveWindow& message) | ||||||
| { | { | ||||||
|     auto* client = ClientConnection::from_client_id(message.client_id()); |     auto* client = ClientConnection::from_client_id(message.client_id()); | ||||||
|     if (!client) { |     if (!client) { | ||||||
|  | @ -579,7 +579,7 @@ void ClientConnection::handle(const WindowServer::WM_SetActiveWindow& message) | ||||||
|     WindowManager::the().move_to_front_and_make_active(window); |     WindowManager::the().move_to_front_and_make_active(window); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ClientConnection::handle(const WindowServer::WM_PopupWindowMenu& message) | void ClientConnection::handle(const Messages::WindowServer::WM_PopupWindowMenu& message) | ||||||
| { | { | ||||||
|     auto* client = ClientConnection::from_client_id(message.client_id()); |     auto* client = ClientConnection::from_client_id(message.client_id()); | ||||||
|     if (!client) { |     if (!client) { | ||||||
|  | @ -595,7 +595,7 @@ void ClientConnection::handle(const WindowServer::WM_PopupWindowMenu& message) | ||||||
|     window.popup_window_menu(message.screen_position()); |     window.popup_window_menu(message.screen_position()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ClientConnection::handle(const WindowServer::WM_StartWindowResize& request) | void ClientConnection::handle(const Messages::WindowServer::WM_StartWindowResize& request) | ||||||
| { | { | ||||||
|     auto* client = ClientConnection::from_client_id(request.client_id()); |     auto* client = ClientConnection::from_client_id(request.client_id()); | ||||||
|     if (!client) { |     if (!client) { | ||||||
|  | @ -613,7 +613,7 @@ void ClientConnection::handle(const WindowServer::WM_StartWindowResize& request) | ||||||
|     WindowManager::the().start_window_resize(window, Screen::the().cursor_location(), MouseButton::Left); |     WindowManager::the().start_window_resize(window, Screen::the().cursor_location(), MouseButton::Left); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ClientConnection::handle(const WindowServer::WM_SetWindowMinimized& message) | void ClientConnection::handle(const Messages::WindowServer::WM_SetWindowMinimized& message) | ||||||
| { | { | ||||||
|     auto* client = ClientConnection::from_client_id(message.client_id()); |     auto* client = ClientConnection::from_client_id(message.client_id()); | ||||||
|     if (!client) { |     if (!client) { | ||||||
|  | @ -629,9 +629,9 @@ void ClientConnection::handle(const WindowServer::WM_SetWindowMinimized& message | ||||||
|     window.set_minimized(message.minimized()); |     window.set_minimized(message.minimized()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::GreetResponse> ClientConnection::handle(const WindowServer::Greet&) | OwnPtr<Messages::WindowServer::GreetResponse> ClientConnection::handle(const Messages::WindowServer::Greet&) | ||||||
| { | { | ||||||
|     return make<WindowServer::GreetResponse>(client_id(), Screen::the().rect(), Gfx::current_system_theme_buffer_id()); |     return make<Messages::WindowServer::GreetResponse>(client_id(), Screen::the().rect(), Gfx::current_system_theme_buffer_id()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool ClientConnection::is_showing_modal_window() const | bool ClientConnection::is_showing_modal_window() const | ||||||
|  | @ -644,7 +644,7 @@ bool ClientConnection::is_showing_modal_window() const | ||||||
|     return false; |     return false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ClientConnection::handle(const WindowServer::WM_SetWindowTaskbarRect& message) | void ClientConnection::handle(const Messages::WindowServer::WM_SetWindowTaskbarRect& message) | ||||||
| { | { | ||||||
|     auto* client = ClientConnection::from_client_id(message.client_id()); |     auto* client = ClientConnection::from_client_id(message.client_id()); | ||||||
|     if (!client) { |     if (!client) { | ||||||
|  | @ -660,11 +660,11 @@ void ClientConnection::handle(const WindowServer::WM_SetWindowTaskbarRect& messa | ||||||
|     window.set_taskbar_rect(message.rect()); |     window.set_taskbar_rect(message.rect()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| OwnPtr<WindowServer::StartDragResponse> ClientConnection::handle(const WindowServer::StartDrag& message) | OwnPtr<Messages::WindowServer::StartDragResponse> ClientConnection::handle(const Messages::WindowServer::StartDrag& message) | ||||||
| { | { | ||||||
|     auto& wm = WindowManager::the(); |     auto& wm = WindowManager::the(); | ||||||
|     if (wm.dnd_client()) |     if (wm.dnd_client()) | ||||||
|         return make<WindowServer::StartDragResponse>(false); |         return make<Messages::WindowServer::StartDragResponse>(false); | ||||||
| 
 | 
 | ||||||
|     RefPtr<Gfx::Bitmap> bitmap; |     RefPtr<Gfx::Bitmap> bitmap; | ||||||
|     if (message.bitmap_id() != -1) { |     if (message.bitmap_id() != -1) { | ||||||
|  | @ -678,7 +678,7 @@ OwnPtr<WindowServer::StartDragResponse> ClientConnection::handle(const WindowSer | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     wm.start_dnd_drag(*this, message.text(), bitmap, message.data_type(), message.data()); |     wm.start_dnd_drag(*this, message.text(), bitmap, message.data_type(), message.data()); | ||||||
|     return make<WindowServer::StartDragResponse>(true); |     return make<Messages::WindowServer::StartDragResponse>(true); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ClientConnection::boost() | void ClientConnection::boost() | ||||||
|  |  | ||||||
|  | @ -75,45 +75,45 @@ public: | ||||||
| private: | private: | ||||||
|     explicit ClientConnection(Core::LocalSocket&, int client_id); |     explicit ClientConnection(Core::LocalSocket&, int client_id); | ||||||
| 
 | 
 | ||||||
|     virtual OwnPtr<WindowServer::GreetResponse> handle(const WindowServer::Greet&) override; |     virtual OwnPtr<Messages::WindowServer::GreetResponse> handle(const Messages::WindowServer::Greet&) override; | ||||||
|     virtual OwnPtr<WindowServer::CreateMenubarResponse> handle(const WindowServer::CreateMenubar&) override; |     virtual OwnPtr<Messages::WindowServer::CreateMenubarResponse> handle(const Messages::WindowServer::CreateMenubar&) override; | ||||||
|     virtual OwnPtr<WindowServer::DestroyMenubarResponse> handle(const WindowServer::DestroyMenubar&) override; |     virtual OwnPtr<Messages::WindowServer::DestroyMenubarResponse> handle(const Messages::WindowServer::DestroyMenubar&) override; | ||||||
|     virtual OwnPtr<WindowServer::CreateMenuResponse> handle(const WindowServer::CreateMenu&) override; |     virtual OwnPtr<Messages::WindowServer::CreateMenuResponse> handle(const Messages::WindowServer::CreateMenu&) override; | ||||||
|     virtual OwnPtr<WindowServer::DestroyMenuResponse> handle(const WindowServer::DestroyMenu&) override; |     virtual OwnPtr<Messages::WindowServer::DestroyMenuResponse> handle(const Messages::WindowServer::DestroyMenu&) override; | ||||||
|     virtual OwnPtr<WindowServer::AddMenuToMenubarResponse> handle(const WindowServer::AddMenuToMenubar&) override; |     virtual OwnPtr<Messages::WindowServer::AddMenuToMenubarResponse> handle(const Messages::WindowServer::AddMenuToMenubar&) override; | ||||||
|     virtual OwnPtr<WindowServer::SetApplicationMenubarResponse> handle(const WindowServer::SetApplicationMenubar&) override; |     virtual OwnPtr<Messages::WindowServer::SetApplicationMenubarResponse> handle(const Messages::WindowServer::SetApplicationMenubar&) override; | ||||||
|     virtual OwnPtr<WindowServer::AddMenuItemResponse> handle(const WindowServer::AddMenuItem&) override; |     virtual OwnPtr<Messages::WindowServer::AddMenuItemResponse> handle(const Messages::WindowServer::AddMenuItem&) override; | ||||||
|     virtual OwnPtr<WindowServer::AddMenuSeparatorResponse> handle(const WindowServer::AddMenuSeparator&) override; |     virtual OwnPtr<Messages::WindowServer::AddMenuSeparatorResponse> handle(const Messages::WindowServer::AddMenuSeparator&) override; | ||||||
|     virtual OwnPtr<WindowServer::UpdateMenuItemResponse> handle(const WindowServer::UpdateMenuItem&) override; |     virtual OwnPtr<Messages::WindowServer::UpdateMenuItemResponse> handle(const Messages::WindowServer::UpdateMenuItem&) override; | ||||||
|     virtual OwnPtr<WindowServer::CreateWindowResponse> handle(const WindowServer::CreateWindow&) override; |     virtual OwnPtr<Messages::WindowServer::CreateWindowResponse> handle(const Messages::WindowServer::CreateWindow&) override; | ||||||
|     virtual OwnPtr<WindowServer::DestroyWindowResponse> handle(const WindowServer::DestroyWindow&) override; |     virtual OwnPtr<Messages::WindowServer::DestroyWindowResponse> handle(const Messages::WindowServer::DestroyWindow&) override; | ||||||
|     virtual OwnPtr<WindowServer::SetWindowTitleResponse> handle(const WindowServer::SetWindowTitle&) override; |     virtual OwnPtr<Messages::WindowServer::SetWindowTitleResponse> handle(const Messages::WindowServer::SetWindowTitle&) override; | ||||||
|     virtual OwnPtr<WindowServer::GetWindowTitleResponse> handle(const WindowServer::GetWindowTitle&) override; |     virtual OwnPtr<Messages::WindowServer::GetWindowTitleResponse> handle(const Messages::WindowServer::GetWindowTitle&) override; | ||||||
|     virtual OwnPtr<WindowServer::SetWindowRectResponse> handle(const WindowServer::SetWindowRect&) override; |     virtual OwnPtr<Messages::WindowServer::SetWindowRectResponse> handle(const Messages::WindowServer::SetWindowRect&) override; | ||||||
|     virtual OwnPtr<WindowServer::GetWindowRectResponse> handle(const WindowServer::GetWindowRect&) override; |     virtual OwnPtr<Messages::WindowServer::GetWindowRectResponse> handle(const Messages::WindowServer::GetWindowRect&) override; | ||||||
|     virtual void handle(const WindowServer::InvalidateRect&) override; |     virtual void handle(const Messages::WindowServer::InvalidateRect&) override; | ||||||
|     virtual void handle(const WindowServer::DidFinishPainting&) override; |     virtual void handle(const Messages::WindowServer::DidFinishPainting&) override; | ||||||
|     virtual OwnPtr<WindowServer::SetGlobalCursorTrackingResponse> handle(const WindowServer::SetGlobalCursorTracking&) override; |     virtual OwnPtr<Messages::WindowServer::SetGlobalCursorTrackingResponse> handle(const Messages::WindowServer::SetGlobalCursorTracking&) override; | ||||||
|     virtual OwnPtr<WindowServer::SetWindowOpacityResponse> handle(const WindowServer::SetWindowOpacity&) override; |     virtual OwnPtr<Messages::WindowServer::SetWindowOpacityResponse> handle(const Messages::WindowServer::SetWindowOpacity&) override; | ||||||
|     virtual OwnPtr<WindowServer::SetWindowBackingStoreResponse> handle(const WindowServer::SetWindowBackingStore&) override; |     virtual OwnPtr<Messages::WindowServer::SetWindowBackingStoreResponse> handle(const Messages::WindowServer::SetWindowBackingStore&) override; | ||||||
|     virtual OwnPtr<WindowServer::GetClipboardContentsResponse> handle(const WindowServer::GetClipboardContents&) override; |     virtual OwnPtr<Messages::WindowServer::GetClipboardContentsResponse> handle(const Messages::WindowServer::GetClipboardContents&) override; | ||||||
|     virtual OwnPtr<WindowServer::SetClipboardContentsResponse> handle(const WindowServer::SetClipboardContents&) override; |     virtual OwnPtr<Messages::WindowServer::SetClipboardContentsResponse> handle(const Messages::WindowServer::SetClipboardContents&) override; | ||||||
|     virtual void handle(const WindowServer::WM_SetActiveWindow&) override; |     virtual void handle(const Messages::WindowServer::WM_SetActiveWindow&) override; | ||||||
|     virtual void handle(const WindowServer::WM_SetWindowMinimized&) override; |     virtual void handle(const Messages::WindowServer::WM_SetWindowMinimized&) override; | ||||||
|     virtual void handle(const WindowServer::WM_StartWindowResize&) override; |     virtual void handle(const Messages::WindowServer::WM_StartWindowResize&) override; | ||||||
|     virtual void handle(const WindowServer::WM_PopupWindowMenu&) override; |     virtual void handle(const Messages::WindowServer::WM_PopupWindowMenu&) override; | ||||||
|     virtual OwnPtr<WindowServer::SetWindowHasAlphaChannelResponse> handle(const WindowServer::SetWindowHasAlphaChannel&) override; |     virtual OwnPtr<Messages::WindowServer::SetWindowHasAlphaChannelResponse> handle(const Messages::WindowServer::SetWindowHasAlphaChannel&) override; | ||||||
|     virtual OwnPtr<WindowServer::MoveWindowToFrontResponse> handle(const WindowServer::MoveWindowToFront&) override; |     virtual OwnPtr<Messages::WindowServer::MoveWindowToFrontResponse> handle(const Messages::WindowServer::MoveWindowToFront&) override; | ||||||
|     virtual OwnPtr<WindowServer::SetFullscreenResponse> handle(const WindowServer::SetFullscreen&) override; |     virtual OwnPtr<Messages::WindowServer::SetFullscreenResponse> handle(const Messages::WindowServer::SetFullscreen&) override; | ||||||
|     virtual void handle(const WindowServer::AsyncSetWallpaper&) override; |     virtual void handle(const Messages::WindowServer::AsyncSetWallpaper&) override; | ||||||
|     virtual OwnPtr<WindowServer::GetWallpaperResponse> handle(const WindowServer::GetWallpaper&) override; |     virtual OwnPtr<Messages::WindowServer::GetWallpaperResponse> handle(const Messages::WindowServer::GetWallpaper&) override; | ||||||
|     virtual OwnPtr<WindowServer::SetResolutionResponse> handle(const WindowServer::SetResolution&) override; |     virtual OwnPtr<Messages::WindowServer::SetResolutionResponse> handle(const Messages::WindowServer::SetResolution&) override; | ||||||
|     virtual OwnPtr<WindowServer::SetWindowOverrideCursorResponse> handle(const WindowServer::SetWindowOverrideCursor&) override; |     virtual OwnPtr<Messages::WindowServer::SetWindowOverrideCursorResponse> handle(const Messages::WindowServer::SetWindowOverrideCursor&) override; | ||||||
|     virtual OwnPtr<WindowServer::PopupMenuResponse> handle(const WindowServer::PopupMenu&) override; |     virtual OwnPtr<Messages::WindowServer::PopupMenuResponse> handle(const Messages::WindowServer::PopupMenu&) override; | ||||||
|     virtual OwnPtr<WindowServer::DismissMenuResponse> handle(const WindowServer::DismissMenu&) override; |     virtual OwnPtr<Messages::WindowServer::DismissMenuResponse> handle(const Messages::WindowServer::DismissMenu&) override; | ||||||
|     virtual OwnPtr<WindowServer::SetWindowIconBitmapResponse> handle(const WindowServer::SetWindowIconBitmap&) override; |     virtual OwnPtr<Messages::WindowServer::SetWindowIconBitmapResponse> handle(const Messages::WindowServer::SetWindowIconBitmap&) override; | ||||||
|     virtual void handle(const WindowServer::WM_SetWindowTaskbarRect&) override; |     virtual void handle(const Messages::WindowServer::WM_SetWindowTaskbarRect&) override; | ||||||
|     virtual OwnPtr<WindowServer::StartDragResponse> handle(const WindowServer::StartDrag&) override; |     virtual OwnPtr<Messages::WindowServer::StartDragResponse> handle(const Messages::WindowServer::StartDrag&) override; | ||||||
| 
 | 
 | ||||||
|     HashMap<int, NonnullRefPtr<Window>> m_windows; |     HashMap<int, NonnullRefPtr<Window>> m_windows; | ||||||
|     HashMap<int, NonnullOwnPtr<MenuBar>> m_menubars; |     HashMap<int, NonnullOwnPtr<MenuBar>> m_menubars; | ||||||
|  |  | ||||||
|  | @ -470,7 +470,7 @@ void Menu::did_activate(MenuItem& item) | ||||||
|     MenuManager::the().close_bar(); |     MenuManager::the().close_bar(); | ||||||
| 
 | 
 | ||||||
|     if (m_client) |     if (m_client) | ||||||
|         m_client->post_message(WindowClient::MenuItemActivated(m_menu_id, item.identifier())); |         m_client->post_message(Messages::WindowClient::MenuItemActivated(m_menu_id, item.identifier())); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| MenuItem* Menu::item_with_identifier(unsigned identifer) | MenuItem* Menu::item_with_identifier(unsigned identifer) | ||||||
|  |  | ||||||
|  | @ -113,19 +113,19 @@ void Window::handle_mouse_event(const MouseEvent& event) | ||||||
| 
 | 
 | ||||||
|     switch (event.type()) { |     switch (event.type()) { | ||||||
|     case Event::MouseMove: |     case Event::MouseMove: | ||||||
|         m_client->post_message(WindowClient::MouseMove(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta())); |         m_client->post_message(Messages::WindowClient::MouseMove(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta())); | ||||||
|         break; |         break; | ||||||
|     case Event::MouseDown: |     case Event::MouseDown: | ||||||
|         m_client->post_message(WindowClient::MouseDown(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta())); |         m_client->post_message(Messages::WindowClient::MouseDown(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta())); | ||||||
|         break; |         break; | ||||||
|     case Event::MouseDoubleClick: |     case Event::MouseDoubleClick: | ||||||
|         m_client->post_message(WindowClient::MouseDoubleClick(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta())); |         m_client->post_message(Messages::WindowClient::MouseDoubleClick(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta())); | ||||||
|         break; |         break; | ||||||
|     case Event::MouseUp: |     case Event::MouseUp: | ||||||
|         m_client->post_message(WindowClient::MouseUp(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta())); |         m_client->post_message(Messages::WindowClient::MouseUp(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta())); | ||||||
|         break; |         break; | ||||||
|     case Event::MouseWheel: |     case Event::MouseWheel: | ||||||
|         m_client->post_message(WindowClient::MouseWheel(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta())); |         m_client->post_message(Messages::WindowClient::MouseWheel(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta())); | ||||||
|         break; |         break; | ||||||
|     default: |     default: | ||||||
|         ASSERT_NOT_REACHED(); |         ASSERT_NOT_REACHED(); | ||||||
|  | @ -237,37 +237,37 @@ void Window::event(Core::Event& event) | ||||||
| 
 | 
 | ||||||
|     switch (event.type()) { |     switch (event.type()) { | ||||||
|     case Event::WindowEntered: |     case Event::WindowEntered: | ||||||
|         m_client->post_message(WindowClient::WindowEntered(m_window_id)); |         m_client->post_message(Messages::WindowClient::WindowEntered(m_window_id)); | ||||||
|         break; |         break; | ||||||
|     case Event::WindowLeft: |     case Event::WindowLeft: | ||||||
|         m_client->post_message(WindowClient::WindowLeft(m_window_id)); |         m_client->post_message(Messages::WindowClient::WindowLeft(m_window_id)); | ||||||
|         break; |         break; | ||||||
|     case Event::KeyDown: |     case Event::KeyDown: | ||||||
|         m_client->post_message( |         m_client->post_message( | ||||||
|             WindowClient::KeyDown(m_window_id, |             Messages::WindowClient::KeyDown(m_window_id, | ||||||
|                 (u8) static_cast<const KeyEvent&>(event).character(), |                 (u8) static_cast<const KeyEvent&>(event).character(), | ||||||
|                 (u32) static_cast<const KeyEvent&>(event).key(), |                 (u32) static_cast<const KeyEvent&>(event).key(), | ||||||
|                 static_cast<const KeyEvent&>(event).modifiers())); |                 static_cast<const KeyEvent&>(event).modifiers())); | ||||||
|         break; |         break; | ||||||
|     case Event::KeyUp: |     case Event::KeyUp: | ||||||
|         m_client->post_message( |         m_client->post_message( | ||||||
|             WindowClient::KeyUp(m_window_id, |             Messages::WindowClient::KeyUp(m_window_id, | ||||||
|                 (u8) static_cast<const KeyEvent&>(event).character(), |                 (u8) static_cast<const KeyEvent&>(event).character(), | ||||||
|                 (u32) static_cast<const KeyEvent&>(event).key(), |                 (u32) static_cast<const KeyEvent&>(event).key(), | ||||||
|                 static_cast<const KeyEvent&>(event).modifiers())); |                 static_cast<const KeyEvent&>(event).modifiers())); | ||||||
|         break; |         break; | ||||||
|     case Event::WindowActivated: |     case Event::WindowActivated: | ||||||
|         m_client->post_message(WindowClient::WindowActivated(m_window_id)); |         m_client->post_message(Messages::WindowClient::WindowActivated(m_window_id)); | ||||||
|         break; |         break; | ||||||
|     case Event::WindowDeactivated: |     case Event::WindowDeactivated: | ||||||
|         m_client->post_message(WindowClient::WindowDeactivated(m_window_id)); |         m_client->post_message(Messages::WindowClient::WindowDeactivated(m_window_id)); | ||||||
|         break; |         break; | ||||||
|     case Event::WindowCloseRequest: |     case Event::WindowCloseRequest: | ||||||
|         m_client->post_message(WindowClient::WindowCloseRequest(m_window_id)); |         m_client->post_message(Messages::WindowClient::WindowCloseRequest(m_window_id)); | ||||||
|         break; |         break; | ||||||
|     case Event::WindowResized: |     case Event::WindowResized: | ||||||
|         m_client->post_message( |         m_client->post_message( | ||||||
|             WindowClient::WindowResized( |             Messages::WindowClient::WindowResized( | ||||||
|                 m_window_id, |                 m_window_id, | ||||||
|                 static_cast<const ResizeEvent&>(event).old_rect(), |                 static_cast<const ResizeEvent&>(event).old_rect(), | ||||||
|                 static_cast<const ResizeEvent&>(event).rect())); |                 static_cast<const ResizeEvent&>(event).rect())); | ||||||
|  |  | ||||||
|  | @ -213,7 +213,7 @@ void WindowManager::remove_window(Window& window) | ||||||
|         if (!(listener.wm_event_mask() & WMEventMask::WindowRemovals)) |         if (!(listener.wm_event_mask() & WMEventMask::WindowRemovals)) | ||||||
|             return IterationDecision::Continue; |             return IterationDecision::Continue; | ||||||
|         if (!window.is_internal()) |         if (!window.is_internal()) | ||||||
|             listener.client()->post_message(WindowClient::WM_WindowRemoved(listener.window_id(), window.client_id(), window.window_id())); |             listener.client()->post_message(Messages::WindowClient::WM_WindowRemoved(listener.window_id(), window.client_id(), window.window_id())); | ||||||
|         return IterationDecision::Continue; |         return IterationDecision::Continue; | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  | @ -224,7 +224,7 @@ void WindowManager::tell_wm_listener_about_window(Window& listener, Window& wind | ||||||
|         return; |         return; | ||||||
|     if (window.is_internal()) |     if (window.is_internal()) | ||||||
|         return; |         return; | ||||||
|     listener.client()->post_message(WindowClient::WM_WindowStateChanged(listener.window_id(), window.client_id(), window.window_id(), window.is_active(), window.is_minimized(), (i32)window.type(), window.title(), window.rect())); |     listener.client()->post_message(Messages::WindowClient::WM_WindowStateChanged(listener.window_id(), window.client_id(), window.window_id(), window.is_active(), window.is_minimized(), (i32)window.type(), window.title(), window.rect())); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void WindowManager::tell_wm_listener_about_window_rect(Window& listener, Window& window) | void WindowManager::tell_wm_listener_about_window_rect(Window& listener, Window& window) | ||||||
|  | @ -233,7 +233,7 @@ void WindowManager::tell_wm_listener_about_window_rect(Window& listener, Window& | ||||||
|         return; |         return; | ||||||
|     if (window.is_internal()) |     if (window.is_internal()) | ||||||
|         return; |         return; | ||||||
|     listener.client()->post_message(WindowClient::WM_WindowRectChanged(listener.window_id(), window.client_id(), window.window_id(), window.rect())); |     listener.client()->post_message(Messages::WindowClient::WM_WindowRectChanged(listener.window_id(), window.client_id(), window.window_id(), window.rect())); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void WindowManager::tell_wm_listener_about_window_icon(Window& listener, Window& window) | void WindowManager::tell_wm_listener_about_window_icon(Window& listener, Window& window) | ||||||
|  | @ -248,7 +248,7 @@ void WindowManager::tell_wm_listener_about_window_icon(Window& listener, Window& | ||||||
|     if (share_buffer_with(window.icon().shared_buffer_id(), listener.client()->client_pid()) < 0) { |     if (share_buffer_with(window.icon().shared_buffer_id(), listener.client()->client_pid()) < 0) { | ||||||
|         ASSERT_NOT_REACHED(); |         ASSERT_NOT_REACHED(); | ||||||
|     } |     } | ||||||
|     listener.client()->post_message(WindowClient::WM_WindowIconBitmapChanged(listener.window_id(), window.client_id(), window.window_id(), window.icon().shared_buffer_id(), window.icon().size())); |     listener.client()->post_message(Messages::WindowClient::WM_WindowIconBitmapChanged(listener.window_id(), window.client_id(), window.window_id(), window.icon().shared_buffer_id(), window.icon().size())); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void WindowManager::tell_wm_listeners_window_state_changed(Window& window) | void WindowManager::tell_wm_listeners_window_state_changed(Window& window) | ||||||
|  | @ -329,7 +329,7 @@ void WindowManager::notify_minimization_state_changed(Window& window) | ||||||
|     tell_wm_listeners_window_state_changed(window); |     tell_wm_listeners_window_state_changed(window); | ||||||
| 
 | 
 | ||||||
|     if (window.client()) |     if (window.client()) | ||||||
|         window.client()->post_message(WindowClient::WindowStateChanged(window.window_id(), window.is_minimized(), window.is_occluded())); |         window.client()->post_message(Messages::WindowClient::WindowStateChanged(window.window_id(), window.is_minimized(), window.is_occluded())); | ||||||
| 
 | 
 | ||||||
|     if (window.is_active() && window.is_minimized()) |     if (window.is_active() && window.is_minimized()) | ||||||
|         pick_new_active_window(); |         pick_new_active_window(); | ||||||
|  | @ -338,7 +338,7 @@ void WindowManager::notify_minimization_state_changed(Window& window) | ||||||
| void WindowManager::notify_occlusion_state_changed(Window& window) | void WindowManager::notify_occlusion_state_changed(Window& window) | ||||||
| { | { | ||||||
|     if (window.client()) |     if (window.client()) | ||||||
|         window.client()->post_message(WindowClient::WindowStateChanged(window.window_id(), window.is_minimized(), window.is_occluded())); |         window.client()->post_message(Messages::WindowClient::WindowStateChanged(window.window_id(), window.is_minimized(), window.is_occluded())); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void WindowManager::pick_new_active_window() | void WindowManager::pick_new_active_window() | ||||||
|  | @ -610,13 +610,13 @@ bool WindowManager::process_ongoing_drag(MouseEvent& event, Window*& hovered_win | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     if (hovered_window) { |     if (hovered_window) { | ||||||
|         m_dnd_client->post_message(WindowClient::DragAccepted()); |         m_dnd_client->post_message(Messages::WindowClient::DragAccepted()); | ||||||
|         if (hovered_window->client()) { |         if (hovered_window->client()) { | ||||||
|             auto translated_event = event.translated(-hovered_window->position()); |             auto translated_event = event.translated(-hovered_window->position()); | ||||||
|             hovered_window->client()->post_message(WindowClient::DragDropped(hovered_window->window_id(), translated_event.position(), m_dnd_text, m_dnd_data_type, m_dnd_data)); |             hovered_window->client()->post_message(Messages::WindowClient::DragDropped(hovered_window->window_id(), translated_event.position(), m_dnd_text, m_dnd_data_type, m_dnd_data)); | ||||||
|         } |         } | ||||||
|     } else { |     } else { | ||||||
|         m_dnd_client->post_message(WindowClient::DragCancelled()); |         m_dnd_client->post_message(Messages::WindowClient::DragCancelled()); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     end_dnd_drag(); |     end_dnd_drag(); | ||||||
|  | @ -965,7 +965,7 @@ void WindowManager::event(Core::Event& event) | ||||||
|         m_keyboard_modifiers = key_event.modifiers(); |         m_keyboard_modifiers = key_event.modifiers(); | ||||||
| 
 | 
 | ||||||
|         if (key_event.type() == Event::KeyDown && key_event.key() == Key_Escape && m_dnd_client) { |         if (key_event.type() == Event::KeyDown && key_event.key() == Key_Escape && m_dnd_client) { | ||||||
|             m_dnd_client->post_message(WindowClient::DragCancelled()); |             m_dnd_client->post_message(Messages::WindowClient::DragCancelled()); | ||||||
|             end_dnd_drag(); |             end_dnd_drag(); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  | @ -1275,7 +1275,7 @@ void WindowManager::update_theme(String theme_path, String theme_name) | ||||||
|     for_each_window([&](Window& window) { |     for_each_window([&](Window& window) { | ||||||
|         if (window.client()) { |         if (window.client()) { | ||||||
|             if (!notified_clients.contains(window.client())) { |             if (!notified_clients.contains(window.client())) { | ||||||
|                 window.client()->post_message(WindowClient::UpdateSystemTheme(Gfx::current_system_theme_buffer_id())); |                 window.client()->post_message(Messages::WindowClient::UpdateSystemTheme(Gfx::current_system_theme_buffer_id())); | ||||||
|                 notified_clients.set(window.client()); |                 notified_clients.set(window.client()); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling