diff options
33 files changed, 389 insertions, 385 deletions
diff --git a/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.cpp b/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.cpp index 6346f865e3..9080a6a908 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.cpp @@ -30,7 +30,7 @@ void ClientConnection::die() exit(0); } -OwnPtr<Messages::LanguageServer::GreetResponse> ClientConnection::handle(const Messages::LanguageServer::Greet& message) +Messages::LanguageServer::GreetResponse ClientConnection::handle(const Messages::LanguageServer::Greet& message) { m_filedb.set_project_root(message.project_root()); if (unveil(message.project_root().characters(), "r") < 0) { @@ -41,7 +41,7 @@ OwnPtr<Messages::LanguageServer::GreetResponse> ClientConnection::handle(const M perror("unveil"); exit(1); } - return make<Messages::LanguageServer::GreetResponse>(); + return {}; } void ClientConnection::handle(const Messages::LanguageServer::FileOpened& message) diff --git a/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.h b/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.h index d0b1b16610..092264898e 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.h +++ b/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.h @@ -29,7 +29,7 @@ public: virtual void die() override; protected: - virtual OwnPtr<Messages::LanguageServer::GreetResponse> handle(const Messages::LanguageServer::Greet&) override; + virtual Messages::LanguageServer::GreetResponse handle(const Messages::LanguageServer::Greet&) override; virtual void handle(const Messages::LanguageServer::FileOpened&) override; virtual void handle(const Messages::LanguageServer::FileEditInsertText&) override; virtual void handle(const Messages::LanguageServer::FileEditRemoveText&) override; diff --git a/Userland/DevTools/IPCCompiler/main.cpp b/Userland/DevTools/IPCCompiler/main.cpp index 2ce941c425..f6aaef8e56 100644 --- a/Userland/DevTools/IPCCompiler/main.cpp +++ b/Userland/DevTools/IPCCompiler/main.cpp @@ -313,6 +313,7 @@ public: )~~~"); message_generator.append(R"~~~( + @message.name@(decltype(nullptr)) : m_ipc_message_valid(false) { } @message.constructor@ virtual ~@message.name@() override {} @@ -402,6 +403,7 @@ public: message_generator.append(R"~~~( private: + bool m_ipc_message_valid { true }; )~~~"); for (auto& parameter : parameters) { @@ -529,7 +531,7 @@ public: return message; } - virtual OwnPtr<IPC::Message> handle(const IPC::Message& message) override + virtual OwnPtr<IPC::MessageBuffer> handle(const IPC::Message& message) override { switch (message.message_id()) { )~~~"); @@ -539,16 +541,19 @@ public: message_generator.set("message.name", name); message_generator.append(R"~~~( - case (int)Messages::@endpoint.name@::MessageID::@message.name@: + case (int)Messages::@endpoint.name@::MessageID::@message.name@: { )~~~"); if (returns_something) { message_generator.append(R"~~~( - return handle(static_cast<const Messages::@endpoint.name@::@message.name@&>(message)); + auto response = handle(static_cast<const Messages::@endpoint.name@::@message.name@&>(message)); + return make<IPC::MessageBuffer>(response.encode()); + } )~~~"); } else { message_generator.append(R"~~~( handle(static_cast<const Messages::@endpoint.name@::@message.name@&>(message)); return {}; + } )~~~"); } }; @@ -571,12 +576,11 @@ public: String return_type = "void"; if (message.is_synchronous) { StringBuilder builder; - builder.append("OwnPtr<Messages::"); + builder.append("Messages::"); builder.append(endpoint.name); builder.append("::"); builder.append(message.name); builder.append("Response"); - builder.append(">"); return_type = builder.to_string(); } message_generator.set("message.complex_return_type", return_type); diff --git a/Userland/Libraries/LibIPC/Connection.h b/Userland/Libraries/LibIPC/Connection.h index 8e487b4c73..01464b2f16 100644 --- a/Userland/Libraries/LibIPC/Connection.h +++ b/Userland/Libraries/LibIPC/Connection.h @@ -49,12 +49,17 @@ public: void post_message(const Message& message) { + post_message(message.encode()); + } + + // FIXME: unnecessary copy + void post_message(MessageBuffer buffer) + { // NOTE: If this connection is being shut down, but has not yet been destroyed, // the socket will be closed. Don't try to send more messages. if (!m_socket->is_open()) return; - auto buffer = message.encode(); // Prepend the message size. uint32_t message_size = buffer.data.size(); buffer.data.prepend(reinterpret_cast<const u8*>(&message_size), sizeof(message_size)); diff --git a/Userland/Libraries/LibIPC/Endpoint.h b/Userland/Libraries/LibIPC/Endpoint.h index 96176899f4..74184c8a80 100644 --- a/Userland/Libraries/LibIPC/Endpoint.h +++ b/Userland/Libraries/LibIPC/Endpoint.h @@ -16,6 +16,7 @@ class BufferStream; namespace IPC { class Message; +class MessageBuffer; class Endpoint { public: @@ -23,7 +24,7 @@ public: virtual u32 magic() const = 0; virtual String name() const = 0; - virtual OwnPtr<Message> handle(const Message&) = 0; + virtual OwnPtr<MessageBuffer> handle(const Message&) = 0; protected: Endpoint(); diff --git a/Userland/Libraries/LibProtocol/RequestClient.cpp b/Userland/Libraries/LibProtocol/RequestClient.cpp index 44a1a98b8d..477a1e2921 100644 --- a/Userland/Libraries/LibProtocol/RequestClient.cpp +++ b/Userland/Libraries/LibProtocol/RequestClient.cpp @@ -83,13 +83,13 @@ void RequestClient::handle(const Messages::RequestClient::HeadersBecameAvailable } } -OwnPtr<Messages::RequestClient::CertificateRequestedResponse> RequestClient::handle(const Messages::RequestClient::CertificateRequested& message) +Messages::RequestClient::CertificateRequestedResponse RequestClient::handle(const Messages::RequestClient::CertificateRequested& message) { if (auto request = const_cast<Request*>(m_requests.get(message.request_id()).value_or(nullptr))) { request->did_request_certificates({}); } - return make<Messages::RequestClient::CertificateRequestedResponse>(); + return {}; } } diff --git a/Userland/Libraries/LibProtocol/RequestClient.h b/Userland/Libraries/LibProtocol/RequestClient.h index 269f0d97ad..176187222d 100644 --- a/Userland/Libraries/LibProtocol/RequestClient.h +++ b/Userland/Libraries/LibProtocol/RequestClient.h @@ -35,7 +35,7 @@ private: virtual void handle(const Messages::RequestClient::RequestProgress&) override; virtual void handle(const Messages::RequestClient::RequestFinished&) override; - virtual OwnPtr<Messages::RequestClient::CertificateRequestedResponse> handle(const Messages::RequestClient::CertificateRequested&) override; + virtual Messages::RequestClient::CertificateRequestedResponse handle(const Messages::RequestClient::CertificateRequested&) override; virtual void handle(const Messages::RequestClient::HeadersBecameAvailable&) override; HashMap<i32, RefPtr<Request>> m_requests; diff --git a/Userland/Libraries/LibWeb/WebContentClient.cpp b/Userland/Libraries/LibWeb/WebContentClient.cpp index ce31a3c2ee..53284b936b 100644 --- a/Userland/Libraries/LibWeb/WebContentClient.cpp +++ b/Userland/Libraries/LibWeb/WebContentClient.cpp @@ -147,22 +147,20 @@ void WebContentClient::handle(const Messages::WebContentClient::DidJSConsoleOutp m_view.notify_server_did_js_console_output(message.method(), message.line()); } -OwnPtr<Messages::WebContentClient::DidRequestAlertResponse> WebContentClient::handle(const Messages::WebContentClient::DidRequestAlert& message) +Messages::WebContentClient::DidRequestAlertResponse WebContentClient::handle(const Messages::WebContentClient::DidRequestAlert& message) { m_view.notify_server_did_request_alert({}, message.message()); - return make<Messages::WebContentClient::DidRequestAlertResponse>(); + return {}; } -OwnPtr<Messages::WebContentClient::DidRequestConfirmResponse> WebContentClient::handle(const Messages::WebContentClient::DidRequestConfirm& message) +Messages::WebContentClient::DidRequestConfirmResponse WebContentClient::handle(const Messages::WebContentClient::DidRequestConfirm& message) { - auto result = m_view.notify_server_did_request_confirm({}, message.message()); - return make<Messages::WebContentClient::DidRequestConfirmResponse>(result); + return m_view.notify_server_did_request_confirm({}, message.message()); } -OwnPtr<Messages::WebContentClient::DidRequestPromptResponse> WebContentClient::handle(const Messages::WebContentClient::DidRequestPrompt& message) +Messages::WebContentClient::DidRequestPromptResponse WebContentClient::handle(const Messages::WebContentClient::DidRequestPrompt& message) { - auto result = m_view.notify_server_did_request_prompt({}, message.message(), message.default_()); - return make<Messages::WebContentClient::DidRequestPromptResponse>(result); + return m_view.notify_server_did_request_prompt({}, message.message(), message.default_()); } void WebContentClient::handle(const Messages::WebContentClient::DidChangeFavicon& message) @@ -174,10 +172,9 @@ void WebContentClient::handle(const Messages::WebContentClient::DidChangeFavicon m_view.notify_server_did_change_favicon(*message.favicon().bitmap()); } -OwnPtr<Messages::WebContentClient::DidRequestCookieResponse> WebContentClient::handle(const Messages::WebContentClient::DidRequestCookie& message) +Messages::WebContentClient::DidRequestCookieResponse WebContentClient::handle(const Messages::WebContentClient::DidRequestCookie& message) { - auto result = m_view.notify_server_did_request_cookie({}, message.url(), static_cast<Cookie::Source>(message.source())); - return make<Messages::WebContentClient::DidRequestCookieResponse>(result); + return m_view.notify_server_did_request_cookie({}, message.url(), static_cast<Cookie::Source>(message.source())); } void WebContentClient::handle(const Messages::WebContentClient::DidSetCookie& message) diff --git a/Userland/Libraries/LibWeb/WebContentClient.h b/Userland/Libraries/LibWeb/WebContentClient.h index 0816a77bfd..e344052033 100644 --- a/Userland/Libraries/LibWeb/WebContentClient.h +++ b/Userland/Libraries/LibWeb/WebContentClient.h @@ -53,10 +53,10 @@ private: virtual void handle(const Messages::WebContentClient::DidGetSource&) override; virtual void handle(const Messages::WebContentClient::DidJSConsoleOutput&) override; virtual void handle(const Messages::WebContentClient::DidChangeFavicon&) override; - virtual OwnPtr<Messages::WebContentClient::DidRequestAlertResponse> handle(const Messages::WebContentClient::DidRequestAlert&) override; - virtual OwnPtr<Messages::WebContentClient::DidRequestConfirmResponse> handle(const Messages::WebContentClient::DidRequestConfirm&) override; - virtual OwnPtr<Messages::WebContentClient::DidRequestPromptResponse> handle(const Messages::WebContentClient::DidRequestPrompt&) override; - virtual OwnPtr<Messages::WebContentClient::DidRequestCookieResponse> handle(const Messages::WebContentClient::DidRequestCookie&) override; + virtual Messages::WebContentClient::DidRequestAlertResponse handle(const Messages::WebContentClient::DidRequestAlert&) override; + virtual Messages::WebContentClient::DidRequestConfirmResponse handle(const Messages::WebContentClient::DidRequestConfirm&) override; + virtual Messages::WebContentClient::DidRequestPromptResponse handle(const Messages::WebContentClient::DidRequestPrompt&) override; + virtual Messages::WebContentClient::DidRequestCookieResponse handle(const Messages::WebContentClient::DidRequestCookie&) override; virtual void handle(const Messages::WebContentClient::DidSetCookie&) override; OutOfProcessWebView& m_view; diff --git a/Userland/Services/AudioServer/ClientConnection.cpp b/Userland/Services/AudioServer/ClientConnection.cpp index 84bdd827fa..773e2c57e0 100644 --- a/Userland/Services/AudioServer/ClientConnection.cpp +++ b/Userland/Services/AudioServer/ClientConnection.cpp @@ -59,82 +59,82 @@ void ClientConnection::did_change_main_mix_volume(Badge<Mixer>, int volume) post_message(Messages::AudioClient::MainMixVolumeChanged(volume)); } -OwnPtr<Messages::AudioServer::GreetResponse> ClientConnection::handle(const Messages::AudioServer::Greet&) +Messages::AudioServer::GreetResponse ClientConnection::handle(const Messages::AudioServer::Greet&) { - return make<Messages::AudioServer::GreetResponse>(); + return {}; } -OwnPtr<Messages::AudioServer::GetMainMixVolumeResponse> ClientConnection::handle(const Messages::AudioServer::GetMainMixVolume&) +Messages::AudioServer::GetMainMixVolumeResponse ClientConnection::handle(const Messages::AudioServer::GetMainMixVolume&) { - return make<Messages::AudioServer::GetMainMixVolumeResponse>(m_mixer.main_volume()); + return m_mixer.main_volume(); } -OwnPtr<Messages::AudioServer::SetMainMixVolumeResponse> ClientConnection::handle(const Messages::AudioServer::SetMainMixVolume& message) +Messages::AudioServer::SetMainMixVolumeResponse ClientConnection::handle(const Messages::AudioServer::SetMainMixVolume& message) { m_mixer.set_main_volume(message.volume()); - return make<Messages::AudioServer::SetMainMixVolumeResponse>(); + return {}; } -OwnPtr<Messages::AudioServer::EnqueueBufferResponse> ClientConnection::handle(const Messages::AudioServer::EnqueueBuffer& message) +Messages::AudioServer::EnqueueBufferResponse ClientConnection::handle(const Messages::AudioServer::EnqueueBuffer& message) { if (!m_queue) m_queue = m_mixer.create_queue(*this); if (m_queue->is_full()) - return make<Messages::AudioServer::EnqueueBufferResponse>(false); + return false; m_queue->enqueue(Audio::Buffer::create_with_anonymous_buffer(message.buffer(), message.buffer_id(), message.sample_count())); - return make<Messages::AudioServer::EnqueueBufferResponse>(true); + return true; } -OwnPtr<Messages::AudioServer::GetRemainingSamplesResponse> ClientConnection::handle(const Messages::AudioServer::GetRemainingSamples&) +Messages::AudioServer::GetRemainingSamplesResponse ClientConnection::handle(const Messages::AudioServer::GetRemainingSamples&) { int remaining = 0; if (m_queue) remaining = m_queue->get_remaining_samples(); - return make<Messages::AudioServer::GetRemainingSamplesResponse>(remaining); + return remaining; } -OwnPtr<Messages::AudioServer::GetPlayedSamplesResponse> ClientConnection::handle(const Messages::AudioServer::GetPlayedSamples&) +Messages::AudioServer::GetPlayedSamplesResponse ClientConnection::handle(const Messages::AudioServer::GetPlayedSamples&) { int played = 0; if (m_queue) played = m_queue->get_played_samples(); - return make<Messages::AudioServer::GetPlayedSamplesResponse>(played); + return played; } -OwnPtr<Messages::AudioServer::SetPausedResponse> ClientConnection::handle(const Messages::AudioServer::SetPaused& message) +Messages::AudioServer::SetPausedResponse ClientConnection::handle(const Messages::AudioServer::SetPaused& message) { if (m_queue) m_queue->set_paused(message.paused()); - return make<Messages::AudioServer::SetPausedResponse>(); + return {}; } -OwnPtr<Messages::AudioServer::ClearBufferResponse> ClientConnection::handle(const Messages::AudioServer::ClearBuffer& message) +Messages::AudioServer::ClearBufferResponse ClientConnection::handle(const Messages::AudioServer::ClearBuffer& message) { if (m_queue) m_queue->clear(message.paused()); - return make<Messages::AudioServer::ClearBufferResponse>(); + return {}; } -OwnPtr<Messages::AudioServer::GetPlayingBufferResponse> ClientConnection::handle(const Messages::AudioServer::GetPlayingBuffer&) +Messages::AudioServer::GetPlayingBufferResponse ClientConnection::handle(const Messages::AudioServer::GetPlayingBuffer&) { int id = -1; if (m_queue) id = m_queue->get_playing_buffer(); - return make<Messages::AudioServer::GetPlayingBufferResponse>(id); + return id; } -OwnPtr<Messages::AudioServer::GetMutedResponse> ClientConnection::handle(const Messages::AudioServer::GetMuted&) +Messages::AudioServer::GetMutedResponse ClientConnection::handle(const Messages::AudioServer::GetMuted&) { - return make<Messages::AudioServer::GetMutedResponse>(m_mixer.is_muted()); + return m_mixer.is_muted(); } -OwnPtr<Messages::AudioServer::SetMutedResponse> ClientConnection::handle(const Messages::AudioServer::SetMuted& message) +Messages::AudioServer::SetMutedResponse ClientConnection::handle(const Messages::AudioServer::SetMuted& message) { m_mixer.set_muted(message.muted()); - return make<Messages::AudioServer::SetMutedResponse>(); + return {}; } } diff --git a/Userland/Services/AudioServer/ClientConnection.h b/Userland/Services/AudioServer/ClientConnection.h index 851d33330b..0327fbd677 100644 --- a/Userland/Services/AudioServer/ClientConnection.h +++ b/Userland/Services/AudioServer/ClientConnection.h @@ -36,17 +36,17 @@ public: static void for_each(Function<void(ClientConnection&)>); private: - virtual OwnPtr<Messages::AudioServer::GreetResponse> handle(const Messages::AudioServer::Greet&) override; - virtual OwnPtr<Messages::AudioServer::GetMainMixVolumeResponse> handle(const Messages::AudioServer::GetMainMixVolume&) override; - virtual OwnPtr<Messages::AudioServer::SetMainMixVolumeResponse> handle(const Messages::AudioServer::SetMainMixVolume&) override; - virtual OwnPtr<Messages::AudioServer::EnqueueBufferResponse> handle(const Messages::AudioServer::EnqueueBuffer&) override; - virtual OwnPtr<Messages::AudioServer::GetRemainingSamplesResponse> handle(const Messages::AudioServer::GetRemainingSamples&) override; - virtual OwnPtr<Messages::AudioServer::GetPlayedSamplesResponse> handle(const Messages::AudioServer::GetPlayedSamples&) override; - virtual OwnPtr<Messages::AudioServer::SetPausedResponse> handle(const Messages::AudioServer::SetPaused&) override; - virtual OwnPtr<Messages::AudioServer::ClearBufferResponse> handle(const Messages::AudioServer::ClearBuffer&) override; - virtual OwnPtr<Messages::AudioServer::GetPlayingBufferResponse> handle(const Messages::AudioServer::GetPlayingBuffer&) override; - virtual OwnPtr<Messages::AudioServer::GetMutedResponse> handle(const Messages::AudioServer::GetMuted&) override; - virtual OwnPtr<Messages::AudioServer::SetMutedResponse> handle(const Messages::AudioServer::SetMuted&) override; + virtual Messages::AudioServer::GreetResponse handle(const Messages::AudioServer::Greet&) override; + virtual Messages::AudioServer::GetMainMixVolumeResponse handle(const Messages::AudioServer::GetMainMixVolume&) override; + virtual Messages::AudioServer::SetMainMixVolumeResponse handle(const Messages::AudioServer::SetMainMixVolume&) override; + virtual Messages::AudioServer::EnqueueBufferResponse handle(const Messages::AudioServer::EnqueueBuffer&) override; + virtual Messages::AudioServer::GetRemainingSamplesResponse handle(const Messages::AudioServer::GetRemainingSamples&) override; + virtual Messages::AudioServer::GetPlayedSamplesResponse handle(const Messages::AudioServer::GetPlayedSamples&) override; + virtual Messages::AudioServer::SetPausedResponse handle(const Messages::AudioServer::SetPaused&) override; + virtual Messages::AudioServer::ClearBufferResponse handle(const Messages::AudioServer::ClearBuffer&) override; + virtual Messages::AudioServer::GetPlayingBufferResponse handle(const Messages::AudioServer::GetPlayingBuffer&) override; + virtual Messages::AudioServer::GetMutedResponse handle(const Messages::AudioServer::GetMuted&) override; + virtual Messages::AudioServer::SetMutedResponse handle(const Messages::AudioServer::SetMuted&) override; Mixer& m_mixer; RefPtr<BufferQueue> m_queue; diff --git a/Userland/Services/Clipboard/ClientConnection.cpp b/Userland/Services/Clipboard/ClientConnection.cpp index 4f8130fac2..7f1a909390 100644 --- a/Userland/Services/Clipboard/ClientConnection.cpp +++ b/Userland/Services/Clipboard/ClientConnection.cpp @@ -35,21 +35,21 @@ void ClientConnection::die() s_connections.remove(client_id()); } -OwnPtr<Messages::ClipboardServer::GreetResponse> ClientConnection::handle(const Messages::ClipboardServer::Greet&) +Messages::ClipboardServer::GreetResponse ClientConnection::handle(const Messages::ClipboardServer::Greet&) { - return make<Messages::ClipboardServer::GreetResponse>(); + return {}; } -OwnPtr<Messages::ClipboardServer::SetClipboardDataResponse> ClientConnection::handle(const Messages::ClipboardServer::SetClipboardData& message) +Messages::ClipboardServer::SetClipboardDataResponse ClientConnection::handle(const Messages::ClipboardServer::SetClipboardData& message) { Storage::the().set_data(message.data(), message.mime_type(), message.metadata().entries()); - return make<Messages::ClipboardServer::SetClipboardDataResponse>(); + return {}; } -OwnPtr<Messages::ClipboardServer::GetClipboardDataResponse> ClientConnection::handle(const Messages::ClipboardServer::GetClipboardData&) +Messages::ClipboardServer::GetClipboardDataResponse ClientConnection::handle(const Messages::ClipboardServer::GetClipboardData&) { auto& storage = Storage::the(); - return make<Messages::ClipboardServer::GetClipboardDataResponse>(storage.buffer(), storage.mime_type(), storage.metadata()); + return { storage.buffer(), storage.mime_type(), storage.metadata() }; } void ClientConnection::notify_about_clipboard_change() diff --git a/Userland/Services/Clipboard/ClientConnection.h b/Userland/Services/Clipboard/ClientConnection.h index 3e3dbc1192..bba5f5543d 100644 --- a/Userland/Services/Clipboard/ClientConnection.h +++ b/Userland/Services/Clipboard/ClientConnection.h @@ -30,9 +30,9 @@ public: void notify_about_clipboard_change(); private: - virtual OwnPtr<Messages::ClipboardServer::GreetResponse> handle(const Messages::ClipboardServer::Greet&) override; - virtual OwnPtr<Messages::ClipboardServer::GetClipboardDataResponse> handle(const Messages::ClipboardServer::GetClipboardData&) override; - virtual OwnPtr<Messages::ClipboardServer::SetClipboardDataResponse> handle(const Messages::ClipboardServer::SetClipboardData&) override; + virtual Messages::ClipboardServer::GreetResponse handle(const Messages::ClipboardServer::Greet&) override; + virtual Messages::ClipboardServer::GetClipboardDataResponse handle(const Messages::ClipboardServer::GetClipboardData&) override; + virtual Messages::ClipboardServer::SetClipboardDataResponse handle(const Messages::ClipboardServer::SetClipboardData&) override; }; } diff --git a/Userland/Services/ImageDecoder/ClientConnection.cpp b/Userland/Services/ImageDecoder/ClientConnection.cpp index 47bcd9f513..72bd2edb09 100644 --- a/Userland/Services/ImageDecoder/ClientConnection.cpp +++ b/Userland/Services/ImageDecoder/ClientConnection.cpp @@ -30,24 +30,24 @@ void ClientConnection::die() exit(0); } -OwnPtr<Messages::ImageDecoderServer::GreetResponse> ClientConnection::handle(const Messages::ImageDecoderServer::Greet&) +Messages::ImageDecoderServer::GreetResponse ClientConnection::handle(const Messages::ImageDecoderServer::Greet&) { - return make<Messages::ImageDecoderServer::GreetResponse>(); + return {}; } -OwnPtr<Messages::ImageDecoderServer::DecodeImageResponse> ClientConnection::handle(const Messages::ImageDecoderServer::DecodeImage& message) +Messages::ImageDecoderServer::DecodeImageResponse ClientConnection::handle(const Messages::ImageDecoderServer::DecodeImage& message) { auto encoded_buffer = message.data(); if (!encoded_buffer.is_valid()) { dbgln_if(IMAGE_DECODER_DEBUG, "Encoded data is invalid"); - return {}; + return nullptr; } auto decoder = Gfx::ImageDecoder::create(encoded_buffer.data<u8>(), encoded_buffer.size()); if (!decoder->frame_count()) { dbgln_if(IMAGE_DECODER_DEBUG, "Could not decode image from encoded data"); - return make<Messages::ImageDecoderServer::DecodeImageResponse>(false, 0, Vector<Gfx::ShareableBitmap> {}, Vector<u32> {}); + return { false, 0, Vector<Gfx::ShareableBitmap> {}, Vector<u32> {} }; } Vector<Gfx::ShareableBitmap> bitmaps; @@ -68,7 +68,7 @@ OwnPtr<Messages::ImageDecoderServer::DecodeImageResponse> ClientConnection::hand durations.append(frame.duration); } - return make<Messages::ImageDecoderServer::DecodeImageResponse>(decoder->is_animated(), decoder->loop_count(), bitmaps, durations); + return { decoder->is_animated(), decoder->loop_count(), bitmaps, durations }; } } diff --git a/Userland/Services/ImageDecoder/ClientConnection.h b/Userland/Services/ImageDecoder/ClientConnection.h index fe8ebca06c..0f562ede62 100644 --- a/Userland/Services/ImageDecoder/ClientConnection.h +++ b/Userland/Services/ImageDecoder/ClientConnection.h @@ -27,8 +27,8 @@ public: virtual void die() override; private: - virtual OwnPtr<Messages::ImageDecoderServer::GreetResponse> handle(const Messages::ImageDecoderServer::Greet&) override; - virtual OwnPtr<Messages::ImageDecoderServer::DecodeImageResponse> handle(const Messages::ImageDecoderServer::DecodeImage&) override; + virtual Messages::ImageDecoderServer::GreetResponse handle(const Messages::ImageDecoderServer::Greet&) override; + virtual Messages::ImageDecoderServer::DecodeImageResponse handle(const Messages::ImageDecoderServer::DecodeImage&) override; }; } diff --git a/Userland/Services/LaunchServer/ClientConnection.cpp b/Userland/Services/LaunchServer/ClientConnection.cpp index 07ecdc764f..c5ab40e6dd 100644 --- a/Userland/Services/LaunchServer/ClientConnection.cpp +++ b/Userland/Services/LaunchServer/ClientConnection.cpp @@ -28,12 +28,12 @@ void ClientConnection::die() s_connections.remove(client_id()); } -OwnPtr<Messages::LaunchServer::GreetResponse> ClientConnection::handle(const Messages::LaunchServer::Greet&) +Messages::LaunchServer::GreetResponse ClientConnection::handle(const Messages::LaunchServer::Greet&) { - return make<Messages::LaunchServer::GreetResponse>(); + return {}; } -OwnPtr<Messages::LaunchServer::OpenURLResponse> ClientConnection::handle(const Messages::LaunchServer::OpenURL& request) +Messages::LaunchServer::OpenURLResponse ClientConnection::handle(const Messages::LaunchServer::OpenURL& request) { if (!m_allowlist.is_empty()) { bool allowed = false; @@ -47,30 +47,27 @@ OwnPtr<Messages::LaunchServer::OpenURLResponse> ClientConnection::handle(const M if (!allowed) { // You are not on the list, go home! did_misbehave(String::formatted("Client requested a combination of handler/URL that was not on the list: '{}' with '{}'", request.handler_name(), request.url()).characters()); - return {}; + return nullptr; } } URL url(request.url()); - auto result = Launcher::the().open_url(url, request.handler_name()); - return make<Messages::LaunchServer::OpenURLResponse>(result); + return Launcher::the().open_url(url, request.handler_name()); } -OwnPtr<Messages::LaunchServer::GetHandlersForURLResponse> ClientConnection::handle(const Messages::LaunchServer::GetHandlersForURL& request) +Messages::LaunchServer::GetHandlersForURLResponse ClientConnection::handle(const Messages::LaunchServer::GetHandlersForURL& request) { URL url(request.url()); - auto result = Launcher::the().handlers_for_url(url); - return make<Messages::LaunchServer::GetHandlersForURLResponse>(result); + return Launcher::the().handlers_for_url(url); } -OwnPtr<Messages::LaunchServer::GetHandlersWithDetailsForURLResponse> ClientConnection::handle(const Messages::LaunchServer::GetHandlersWithDetailsForURL& request) +Messages::LaunchServer::GetHandlersWithDetailsForURLResponse ClientConnection::handle(const Messages::LaunchServer::GetHandlersWithDetailsForURL& request) { URL url(request.url()); - auto result = Launcher::the().handlers_with_details_for_url(url); - return make<Messages::LaunchServer::GetHandlersWithDetailsForURLResponse>(result); + return Launcher::the().handlers_with_details_for_url(url); } -OwnPtr<Messages::LaunchServer::AddAllowedURLResponse> ClientConnection::handle(const Messages::LaunchServer::AddAllowedURL& request) +Messages::LaunchServer::AddAllowedURLResponse ClientConnection::handle(const Messages::LaunchServer::AddAllowedURL& request) { if (m_allowlist_is_sealed) { did_misbehave("Got request to add more allowed handlers after list was sealed"); @@ -84,10 +81,10 @@ OwnPtr<Messages::LaunchServer::AddAllowedURLResponse> ClientConnection::handle(c m_allowlist.empend(String(), false, Vector<URL> { request.url() }); - return make<Messages::LaunchServer::AddAllowedURLResponse>(); + return {}; } -OwnPtr<Messages::LaunchServer::AddAllowedHandlerWithAnyURLResponse> ClientConnection::handle(const Messages::LaunchServer::AddAllowedHandlerWithAnyURL& request) +Messages::LaunchServer::AddAllowedHandlerWithAnyURLResponse ClientConnection::handle(const Messages::LaunchServer::AddAllowedHandlerWithAnyURL& request) { if (m_allowlist_is_sealed) { did_misbehave("Got request to add more allowed handlers after list was sealed"); @@ -101,10 +98,10 @@ OwnPtr<Messages::LaunchServer::AddAllowedHandlerWithAnyURLResponse> ClientConnec m_allowlist.empend(request.handler_name(), true, Vector<URL>()); - return make<Messages::LaunchServer::AddAllowedHandlerWithAnyURLResponse>(); + return {}; } -OwnPtr<Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLsResponse> ClientConnection::handle(const Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLs& request) +Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLsResponse ClientConnection::handle(const Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLs& request) { if (m_allowlist_is_sealed) { did_misbehave("Got request to add more allowed handlers after list was sealed"); @@ -123,17 +120,17 @@ OwnPtr<Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLsResponse> Cl m_allowlist.empend(request.handler_name(), false, request.urls()); - return make<Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLsResponse>(); + return {}; } -OwnPtr<Messages::LaunchServer::SealAllowlistResponse> ClientConnection::handle(const Messages::LaunchServer::SealAllowlist&) +Messages::LaunchServer::SealAllowlistResponse ClientConnection::handle(const Messages::LaunchServer::SealAllowlist&) { if (m_allowlist_is_sealed) { did_misbehave("Got more than one request to seal the allowed handlers list"); return {}; } - return make<Messages::LaunchServer::SealAllowlistResponse>(); + return {}; } } diff --git a/Userland/Services/LaunchServer/ClientConnection.h b/Userland/Services/LaunchServer/ClientConnection.h index f4f140e151..1b4658c0a1 100644 --- a/Userland/Services/LaunchServer/ClientConnection.h +++ b/Userland/Services/LaunchServer/ClientConnection.h @@ -23,14 +23,14 @@ public: private: explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id); - virtual OwnPtr<Messages::LaunchServer::GreetResponse> handle(const Messages::LaunchServer::Greet&) override; - virtual OwnPtr<Messages::LaunchServer::OpenURLResponse> handle(const Messages::LaunchServer::OpenURL&) override; - virtual OwnPtr<Messages::LaunchServer::GetHandlersForURLResponse> handle(const Messages::LaunchServer::GetHandlersForURL&) override; - virtual OwnPtr<Messages::LaunchServer::GetHandlersWithDetailsForURLResponse> handle(const Messages::LaunchServer::GetHandlersWithDetailsForURL&) override; - virtual OwnPtr<Messages::LaunchServer::AddAllowedURLResponse> handle(const Messages::LaunchServer::AddAllowedURL&) override; - virtual OwnPtr<Messages::LaunchServer::AddAllowedHandlerWithAnyURLResponse> handle(const Messages::LaunchServer::AddAllowedHandlerWithAnyURL&) override; - virtual OwnPtr<Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLsResponse> handle(const Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLs&) override; - virtual OwnPtr<Messages::LaunchServer::SealAllowlistResponse> handle(const Messages::LaunchServer::SealAllowlist&) override; + virtual Messages::LaunchServer::GreetResponse handle(const Messages::LaunchServer::Greet&) override; + virtual Messages::LaunchServer::OpenURLResponse handle(const Messages::LaunchServer::OpenURL&) override; + virtual Messages::LaunchServer::GetHandlersForURLResponse handle(const Messages::LaunchServer::GetHandlersForURL&) override; + virtual Messages::LaunchServer::GetHandlersWithDetailsForURLResponse handle(const Messages::LaunchServer::GetHandlersWithDetailsForURL&) override; + virtual Messages::LaunchServer::AddAllowedURLResponse handle(const Messages::LaunchServer::AddAllowedURL&) override; + virtual Messages::LaunchServer::AddAllowedHandlerWithAnyURLResponse handle(const Messages::LaunchServer::AddAllowedHandlerWithAnyURL&) override; + virtual Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLsResponse handle(const Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLs&) override; + virtual Messages::LaunchServer::SealAllowlistResponse handle(const Messages::LaunchServer::SealAllowlist&) override; struct AllowlistEntry { String handler_name; diff --git a/Userland/Services/LookupServer/ClientConnection.cpp b/Userland/Services/LookupServer/ClientConnection.cpp index dfab779fe7..51adca6e07 100644 --- a/Userland/Services/LookupServer/ClientConnection.cpp +++ b/Userland/Services/LookupServer/ClientConnection.cpp @@ -28,22 +28,22 @@ void ClientConnection::die() s_connections.remove(client_id()); } -OwnPtr<Messages::LookupServer::LookupNameResponse> ClientConnection::handle(const Messages::LookupServer::LookupName& message) +Messages::LookupServer::LookupNameResponse ClientConnection::handle(const Messages::LookupServer::LookupName& message) { auto answers = LookupServer::the().lookup(message.name(), T_A); if (answers.is_empty()) - return make<Messages::LookupServer::LookupNameResponse>(1, Vector<String>()); + return { 1, Vector<String>() }; Vector<String> addresses; for (auto& answer : answers) { addresses.append(answer.record_data()); } - return make<Messages::LookupServer::LookupNameResponse>(0, move(addresses)); + return { 0, move(addresses) }; } -OwnPtr<Messages::LookupServer::LookupAddressResponse> ClientConnection::handle(const Messages::LookupServer::LookupAddress& message) +Messages::LookupServer::LookupAddressResponse ClientConnection::handle(const Messages::LookupServer::LookupAddress& message) { if (message.address().length() != 4) - return make<Messages::LookupServer::LookupAddressResponse>(1, String()); + return { 1, String() }; IPv4Address address { (const u8*)message.address().characters() }; auto name = String::formatted("{}.{}.{}.{}.in-addr.arpa", address[3], @@ -52,7 +52,7 @@ OwnPtr<Messages::LookupServer::LookupAddressResponse> ClientConnection::handle(c address[0]); auto answers = LookupServer::the().lookup(name, T_PTR); if (answers.is_empty()) - return make<Messages::LookupServer::LookupAddressResponse>(1, String()); - return make<Messages::LookupServer::LookupAddressResponse>(0, answers[0].record_data()); + return { 1, String() }; + return { 0, answers[0].record_data() }; } } diff --git a/Userland/Services/LookupServer/ClientConnection.h b/Userland/Services/LookupServer/ClientConnection.h index 004c30227d..2c0e39cbb8 100644 --- a/Userland/Services/LookupServer/ClientConnection.h +++ b/Userland/Services/LookupServer/ClientConnection.h @@ -26,8 +26,8 @@ public: virtual void die() override; private: - virtual OwnPtr<Messages::LookupServer::LookupNameResponse> handle(const Messages::LookupServer::LookupName&) override; - virtual OwnPtr<Messages::LookupServer::LookupAddressResponse> handle(const Messages::LookupServer::LookupAddress&) override; + virtual Messages::LookupServer::LookupNameResponse handle(const Messages::LookupServer::LookupName&) override; + virtual Messages::LookupServer::LookupAddressResponse handle(const Messages::LookupServer::LookupAddress&) override; }; } diff --git a/Userland/Services/NotificationServer/ClientConnection.cpp b/Userland/Services/NotificationServer/ClientConnection.cpp index 2c25b9aea9..593dc2a16b 100644 --- a/Userland/Services/NotificationServer/ClientConnection.cpp +++ b/Userland/Services/NotificationServer/ClientConnection.cpp @@ -28,50 +28,50 @@ void ClientConnection::die() s_connections.remove(client_id()); } -OwnPtr<Messages::NotificationServer::GreetResponse> ClientConnection::handle(const Messages::NotificationServer::Greet&) +Messages::NotificationServer::GreetResponse ClientConnection::handle(const Messages::NotificationServer::Greet&) { - return make<Messages::NotificationServer::GreetResponse>(); + return {}; } -OwnPtr<Messages::NotificationServer::ShowNotificationResponse> ClientConnection::handle(const Messages::NotificationServer::ShowNotification& message) +Messages::NotificationServer::ShowNotificationResponse ClientConnection::handle(const Messages::NotificationServer::ShowNotification& message) { auto window = NotificationWindow::construct(client_id(), message.text(), message.title(), message.icon()); window->show(); - return make<Messages::NotificationServer::ShowNotificationResponse>(); + return {}; } -OwnPtr<Messages::NotificationServer::CloseNotificationResponse> ClientConnection::handle([[maybe_unused]] const Messages::NotificationServer::CloseNotification& message) +Messages::NotificationServer::CloseNotificationResponse ClientConnection::handle([[maybe_unused]] const Messages::NotificationServer::CloseNotification& message) { auto window = NotificationWindow::get_window_by_id(client_id()); if (window) { window->close(); } - return make<Messages::NotificationServer::CloseNotificationResponse>(); + return {}; } -OwnPtr<Messages::NotificationServer::UpdateNotificationIconResponse> ClientConnection::handle(const Messages::NotificationServer::UpdateNotificationIcon& message) +Messages::NotificationServer::UpdateNotificationIconResponse ClientConnection::handle(const Messages::NotificationServer::UpdateNotificationIcon& message) { auto window = NotificationWindow::get_window_by_id(client_id()); if (window) { window->set_image(message.icon()); } - return make<Messages::NotificationServer::UpdateNotificationIconResponse>(window); + return !!window; } -OwnPtr<Messages::NotificationServer::UpdateNotificationTextResponse> ClientConnection::handle(const Messages::NotificationServer::UpdateNotificationText& message) +Messages::NotificationServer::UpdateNotificationTextResponse ClientConnection::handle(const Messages::NotificationServer::UpdateNotificationText& message) { auto window = NotificationWindow::get_window_by_id(client_id()); if (window) { window->set_text(message.text()); window->set_title(message.title()); } - return make<Messages::NotificationServer::UpdateNotificationTextResponse>(window); + return !!window; } -OwnPtr<Messages::NotificationServer::IsShowingResponse> ClientConnection::handle(const Messages::NotificationServer::IsShowing&) +Messages::NotificationServer::IsShowingResponse ClientConnection::handle(const Messages::NotificationServer::IsShowing&) { auto window = NotificationWindow::get_window_by_id(client_id()); - return make<Messages::NotificationServer::IsShowingResponse>(window); + return !!window; } } diff --git a/Userland/Services/NotificationServer/ClientConnection.h b/Userland/Services/NotificationServer/ClientConnection.h index f733a8eb53..e4d2ac9488 100644 --- a/Userland/Services/NotificationServer/ClientConnection.h +++ b/Userland/Services/NotificationServer/ClientConnection.h @@ -23,12 +23,12 @@ public: private: explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id); - virtual OwnPtr<Messages::NotificationServer::GreetResponse> handle(const Messages::NotificationServer::Greet&) override; - virtual OwnPtr<Messages::NotificationServer::ShowNotificationResponse> handle(const Messages::NotificationServer::ShowNotification&) override; - virtual OwnPtr<Messages::NotificationServer::CloseNotificationResponse> handle(const Messages::NotificationServer::CloseNotification& message) override; - virtual OwnPtr<Messages::NotificationServer::UpdateNotificationIconResponse> handle(const Messages::NotificationServer::UpdateNotificationIcon& message) override; - virtual OwnPtr<Messages::NotificationServer::UpdateNotificationTextResponse> handle(const Messages::NotificationServer::UpdateNotificationText& message) override; - virtual OwnPtr<Messages::NotificationServer::IsShowingResponse> handle(const Messages::NotificationServer::IsShowing& message) override; + virtual Messages::NotificationServer::GreetResponse handle(const Messages::NotificationServer::Greet&) override; + virtual Messages::NotificationServer::ShowNotificationResponse handle(const Messages::NotificationServer::ShowNotification&) override; + virtual Messages::NotificationServer::CloseNotificationResponse handle(const Messages::NotificationServer::CloseNotification& message) override; + virtual Messages::NotificationServer::UpdateNotificationIconResponse handle(const Messages::NotificationServer::UpdateNotificationIcon& message) override; + virtual Messages::NotificationServer::UpdateNotificationTextResponse handle(const Messages::NotificationServer::UpdateNotificationText& message) override; + virtual Messages::NotificationServer::IsShowingResponse handle(const Messages::NotificationServer::IsShowing& message) override; }; } diff --git a/Userland/Services/RequestServer/ClientConnection.cpp b/Userland/Services/RequestServer/ClientConnection.cpp index 8324f32ca6..38ab575cff 100644 --- a/Userland/Services/RequestServer/ClientConnection.cpp +++ b/Userland/Services/RequestServer/ClientConnection.cpp @@ -31,36 +31,36 @@ void ClientConnection::die() Core::EventLoop::current().quit(0); } -OwnPtr<Messages::RequestServer::IsSupportedProtocolResponse> ClientConnection::handle(const Messages::RequestServer::IsSupportedProtocol& message) +Messages::RequestServer::IsSupportedProtocolResponse ClientConnection::handle(const Messages::RequestServer::IsSupportedProtocol& message) { bool supported = Protocol::find_by_name(message.protocol().to_lowercase()); - return make<Messages::RequestServer::IsSupportedProtocolResponse>(supported); + return supported; } -OwnPtr<Messages::RequestServer::StartRequestResponse> ClientConnection::handle(const Messages::RequestServer::StartRequest& message) +Messages::RequestServer::StartRequestResponse ClientConnection::handle(const Messages::RequestServer::StartRequest& message) { const auto& url = message.url(); if (!url.is_valid()) { dbgln("StartRequest: Invalid URL requested: '{}'", url); - return make<Messages::RequestServer::StartRequestResponse>(-1, Optional<IPC::File> {}); + return { -1, Optional<IPC::File> {} }; } auto* protocol = Protocol::find_by_name(url.protocol()); if (!protocol) { dbgln("StartRequest: No protocol handler for URL: '{}'", url); - return make<Messages::RequestServer::StartRequestResponse>(-1, Optional<IPC::File> {}); + return { -1, Optional<IPC::File> {} }; } auto request = protocol->start_request(*this, message.method(), url, message.request_headers().entries(), message.request_body()); if (!request) { dbgln("StartRequest: Protocol handler failed to start request: '{}'", url); - return make<Messages::RequestServer::StartRequestResponse>(-1, Optional<IPC::File> {}); + return { -1, Optional<IPC::File> {} }; } auto id = request->id(); auto fd = request->request_fd(); m_requests.set(id, move(request)); - return make<Messages::RequestServer::StartRequestResponse>(id, IPC::File(fd, IPC::File::CloseAfterSending)); + return { id, IPC::File(fd, IPC::File::CloseAfterSending) }; } -OwnPtr<Messages::RequestServer::StopRequestResponse> ClientConnection::handle(const Messages::RequestServer::StopRequest& message) +Messages::RequestServer::StopRequestResponse ClientConnection::handle(const Messages::RequestServer::StopRequest& message) { auto* request = const_cast<Request*>(m_requests.get(message.request_id()).value_or(nullptr)); bool success = false; @@ -69,7 +69,7 @@ OwnPtr<Messages::RequestServer::StopRequestResponse> ClientConnection::handle(co m_requests.remove(message.request_id()); success = true; } - return make<Messages::RequestServer::StopRequestResponse>(success); + return success; } void ClientConnection::did_receive_headers(Badge<Request>, Request& request) @@ -100,12 +100,12 @@ void ClientConnection::did_request_certificates(Badge<Request>, Request& request post_message(Messages::RequestClient::CertificateRequested(request.id())); } -OwnPtr<Messages::RequestServer::GreetResponse> ClientConnection::handle(const Messages::RequestServer::Greet&) +Messages::RequestServer::GreetResponse ClientConnection::handle(const Messages::RequestServer::Greet&) { - return make<Messages::RequestServer::GreetResponse>(); + return {}; } -OwnPtr<Messages::RequestServer::SetCertificateResponse> ClientConnection::handle(const Messages::RequestServer::SetCertificate& message) +Messages::RequestServer::SetCertificateResponse ClientConnection::handle(const Messages::RequestServer::SetCertificate& message) { auto* request = const_cast<Request*>(m_requests.get(message.request_id()).value_or(nullptr)); bool success = false; @@ -113,7 +113,7 @@ OwnPtr<Messages::RequestServer::SetCertificateResponse> ClientConnection::handle request->set_certificate(message.certificate(), message.key()); success = true; } - return make<Messages::RequestServer::SetCertificateResponse>(success); + return success; } } diff --git a/Userland/Services/RequestServer/ClientConnection.h b/Userland/Services/RequestServer/ClientConnection.h index 6760d75aee..813dacb8ec 100644 --- a/Userland/Services/RequestServer/ClientConnection.h +++ b/Userland/Services/RequestServer/ClientConnection.h @@ -31,11 +31,11 @@ public: void did_request_certificates(Badge<Request>, Request&); private: - virtual OwnPtr<Messages::RequestServer::GreetResponse> handle(const Messages::RequestServer::Greet&) override; - virtual OwnPtr<Messages::RequestServer::IsSupportedProtocolResponse> handle(const Messages::RequestServer::IsSupportedProtocol&) override; - virtual OwnPtr<Messages::RequestServer::StartRequestResponse> handle(const Messages::RequestServer::StartRequest&) override; - virtual OwnPtr<Messages::RequestServer::StopRequestResponse> handle(const Messages::RequestServer::StopRequest&) override; - virtual OwnPtr<Messages::RequestServer::SetCertificateResponse> handle(const Messages::RequestServer::SetCertificate&) override; + virtual Messages::RequestServer::GreetResponse handle(const Messages::RequestServer::Greet&) override; + virtual Messages::RequestServer::IsSupportedProtocolResponse handle(const Messages::RequestServer::IsSupportedProtocol&) override; + virtual Messages::RequestServer::StartRequestResponse handle(const Messages::RequestServer::StartRequest&) override; + virtual Messages::RequestServer::StopRequestResponse handle(const Messages::RequestServer::StopRequest&) override; + virtual Messages::RequestServer::SetCertificateResponse handle(const Messages::RequestServer::SetCertificate&) override; HashMap<i32, OwnPtr<Request>> m_requests; }; diff --git a/Userland/Services/SymbolServer/ClientConnection.cpp b/Userland/Services/SymbolServer/ClientConnection.cpp index 74cf1624dd..d6d2baaecb 100644 --- a/Userland/Services/SymbolServer/ClientConnection.cpp +++ b/Userland/Services/SymbolServer/ClientConnection.cpp @@ -35,12 +35,12 @@ void ClientConnection::die() s_connections.remove(client_id()); } -OwnPtr<Messages::SymbolServer::GreetResponse> ClientConnection::handle(const Messages::SymbolServer::Greet&) +Messages::SymbolServer::GreetResponse ClientConnection::handle(const Messages::SymbolServer::Greet&) { - return make<Messages::SymbolServer::GreetResponse>(); + return {}; } -OwnPtr<Messages::SymbolServer::SymbolicateResponse> ClientConnection::handle(const Messages::SymbolServer::Symbolicate& message) +Messages::SymbolServer::SymbolicateResponse ClientConnection::handle(const Messages::SymbolServer::Symbolicate& message) { auto path = message.path(); if (!s_cache.contains(path)) { @@ -48,13 +48,13 @@ OwnPtr<Messages::SymbolServer::SymbolicateResponse> ClientConnection::handle(con if (mapped_file.is_error()) { dbgln("Failed to map {}: {}", path, mapped_file.error().string()); s_cache.set(path, {}); - return make<Messages::SymbolServer::SymbolicateResponse>(false, String {}, 0, String {}, 0); + return { false, String {}, 0, String {}, 0 }; } auto elf = make<ELF::Image>(mapped_file.value()->bytes()); if (!elf->is_valid()) { dbgln("ELF not valid: {}", path); s_cache.set(path, {}); - return make<Messages::SymbolServer::SymbolicateResponse>(false, String {}, 0, String {}, 0); + return { false, String {}, 0, String {}, 0 }; } Debug::DebugInfo debug_info(move(elf)); auto cached_elf = make<CachedELF>(mapped_file.release_value(), move(debug_info)); @@ -66,7 +66,7 @@ OwnPtr<Messages::SymbolServer::SymbolicateResponse> ClientConnection::handle(con auto& cached_elf = it->value; if (!cached_elf) - return make<Messages::SymbolServer::SymbolicateResponse>(false, String {}, 0, String {}, 0); + return { false, String {}, 0, String {}, 0 }; u32 offset = 0; auto symbol = cached_elf->debug_info.elf().symbolicate(message.address(), &offset); @@ -78,7 +78,7 @@ OwnPtr<Messages::SymbolServer::SymbolicateResponse> ClientConnection::handle(con line_number = source_position.value().line_number; } - return make<Messages::SymbolServer::SymbolicateResponse>(true, symbol, offset, filename, line_number); + return { true, symbol, offset, filename, line_number }; } } diff --git a/Userland/Services/SymbolServer/ClientConnection.h b/Userland/Services/SymbolServer/ClientConnection.h index fb4799b855..6bcba29f03 100644 --- a/Userland/Services/SymbolServer/ClientConnection.h +++ b/Userland/Services/SymbolServer/ClientConnection.h @@ -27,8 +27,8 @@ public: virtual void die() override; private: - virtual OwnPtr<Messages::SymbolServer::GreetResponse> handle(const Messages::SymbolServer::Greet&) override; - virtual OwnPtr<Messages::SymbolServer::SymbolicateResponse> handle(const Messages::SymbolServer::Symbolicate&) override; + virtual Messages::SymbolServer::GreetResponse handle(const Messages::SymbolServer::Greet&) override; + virtual Messages::SymbolServer::SymbolicateResponse handle(const Messages::SymbolServer::Symbolicate&) override; }; } diff --git a/Userland/Services/WebContent/ClientConnection.cpp b/Userland/Services/WebContent/ClientConnection.cpp index 0e63da735e..8219944b9a 100644 --- a/Userland/Services/WebContent/ClientConnection.cpp +++ b/Userland/Services/WebContent/ClientConnection.cpp @@ -58,9 +58,9 @@ const Web::Page& ClientConnection::page() const return m_page_host->page(); } -OwnPtr<Messages::WebContentServer::GreetResponse> ClientConnection::handle(const Messages::WebContentServer::Greet&) +Messages::WebContentServer::GreetResponse ClientConnection::handle(const Messages::WebContentServer::Greet&) { - return make<Messages::WebContentServer::GreetResponse>(); + return {}; } void ClientConnection::handle(const Messages::WebContentServer::UpdateSystemTheme& message) diff --git a/Userland/Services/WebContent/ClientConnection.h b/Userland/Services/WebContent/ClientConnection.h index e62451b505..694bb2543c 100644 --- a/Userland/Services/WebContent/ClientConnection.h +++ b/Userland/Services/WebContent/ClientConnection.h @@ -33,7 +33,7 @@ private: Web::Page& page(); const Web::Page& page() const; - virtual OwnPtr<Messages::WebContentServer::GreetResponse> handle(const Messages::WebContentServer::Greet&) override; + virtual Messages::WebContentServer::GreetResponse handle(const Messages::WebContentServer::Greet&) override; virtual void handle(const Messages::WebContentServer::UpdateSystemTheme&) override; virtual void handle(const Messages::WebContentServer::UpdateScreenRect&) override; virtual void handle(const Messages::WebContentServer::LoadURL&) override; diff --git a/Userland/Services/WebSocket/ClientConnection.cpp b/Userland/Services/WebSocket/ClientConnection.cpp index 683749b409..e549def70e 100644 --- a/Userland/Services/WebSocket/ClientConnection.cpp +++ b/Userland/Services/WebSocket/ClientConnection.cpp @@ -31,17 +31,17 @@ void ClientConnection::die() Core::EventLoop::current().quit(0); } -OwnPtr<Messages::WebSocketServer::GreetResponse> ClientConnection::handle(const Messages::WebSocketServer::Greet&) +Messages::WebSocketServer::GreetResponse ClientConnection::handle(const Messages::WebSocketServer::Greet&) { - return make<Messages::WebSocketServer::GreetResponse>(); + return {}; } -OwnPtr<Messages::WebSocketServer::ConnectResponse> ClientConnection::handle(const Messages::WebSocketServer::Connect& message) +Messages::WebSocketServer::ConnectResponse ClientConnection::handle(const Messages::WebSocketServer::Connect& message) { const auto& url = message.url(); if (!url.is_valid()) { dbgln("WebSocket::Connect: Invalid URL requested: '{}'", url); - return make<Messages::WebSocketServer::ConnectResponse>(-1); + return -1; } ConnectionInfo connection_info(url); @@ -73,16 +73,16 @@ OwnPtr<Messages::WebSocketServer::ConnectResponse> ClientConnection::handle(cons connection->start(); m_connections.set(id, move(connection)); - return make<Messages::WebSocketServer::ConnectResponse>(id); + return id; } -OwnPtr<Messages::WebSocketServer::ReadyStateResponse> ClientConnection::handle(const Messages::WebSocketServer::ReadyState& message) +Messages::WebSocketServer::ReadyStateResponse ClientConnection::handle(const Messages::WebSocketServer::ReadyState& message) { RefPtr<WebSocket> connection = m_connections.get(message.connection_id()).value_or({}); if (connection) { - return make<Messages::WebSocketServer::ReadyStateResponse>((u32)connection->ready_state()); + return (u32)connection->ready_state(); } - return make<Messages::WebSocketServer::ReadyStateResponse>((u32)ReadyState::Closed); + return (u32)ReadyState::Closed; } void ClientConnection::handle(const Messages::WebSocketServer::Send& message) @@ -101,7 +101,7 @@ void ClientConnection::handle(const Messages::WebSocketServer::Close& message) connection->close(message.code(), message.reason()); } -OwnPtr<Messages::WebSocketServer::SetCertificateResponse> ClientConnection::handle(const Messages::WebSocketServer::SetCertificate& message) +Messages::WebSocketServer::SetCertificateResponse ClientConnection::handle(const Messages::WebSocketServer::SetCertificate& message) { RefPtr<WebSocket> connection = m_connections.get(message.connection_id()).value_or({}); bool success = false; @@ -110,7 +110,7 @@ OwnPtr<Messages::WebSocketServer::SetCertificateResponse> ClientConnection::hand // connection->set_certificate(message.certificate(), message.key()); success = true; } - return make<Messages::WebSocketServer::SetCertificateResponse>(success); + return success; } void ClientConnection::did_connect(i32 connection_id) diff --git a/Userland/Services/WebSocket/ClientConnection.h b/Userland/Services/WebSocket/ClientConnection.h index 83f7ab5e9d..1c3232dfda 100644 --- a/Userland/Services/WebSocket/ClientConnection.h +++ b/Userland/Services/WebSocket/ClientConnection.h @@ -26,12 +26,12 @@ public: virtual void die() override; private: - virtual OwnPtr<Messages::WebSocketServer::GreetResponse> handle(const Messages::WebSocketServer::Greet&) override; - virtual OwnPtr<Messages::WebSocketServer::ConnectResponse> handle(const Messages::WebSocketServer::Connect&) override; - virtual OwnPtr<Messages::WebSocketServer::ReadyStateResponse> handle(const Messages::WebSocketServer::ReadyState&) override; + virtual Messages::WebSocketServer::GreetResponse handle(const Messages::WebSocketServer::Greet&) override; + virtual Messages::WebSocketServer::ConnectResponse handle(const Messages::WebSocketServer::Connect&) override; + virtual Messages::WebSocketServer::ReadyStateResponse handle(const Messages::WebSocketServer::ReadyState&) override; virtual void handle(const Messages::WebSocketServer::Send&) override; virtual void handle(const Messages::WebSocketServer::Close&) override; - virtual OwnPtr<Messages::WebSocketServer::SetCertificateResponse> handle(const Messages::WebSocketServer::SetCertificate&) override; + virtual Messages::WebSocketServer::SetCertificateResponse handle(const Messages::WebSocketServer::SetCertificate&) override; void did_connect(i32); void did_receive_message(i32, Message); diff --git a/Userland/Services/WindowServer/ClientConnection.cpp b/Userland/Services/WindowServer/ClientConnection.cpp index fdd530bd34..51cacb0479 100644 --- a/Userland/Services/WindowServer/ClientConnection.cpp +++ b/Userland/Services/WindowServer/ClientConnection.cpp @@ -81,57 +81,57 @@ void ClientConnection::notify_about_new_screen_rect(const Gfx::IntRect& rect) post_message(Messages::WindowClient::ScreenRectChanged(rect)); } -OwnPtr<Messages::WindowServer::CreateMenubarResponse> ClientConnection::handle(const Messages::WindowServer::CreateMenubar&) +Messages::WindowServer::CreateMenubarResponse ClientConnection::handle(const Messages::WindowServer::CreateMenubar&) { int menubar_id = m_next_menubar_id++; auto menubar = Menubar::create(*this, menubar_id); m_menubars.set(menubar_id, move(menubar)); - return make<Messages::WindowServer::CreateMenubarResponse>(menubar_id); + return menubar_id; } -OwnPtr<Messages::WindowServer::DestroyMenubarResponse> ClientConnection::handle(const Messages::WindowServer::DestroyMenubar& message) +Messages::WindowServer::DestroyMenubarResponse ClientConnection::handle(const Messages::WindowServer::DestroyMenubar& message) { int menubar_id = message.menubar_id(); auto it = m_menubars.find(menubar_id); if (it == m_menubars.end()) { did_misbehave("DestroyMenubar: Bad menubar ID"); - return {}; + return nullptr; } m_menubars.remove(it); - return make<Messages::WindowServer::DestroyMenubarResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::CreateMenuResponse> ClientConnection::handle(const Messages::WindowServer::CreateMenu& message) +Messages::WindowServer::CreateMenuResponse ClientConnection::handle(const Messages::WindowServer::CreateMenu& message) { int menu_id = m_next_menu_id++; auto menu = Menu::construct(this, menu_id, message.menu_title()); m_menus.set(menu_id, move(menu)); - return make<Messages::WindowServer::CreateMenuResponse>(menu_id); + return menu_id; } -OwnPtr<Messages::WindowServer::DestroyMenuResponse> ClientConnection::handle(const Messages::WindowServer::DestroyMenu& message) +Messages::WindowServer::DestroyMenuResponse ClientConnection::handle(const Messages::WindowServer::DestroyMenu& message) { int menu_id = message.menu_id(); auto it = m_menus.find(menu_id); if (it == m_menus.end()) { did_misbehave("DestroyMenu: Bad menu ID"); - return {}; + return nullptr; } auto& menu = *(*it).value; menu.close(); m_menus.remove(it); remove_child(menu); - return make<Messages::WindowServer::DestroyMenuResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::SetWindowMenubarResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowMenubar& message) +Messages::WindowServer::SetWindowMenubarResponse ClientConnection::handle(const Messages::WindowServer::SetWindowMenubar& message) { RefPtr<Window> window; { auto it = m_windows.find(message.window_id()); if (it == m_windows.end()) { did_misbehave("SetWindowMenubar: Bad window ID"); - return {}; + return nullptr; } window = it->value; } @@ -140,15 +140,15 @@ OwnPtr<Messages::WindowServer::SetWindowMenubarResponse> ClientConnection::handl auto it = m_menubars.find(message.menubar_id()); if (it == m_menubars.end()) { did_misbehave("SetWindowMenubar: Bad menubar ID"); - return {}; + return nullptr; } menubar = *(*it).value; } window->set_menubar(menubar); - return make<Messages::WindowServer::SetWindowMenubarResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::AddMenuToMenubarResponse> ClientConnection::handle(const Messages::WindowServer::AddMenuToMenubar& message) +Messages::WindowServer::AddMenuToMenubarResponse ClientConnection::handle(const Messages::WindowServer::AddMenuToMenubar& message) { int menubar_id = message.menubar_id(); int menu_id = message.menu_id(); @@ -156,26 +156,26 @@ OwnPtr<Messages::WindowServer::AddMenuToMenubarResponse> ClientConnection::handl auto jt = m_menus.find(menu_id); if (it == m_menubars.end()) { did_misbehave("AddMenuToMenubar: Bad menubar ID"); - return {}; + return nullptr; } if (jt == m_menus.end()) { did_misbehave("AddMenuToMenubar: Bad menu ID"); - return {}; + return nullptr; } auto& menubar = *(*it).value; auto& menu = *(*jt).value; menubar.add_menu(menu); - return make<Messages::WindowServer::AddMenuToMenubarResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::AddMenuItemResponse> ClientConnection::handle(const Messages::WindowServer::AddMenuItem& message) +Messages::WindowServer::AddMenuItemResponse ClientConnection::handle(const Messages::WindowServer::AddMenuItem& message) { int menu_id = message.menu_id(); unsigned identifier = message.identifier(); auto it = m_menus.find(menu_id); if (it == m_menus.end()) { dbgln("AddMenuItem: Bad menu ID: {}", menu_id); - return {}; + return nullptr; } auto& menu = *(*it).value; auto menu_item = make<MenuItem>(menu, identifier, message.text(), message.shortcut(), message.enabled(), message.checkable(), message.checked()); @@ -185,49 +185,49 @@ OwnPtr<Messages::WindowServer::AddMenuItemResponse> ClientConnection::handle(con menu_item->set_submenu_id(message.submenu_id()); menu_item->set_exclusive(message.exclusive()); menu.add_item(move(menu_item)); - return make<Messages::WindowServer::AddMenuItemResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::PopupMenuResponse> ClientConnection::handle(const Messages::WindowServer::PopupMenu& message) +Messages::WindowServer::PopupMenuResponse ClientConnection::handle(const Messages::WindowServer::PopupMenu& message) { int menu_id = message.menu_id(); auto position = message.screen_position(); auto it = m_menus.find(menu_id); if (it == m_menus.end()) { did_misbehave("PopupMenu: Bad menu ID"); - return {}; + return nullptr; } auto& menu = *(*it).value; menu.popup(position); - return make<Messages::WindowServer::PopupMenuResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::DismissMenuResponse> ClientConnection::handle(const Messages::WindowServer::DismissMenu& message) +Messages::WindowServer::DismissMenuResponse ClientConnection::handle(const Messages::WindowServer::DismissMenu& message) { int menu_id = message.menu_id(); auto it = m_menus.find(menu_id); if (it == m_menus.end()) { did_misbehave("DismissMenu: Bad menu ID"); - return {}; + return nullptr; } auto& menu = *(*it).value; menu.close(); - return make<Messages::WindowServer::DismissMenuResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::UpdateMenuItemResponse> ClientConnection::handle(const Messages::WindowServer::UpdateMenuItem& message) +Messages::WindowServer::UpdateMenuItemResponse ClientConnection::handle(const Messages::WindowServer::UpdateMenuItem& message) { int menu_id = message.menu_id(); auto it = m_menus.find(menu_id); if (it == m_menus.end()) { did_misbehave("UpdateMenuItem: Bad menu ID"); - return {}; + return nullptr; } auto& menu = *(*it).value; auto* menu_item = menu.item_with_identifier(message.identifier()); if (!menu_item) { did_misbehave("UpdateMenuItem: Bad menu item identifier"); - return {}; + return nullptr; } menu_item->set_text(message.text()); menu_item->set_shortcut_text(message.shortcut()); @@ -236,65 +236,65 @@ OwnPtr<Messages::WindowServer::UpdateMenuItemResponse> ClientConnection::handle( menu_item->set_default(message.is_default()); if (message.checkable()) menu_item->set_checked(message.checked()); - return make<Messages::WindowServer::UpdateMenuItemResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::AddMenuSeparatorResponse> ClientConnection::handle(const Messages::WindowServer::AddMenuSeparator& message) +Messages::WindowServer::AddMenuSeparatorResponse ClientConnection::handle(const Messages::WindowServer::AddMenuSeparator& message) { int menu_id = message.menu_id(); auto it = m_menus.find(menu_id); if (it == m_menus.end()) { did_misbehave("AddMenuSeparator: Bad menu ID"); - return {}; + return nullptr; } auto& menu = *(*it).value; menu.add_item(make<MenuItem>(menu, MenuItem::Separator)); - return make<Messages::WindowServer::AddMenuSeparatorResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::MoveWindowToFrontResponse> ClientConnection::handle(const Messages::WindowServer::MoveWindowToFront& message) +Messages::WindowServer::MoveWindowToFrontResponse ClientConnection::handle(const Messages::WindowServer::MoveWindowToFront& message) { auto it = m_windows.find(message.window_id()); if (it == m_windows.end()) { did_misbehave("MoveWindowToFront: Bad window ID"); - return {}; + return nullptr; } WindowManager::the().move_to_front_and_make_active(*(*it).value); - return make<Messages::WindowServer::MoveWindowToFrontResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::SetFullscreenResponse> ClientConnection::handle(const Messages::WindowServer::SetFullscreen& message) +Messages::WindowServer::SetFullscreenResponse ClientConnection::handle(const Messages::WindowServer::SetFullscreen& message) { auto it = m_windows.find(message.window_id()); if (it == m_windows.end()) { did_misbehave("SetFullscreen: Bad window ID"); - return {}; + return nullptr; } it->value->set_fullscreen(message.fullscreen()); - return make<Messages::WindowServer::SetFullscreenResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::SetFramelessResponse> ClientConnection::handle(const Messages::WindowServer::SetFrameless& message) +Messages::WindowServer::SetFramelessResponse ClientConnection::handle(const Messages::WindowServer::SetFrameless& message) { auto it = m_windows.find(message.window_id()); if (it == m_windows.end()) { did_misbehave("SetFrameless: Bad window ID"); - return {}; + return nullptr; } it->value->set_frameless(message.frameless()); WindowManager::the().tell_wms_window_state_changed(*it->value); - return make<Messages::WindowServer::SetFramelessResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::SetWindowOpacityResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowOpacity& message) +Messages::WindowServer::SetWindowOpacityResponse ClientConnection::handle(const Messages::WindowServer::SetWindowOpacity& message) { auto it = m_windows.find(message.window_id()); if (it == m_windows.end()) { did_misbehave("SetWindowOpacity: Bad window ID"); - return {}; + return nullptr; } it->value->set_opacity(message.opacity()); - return make<Messages::WindowServer::SetWindowOpacityResponse>(); + return {}; } void ClientConnection::handle(const Messages::WindowServer::AsyncSetWallpaper& message) @@ -304,65 +304,65 @@ void ClientConnection::handle(const Messages::WindowServer::AsyncSetWallpaper& m }); } -OwnPtr<Messages::WindowServer::SetBackgroundColorResponse> ClientConnection::handle(const Messages::WindowServer::SetBackgroundColor& message) +Messages::WindowServer::SetBackgroundColorResponse ClientConnection::handle(const Messages::WindowServer::SetBackgroundColor& message) { Compositor::the().set_background_color(message.background_color()); - return make<Messages::WindowServer::SetBackgroundColorResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::SetWallpaperModeResponse> ClientConnection::handle(const Messages::WindowServer::SetWallpaperMode& message) +Messages::WindowServer::SetWallpaperModeResponse ClientConnection::handle(const Messages::WindowServer::SetWallpaperMode& message) { Compositor::the().set_wallpaper_mode(message.mode()); - return make<Messages::WindowServer::SetWallpaperModeResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::GetWallpaperResponse> ClientConnection::handle(const Messages::WindowServer::GetWallpaper&) +Messages::WindowServer::GetWallpaperResponse ClientConnection::handle(const Messages::WindowServer::GetWallpaper&) { - return make<Messages::WindowServer::GetWallpaperResponse>(Compositor::the().wallpaper_path()); + return Compositor::the().wallpaper_path(); } -OwnPtr<Messages::WindowServer::SetResolutionResponse> ClientConnection::handle(const Messages::WindowServer::SetResolution& message) +Messages::WindowServer::SetResolutionResponse ClientConnection::handle(const Messages::WindowServer::SetResolution& message) { - return make<Messages::WindowServer::SetResolutionResponse>(WindowManager::the().set_resolution(message.resolution().width(), message.resolution().height(), message.scale_factor()), WindowManager::the().resolution(), WindowManager::the().scale_factor()); + return { WindowManager::the().set_resolution(message.resolution().width(), message.resolution().height(), message.scale_factor()), WindowManager::the().resolution(), WindowManager::the().scale_factor() }; } -OwnPtr<Messages::WindowServer::SetWindowTitleResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowTitle& message) +Messages::WindowServer::SetWindowTitleResponse ClientConnection::handle(const Messages::WindowServer::SetWindowTitle& message) { auto it = m_windows.find(message.window_id()); if (it == m_windows.end()) { did_misbehave("SetWindowTitle: Bad window ID"); - return {}; + return nullptr; } it->value->set_title(message.title()); - return make<Messages::WindowServer::SetWindowTitleResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::GetWindowTitleResponse> ClientConnection::handle(const Messages::WindowServer::GetWindowTitle& message) +Messages::WindowServer::GetWindowTitleResponse ClientConnection::handle(const Messages::WindowServer::GetWindowTitle& message) { auto it = m_windows.find(message.window_id()); if (it == m_windows.end()) { did_misbehave("GetWindowTitle: Bad window ID"); - return {}; + return nullptr; } - return make<Messages::WindowServer::GetWindowTitleResponse>(it->value->title()); + return it->value->title(); } -OwnPtr<Messages::WindowServer::IsMaximizedResponse> ClientConnection::handle(const Messages::WindowServer::IsMaximized& message) +Messages::WindowServer::IsMaximizedResponse ClientConnection::handle(const Messages::WindowServer::IsMaximized& message) { auto it = m_windows.find(message.window_id()); if (it == m_windows.end()) { did_misbehave("IsMaximized: Bad window ID"); - return {}; + return nullptr; } - return make<Messages::WindowServer::IsMaximizedResponse>(it->value->is_maximized()); + return it->value->is_maximized(); } -OwnPtr<Messages::WindowServer::SetWindowIconBitmapResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowIconBitmap& message) +Messages::WindowServer::SetWindowIconBitmapResponse ClientConnection::handle(const Messages::WindowServer::SetWindowIconBitmap& message) { auto it = m_windows.find(message.window_id()); if (it == m_windows.end()) { did_misbehave("SetWindowIconBitmap: Bad window ID"); - return {}; + return nullptr; } auto& window = *(*it).value; @@ -374,21 +374,21 @@ OwnPtr<Messages::WindowServer::SetWindowIconBitmapResponse> ClientConnection::ha window.frame().invalidate_titlebar(); WindowManager::the().tell_wms_window_icon_changed(window); - return make<Messages::WindowServer::SetWindowIconBitmapResponse>(); + return nullptr; } -OwnPtr<Messages::WindowServer::SetWindowRectResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowRect& message) +Messages::WindowServer::SetWindowRectResponse ClientConnection::handle(const Messages::WindowServer::SetWindowRect& message) { int window_id = message.window_id(); auto it = m_windows.find(window_id); if (it == m_windows.end()) { did_misbehave("SetWindowRect: Bad window ID"); - return {}; + return nullptr; } auto& window = *(*it).value; if (window.is_fullscreen()) { dbgln("ClientConnection: Ignoring SetWindowRect request for fullscreen window"); - return {}; + return nullptr; } if (message.rect().location() != window.rect().location()) { @@ -399,32 +399,32 @@ OwnPtr<Messages::WindowServer::SetWindowRectResponse> ClientConnection::handle(c window.set_rect(rect); window.nudge_into_desktop(); window.request_update(window.rect()); - return make<Messages::WindowServer::SetWindowRectResponse>(window.rect()); + return window.rect(); } -OwnPtr<Messages::WindowServer::GetWindowRectResponse> ClientConnection::handle(const Messages::WindowServer::GetWindowRect& message) +Messages::WindowServer::GetWindowRectResponse ClientConnection::handle(const Messages::WindowServer::GetWindowRect& message) { int window_id = message.window_id(); auto it = m_windows.find(window_id); if (it == m_windows.end()) { did_misbehave("GetWindowRect: Bad window ID"); - return {}; + return nullptr; } - return make<Messages::WindowServer::GetWindowRectResponse>(it->value->rect()); + return it->value->rect(); } -OwnPtr<Messages::WindowServer::SetWindowMinimumSizeResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowMinimumSize& message) +Messages::WindowServer::SetWindowMinimumSizeResponse ClientConnection::handle(const Messages::WindowServer::SetWindowMinimumSize& message) { int window_id = message.window_id(); auto it = m_windows.find(window_id); if (it == m_windows.end()) { did_misbehave("SetWindowMinimumSize: Bad window ID"); - return {}; + return nullptr; } auto& window = *(*it).value; if (window.is_fullscreen()) { dbgln("ClientConnection: Ignoring SetWindowMinimumSize request for fullscreen window"); - return {}; + return nullptr; } window.set_minimum_size(message.size()); @@ -441,34 +441,34 @@ OwnPtr<Messages::WindowServer::SetWindowMinimumSizeResponse> ClientConnection::h window.refresh_client_size(); } - return make<Messages::WindowServer::SetWindowMinimumSizeResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::GetWindowMinimumSizeResponse> ClientConnection::handle(const Messages::WindowServer::GetWindowMinimumSize& message) +Messages::WindowServer::GetWindowMinimumSizeResponse ClientConnection::handle(const Messages::WindowServer::GetWindowMinimumSize& message) { int window_id = message.window_id(); auto it = m_windows.find(window_id); if (it == m_windows.end()) { did_misbehave("GetWindowMinimumSize: Bad window ID"); - return {}; + return nullptr; } - return make<Messages::WindowServer::GetWindowMinimumSizeResponse>(it->value->minimum_size()); + return it->value->minimum_size(); } -OwnPtr<Messages::WindowServer::GetAppletRectOnScreenResponse> ClientConnection::handle(const Messages::WindowServer::GetAppletRectOnScreen& message) +Messages::WindowServer::GetAppletRectOnScreenResponse ClientConnection::handle(const Messages::WindowServer::GetAppletRectOnScreen& message) { int window_id = message.window_id(); auto it = m_windows.find(window_id); if (it == m_windows.end()) { did_misbehave("GetAppletRectOnScreen: Bad window ID"); - return {}; + return nullptr; } Gfx::IntRect applet_area_rect; if (auto* applet_area_window = AppletManager::the().window()) applet_area_rect = applet_area_window->rect(); - return make<Messages::WindowServer::GetAppletRectOnScreenResponse>(it->value->rect_in_applet_area().translated(applet_area_rect.location())); + return it->value->rect_in_applet_area().translated(applet_area_rect.location()); } Window* ClientConnection::window_from_id(i32 window_id) @@ -479,14 +479,14 @@ Window* ClientConnection::window_from_id(i32 window_id) return it->value.ptr(); } -OwnPtr<Messages::WindowServer::CreateWindowResponse> ClientConnection::handle(const Messages::WindowServer::CreateWindow& message) +Messages::WindowServer::CreateWindowResponse ClientConnection::handle(const Messages::WindowServer::CreateWindow& message) { Window* parent_window = nullptr; if (message.parent_window_id()) { parent_window = window_from_id(message.parent_window_id()); if (!parent_window) { did_misbehave("CreateWindow with bad parent_window_id"); - return {}; + return nullptr; } } @@ -522,7 +522,7 @@ OwnPtr<Messages::WindowServer::CreateWindowResponse> ClientConnection::handle(co if (window->type() == WindowType::Applet) AppletManager::the().add_applet(*window); m_windows.set(window_id, move(window)); - return make<Messages::WindowServer::CreateWindowResponse>(window_id); + return window_id; } void ClientConnection::destroy_window(Window& window, Vector<i32>& destroyed_window_ids) @@ -551,17 +551,17 @@ void ClientConnection::destroy_window(Window& window, Vector<i32>& destroyed_win m_windows.remove(window.window_id()); } -OwnPtr<Messages::WindowServer::DestroyWindowResponse> ClientConnection::handle(const Messages::WindowServer::DestroyWindow& message) +Messages::WindowServer::DestroyWindowResponse ClientConnection::handle(const Messages::WindowServer::DestroyWindow& message) { auto it = m_windows.find(message.window_id()); if (it == m_windows.end()) { did_misbehave("DestroyWindow: Bad window ID"); - return {}; + return nullptr; } auto& window = *(*it).value; Vector<i32> destroyed_window_ids; destroy_window(window, destroyed_window_ids); - return make<Messages::WindowServer::DestroyWindowResponse>(destroyed_window_ids); + return destroyed_window_ids; } void ClientConnection::post_paint_message(Window& window, bool ignore_occlusion) @@ -602,13 +602,13 @@ void ClientConnection::handle(const Messages::WindowServer::DidFinishPainting& m WindowSwitcher::the().refresh_if_needed(); } -OwnPtr<Messages::WindowServer::SetWindowBackingStoreResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowBackingStore& message) +Messages::WindowServer::SetWindowBackingStoreResponse ClientConnection::handle(const Messages::WindowServer::SetWindowBackingStore& message) { int window_id = message.window_id(); auto it = m_windows.find(window_id); if (it == m_windows.end()) { did_misbehave("SetWindowBackingStore: Bad window ID"); - return {}; + return nullptr; } auto& window = *(*it).value; if (window.last_backing_store() && window.last_backing_store_serial() == message.serial()) { @@ -628,78 +628,78 @@ OwnPtr<Messages::WindowServer::SetWindowBackingStoreResponse> ClientConnection:: if (message.flush_immediately()) window.invalidate(false); - return make<Messages::WindowServer::SetWindowBackingStoreResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::SetGlobalCursorTrackingResponse> ClientConnection::handle(const Messages::WindowServer::SetGlobalCursorTracking& message) +Messages::WindowServer::SetGlobalCursorTrackingResponse ClientConnection::handle(const Messages::WindowServer::SetGlobalCursorTracking& message) { int window_id = message.window_id(); auto it = m_windows.find(window_id); if (it == m_windows.end()) { did_misbehave("SetGlobalCursorTracking: Bad window ID"); - return {}; + return nullptr; } it->value->set_global_cursor_tracking_enabled(message.enabled()); - return make<Messages::WindowServer::SetGlobalCursorTrackingResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::SetWindowCursorResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowCursor& message) +Messages::WindowServer::SetWindowCursorResponse ClientConnection::handle(const Messages::WindowServer::SetWindowCursor& message) { auto it = m_windows.find(message.window_id()); if (it == m_windows.end()) { did_misbehave("SetWindowCursor: Bad window ID"); - return {}; + return nullptr; } auto& window = *(*it).value; if (message.cursor_type() < 0 || message.cursor_type() >= (i32)Gfx::StandardCursor::__Count) { did_misbehave("SetWindowCursor: Bad cursor type"); - return {}; + return nullptr; } window.set_cursor(Cursor::create((Gfx::StandardCursor)message.cursor_type())); if (&window == WindowManager::the().hovered_window()) Compositor::the().invalidate_cursor(); - return make<Messages::WindowServer::SetWindowCursorResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::SetWindowCustomCursorResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowCustomCursor& message) +Messages::WindowServer::SetWindowCustomCursorResponse ClientConnection::handle(const Messages::WindowServer::SetWindowCustomCursor& message) { auto it = m_windows.find(message.window_id()); if (it == m_windows.end()) { did_misbehave("SetWindowCustomCursor: Bad window ID"); - return {}; + return nullptr; } auto& window = *(*it).value; if (!message.cursor().is_valid()) { did_misbehave("SetWindowCustomCursor: Bad cursor"); - return {}; + return nullptr; } window.set_cursor(Cursor::create(*message.cursor().bitmap())); Compositor::the().invalidate_cursor(); - return make<Messages::WindowServer::SetWindowCustomCursorResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::SetWindowHasAlphaChannelResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowHasAlphaChannel& message) +Messages::WindowServer::SetWindowHasAlphaChannelResponse ClientConnection::handle(const Messages::WindowServer::SetWindowHasAlphaChannel& message) { auto it = m_windows.find(message.window_id()); if (it == m_windows.end()) { did_misbehave("SetWindowHasAlphaChannel: Bad window ID"); - return {}; + return nullptr; } it->value->set_has_alpha_channel(message.has_alpha_channel()); - return make<Messages::WindowServer::SetWindowHasAlphaChannelResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::SetWindowAlphaHitThresholdResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowAlphaHitThreshold& message) +Messages::WindowServer::SetWindowAlphaHitThresholdResponse ClientConnection::handle(const Messages::WindowServer::SetWindowAlphaHitThreshold& message) { auto it = m_windows.find(message.window_id()); if (it == m_windows.end()) { did_misbehave("SetWindowAlphaHitThreshold: Bad window ID"); - return {}; + return nullptr; } it->value->set_alpha_hit_threshold(message.threshold()); - return make<Messages::WindowServer::SetWindowAlphaHitThresholdResponse>(); + return {}; } void ClientConnection::handle(const Messages::WindowServer::StartWindowResize& request) @@ -715,61 +715,61 @@ void ClientConnection::handle(const Messages::WindowServer::StartWindowResize& r WindowManager::the().start_window_resize(window, Screen::the().cursor_location(), MouseButton::Left); } -OwnPtr<Messages::WindowServer::GreetResponse> ClientConnection::handle(const Messages::WindowServer::Greet&) +Messages::WindowServer::GreetResponse ClientConnection::handle(const Messages::WindowServer::Greet&) { - return make<Messages::WindowServer::GreetResponse>(Screen::the().rect(), Gfx::current_system_theme_buffer()); + return { Screen::the().rect(), Gfx::current_system_theme_buffer() }; } -OwnPtr<Messages::WindowServer::StartDragResponse> ClientConnection::handle(const Messages::WindowServer::StartDrag& message) +Messages::WindowServer::StartDragResponse ClientConnection::handle(const Messages::WindowServer::StartDrag& message) { auto& wm = WindowManager::the(); if (wm.dnd_client()) - return make<Messages::WindowServer::StartDragResponse>(false); + return false; wm.start_dnd_drag(*this, message.text(), message.drag_bitmap().bitmap(), Core::MimeData::construct(message.mime_data())); - return make<Messages::WindowServer::StartDragResponse>(true); + return true; } -OwnPtr<Messages::WindowServer::SetSystemThemeResponse> ClientConnection::handle(const Messages::WindowServer::SetSystemTheme& message) +Messages::WindowServer::SetSystemThemeResponse ClientConnection::handle(const Messages::WindowServer::SetSystemTheme& message) { bool success = WindowManager::the().update_theme(message.theme_path(), message.theme_name()); - return make<Messages::WindowServer::SetSystemThemeResponse>(success); + return success; } -OwnPtr<Messages::WindowServer::GetSystemThemeResponse> ClientConnection::handle(const Messages::WindowServer::GetSystemTheme&) +Messages::WindowServer::GetSystemThemeResponse ClientConnection::handle(const Messages::WindowServer::GetSystemTheme&) { auto wm_config = Core::ConfigFile::open("/etc/WindowServer.ini"); auto name = wm_config->read_entry("Theme", "Name"); - return make<Messages::WindowServer::GetSystemThemeResponse>(name); + return name; } -OwnPtr<Messages::WindowServer::SetWindowBaseSizeAndSizeIncrementResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowBaseSizeAndSizeIncrement& message) +Messages::WindowServer::SetWindowBaseSizeAndSizeIncrementResponse ClientConnection::handle(const Messages::WindowServer::SetWindowBaseSizeAndSizeIncrement& message) { auto it = m_windows.find(message.window_id()); if (it == m_windows.end()) { did_misbehave("SetWindowBaseSizeAndSizeIncrementResponse: Bad window ID"); - return {}; + return nullptr; } auto& window = *it->value; window.set_base_size(message.base_size()); window.set_size_increment(message.size_increment()); - return make<Messages::WindowServer::SetWindowBaseSizeAndSizeIncrementResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::SetWindowResizeAspectRatioResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowResizeAspectRatio& message) +Messages::WindowServer::SetWindowResizeAspectRatioResponse ClientConnection::handle(const Messages::WindowServer::SetWindowResizeAspectRatio& message) { auto it = m_windows.find(message.window_id()); if (it == m_windows.end()) { did_misbehave("SetWindowResizeAspectRatioResponse: Bad window ID"); - return {}; + return nullptr; } auto& window = *it->value; window.set_resize_aspect_ratio(message.resize_aspect_ratio()); - return make<Messages::WindowServer::SetWindowResizeAspectRatioResponse>(); + return {}; } void ClientConnection::handle(const Messages::WindowServer::EnableDisplayLink&) @@ -818,52 +818,52 @@ void ClientConnection::handle(const Messages::WindowServer::Pong&) set_unresponsive(false); } -OwnPtr<Messages::WindowServer::GetGlobalCursorPositionResponse> ClientConnection::handle(const Messages::WindowServer::GetGlobalCursorPosition&) +Messages::WindowServer::GetGlobalCursorPositionResponse ClientConnection::handle(const Messages::WindowServer::GetGlobalCursorPosition&) { - return make<Messages::WindowServer::GetGlobalCursorPositionResponse>(Screen::the().cursor_location()); + return Screen::the().cursor_location(); } -OwnPtr<Messages::WindowServer::SetMouseAccelerationResponse> ClientConnection::handle(const Messages::WindowServer::SetMouseAcceleration& message) +Messages::WindowServer::SetMouseAccelerationResponse ClientConnection::handle(const Messages::WindowServer::SetMouseAcceleration& message) { double factor = message.factor(); if (factor < mouse_accel_min || factor > mouse_accel_max) { did_misbehave("SetMouseAcceleration with bad acceleration factor"); - return {}; + return nullptr; } WindowManager::the().set_acceleration_factor(factor); - return make<Messages::WindowServer::SetMouseAccelerationResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::GetMouseAccelerationResponse> ClientConnection::handle(const Messages::WindowServer::GetMouseAcceleration&) +Messages::WindowServer::GetMouseAccelerationResponse ClientConnection::handle(const Messages::WindowServer::GetMouseAcceleration&) { - return make<Messages::WindowServer::GetMouseAccelerationResponse>(Screen::the().acceleration_factor()); + return Screen::the().acceleration_factor(); } -OwnPtr<Messages::WindowServer::SetScrollStepSizeResponse> ClientConnection::handle(const Messages::WindowServer::SetScrollStepSize& message) +Messages::WindowServer::SetScrollStepSizeResponse ClientConnection::handle(const Messages::WindowServer::SetScrollStepSize& message) { if (message.step_size() < scroll_step_size_min) { did_misbehave("SetScrollStepSize with bad scroll step size"); - return {}; + return nullptr; } WindowManager::the().set_scroll_step_size(message.step_size()); - return make<Messages::WindowServer::SetScrollStepSizeResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::GetScrollStepSizeResponse> ClientConnection::handle(const Messages::WindowServer::GetScrollStepSize&) +Messages::WindowServer::GetScrollStepSizeResponse ClientConnection::handle(const Messages::WindowServer::GetScrollStepSize&) { - return make<Messages::WindowServer::GetScrollStepSizeResponse>(Screen::the().scroll_step_size()); + return Screen::the().scroll_step_size(); } -OwnPtr<Messages::WindowServer::SetDoubleClickSpeedResponse> ClientConnection::handle(const Messages::WindowServer::SetDoubleClickSpeed& message) +Messages::WindowServer::SetDoubleClickSpeedResponse ClientConnection::handle(const Messages::WindowServer::SetDoubleClickSpeed& message) { if (message.speed() < double_click_speed_min || message.speed() > double_click_speed_max) { did_misbehave("SetDoubleClickSpeed with bad speed"); - return {}; + return nullptr; } WindowManager::the().set_double_click_speed(message.speed()); - return make<Messages::WindowServer::SetDoubleClickSpeedResponse>(); + return {}; } -OwnPtr<Messages::WindowServer::GetDoubleClickSpeedResponse> ClientConnection::handle(const Messages::WindowServer::GetDoubleClickSpeed&) +Messages::WindowServer::GetDoubleClickSpeedResponse ClientConnection::handle(const Messages::WindowServer::GetDoubleClickSpeed&) { - return make<Messages::WindowServer::GetDoubleClickSpeedResponse>(WindowManager::the().double_click_speed()); + return WindowManager::the().double_click_speed(); } void ClientConnection::set_unresponsive(bool unresponsive) @@ -897,21 +897,21 @@ void ClientConnection::did_become_responsive() set_unresponsive(false); } -OwnPtr<Messages::WindowServer::GetScreenBitmapResponse> ClientConnection::handle(const Messages::WindowServer::GetScreenBitmap&) +Messages::WindowServer::GetScreenBitmapResponse ClientConnection::handle(const Messages::WindowServer::GetScreenBitmap&) { auto& bitmap = Compositor::the().front_bitmap_for_screenshot({}); - return make<Messages::WindowServer::GetScreenBitmapResponse>(bitmap.to_shareable_bitmap()); + return bitmap.to_shareable_bitmap(); } -OwnPtr<Messages::WindowServer::IsWindowModifiedResponse> ClientConnection::handle(Messages::WindowServer::IsWindowModified const& message) +Messages::WindowServer::IsWindowModifiedResponse ClientConnection::handle(Messages::WindowServer::IsWindowModified const& message) { auto it = m_windows.find(message.window_id()); if (it == m_windows.end()) { did_misbehave("IsWindowModified: Bad window ID"); - return {}; + return nullptr; } auto& window = *it->value; - return make<Messages::WindowServer::IsWindowModifiedResponse>(window.is_modified()); + return window.is_modified(); } void ClientConnection::handle(Messages::WindowServer::SetWindowModified const& message) diff --git a/Userland/Services/WindowServer/ClientConnection.h b/Userland/Services/WindowServer/ClientConnection.h index b4f17cb431..a7cead5532 100644 --- a/Userland/Services/WindowServer/ClientConnection.h +++ b/Userland/Services/WindowServer/ClientConnection.h @@ -87,67 +87,67 @@ private: void set_unresponsive(bool); void destroy_window(Window&, Vector<i32>& destroyed_window_ids); - virtual OwnPtr<Messages::WindowServer::GreetResponse> handle(const Messages::WindowServer::Greet&) override; - virtual OwnPtr<Messages::WindowServer::CreateMenubarResponse> handle(const Messages::WindowServer::CreateMenubar&) override; - virtual OwnPtr<Messages::WindowServer::DestroyMenubarResponse> handle(const Messages::WindowServer::DestroyMenubar&) override; - virtual OwnPtr<Messages::WindowServer::CreateMenuResponse> handle(const Messages::WindowServer::CreateMenu&) override; - virtual OwnPtr<Messages::WindowServer::DestroyMenuResponse> handle(const Messages::WindowServer::DestroyMenu&) override; - virtual OwnPtr<Messages::WindowServer::AddMenuToMenubarResponse> handle(const Messages::WindowServer::AddMenuToMenubar&) override; - virtual OwnPtr<Messages::WindowServer::SetWindowMenubarResponse> handle(const Messages::WindowServer::SetWindowMenubar&) override; - virtual OwnPtr<Messages::WindowServer::AddMenuItemResponse> handle(const Messages::WindowServer::AddMenuItem&) override; - virtual OwnPtr<Messages::WindowServer::AddMenuSeparatorResponse> handle(const Messages::WindowServer::AddMenuSeparator&) override; - virtual OwnPtr<Messages::WindowServer::UpdateMenuItemResponse> handle(const Messages::WindowServer::UpdateMenuItem&) override; - virtual OwnPtr<Messages::WindowServer::CreateWindowResponse> handle(const Messages::WindowServer::CreateWindow&) override; - virtual OwnPtr<Messages::WindowServer::DestroyWindowResponse> handle(const Messages::WindowServer::DestroyWindow&) override; - virtual OwnPtr<Messages::WindowServer::SetWindowTitleResponse> handle(const Messages::WindowServer::SetWindowTitle&) override; - virtual OwnPtr<Messages::WindowServer::GetWindowTitleResponse> handle(const Messages::WindowServer::GetWindowTitle&) override; - virtual OwnPtr<Messages::WindowServer::IsMaximizedResponse> handle(const Messages::WindowServer::IsMaximized&) override; + virtual Messages::WindowServer::GreetResponse handle(const Messages::WindowServer::Greet&) override; + virtual Messages::WindowServer::CreateMenubarResponse handle(const Messages::WindowServer::CreateMenubar&) override; + virtual Messages::WindowServer::DestroyMenubarResponse handle(const Messages::WindowServer::DestroyMenubar&) override; + virtual Messages::WindowServer::CreateMenuResponse handle(const Messages::WindowServer::CreateMenu&) override; + virtual Messages::WindowServer::DestroyMenuResponse handle(const Messages::WindowServer::DestroyMenu&) override; + virtual Messages::WindowServer::AddMenuToMenubarResponse handle(const Messages::WindowServer::AddMenuToMenubar&) override; + virtual Messages::WindowServer::SetWindowMenubarResponse handle(const Messages::WindowServer::SetWindowMenubar&) override; + virtual Messages::WindowServer::AddMenuItemResponse handle(const Messages::WindowServer::AddMenuItem&) override; + virtual Messages::WindowServer::AddMenuSeparatorResponse handle(const Messages::WindowServer::AddMenuSeparator&) override; + virtual Messages::WindowServer::UpdateMenuItemResponse handle(const Messages::WindowServer::UpdateMenuItem&) override; + virtual Messages::WindowServer::CreateWindowResponse handle(const Messages::WindowServer::CreateWindow&) override; + virtual Messages::WindowServer::DestroyWindowResponse handle(const Messages::WindowServer::DestroyWindow&) override; + virtual Messages::WindowServer::SetWindowTitleResponse handle(const Messages::WindowServer::SetWindowTitle&) override; + virtual Messages::WindowServer::GetWindowTitleResponse handle(const Messages::WindowServer::GetWindowTitle&) override; + virtual Messages::WindowServer::IsMaximizedResponse handle(const Messages::WindowServer::IsMaximized&) override; virtual void handle(const Messages::WindowServer::StartWindowResize&) override; - virtual OwnPtr<Messages::WindowServer::SetWindowRectResponse> handle(const Messages::WindowServer::SetWindowRect&) override; - virtual OwnPtr<Messages::WindowServer::GetWindowRectResponse> handle(const Messages::WindowServer::GetWindowRect&) override; - virtual OwnPtr<Messages::WindowServer::SetWindowMinimumSizeResponse> handle(const Messages::WindowServer::SetWindowMinimumSize&) override; - virtual OwnPtr<Messages::WindowServer::GetWindowMinimumSizeResponse> handle(const Messages::WindowServer::GetWindowMinimumSize&) override; - virtual OwnPtr<Messages::WindowServer::GetAppletRectOnScreenResponse> handle(const Messages::WindowServer::GetAppletRectOnScreen&) override; + virtual Messages::WindowServer::SetWindowRectResponse handle(const Messages::WindowServer::SetWindowRect&) override; + virtual Messages::WindowServer::GetWindowRectResponse handle(const Messages::WindowServer::GetWindowRect&) override; + virtual Messages::WindowServer::SetWindowMinimumSizeResponse handle(const Messages::WindowServer::SetWindowMinimumSize&) override; + virtual Messages::WindowServer::GetWindowMinimumSizeResponse handle(const Messages::WindowServer::GetWindowMinimumSize&) override; + virtual Messages::WindowServer::GetAppletRectOnScreenResponse handle(const Messages::WindowServer::GetAppletRectOnScreen&) override; virtual void handle(const Messages::WindowServer::InvalidateRect&) override; virtual void handle(const Messages::WindowServer::DidFinishPainting&) override; - virtual OwnPtr<Messages::WindowServer::SetGlobalCursorTrackingResponse> handle(const Messages::WindowServer::SetGlobalCursorTracking&) override; - virtual OwnPtr<Messages::WindowServer::SetWindowOpacityResponse> handle(const Messages::WindowServer::SetWindowOpacity&) override; - virtual OwnPtr<Messages::WindowServer::SetWindowBackingStoreResponse> handle(const Messages::WindowServer::SetWindowBackingStore&) override; - virtual OwnPtr<Messages::WindowServer::SetWindowHasAlphaChannelResponse> handle(const Messages::WindowServer::SetWindowHasAlphaChannel&) override; - virtual OwnPtr<Messages::WindowServer::SetWindowAlphaHitThresholdResponse> handle(const Messages::WindowServer::SetWindowAlphaHitThreshold&) override; - virtual OwnPtr<Messages::WindowServer::MoveWindowToFrontResponse> handle(const Messages::WindowServer::MoveWindowToFront&) override; - virtual OwnPtr<Messages::WindowServer::SetFullscreenResponse> handle(const Messages::WindowServer::SetFullscreen&) override; - virtual OwnPtr<Messages::WindowServer::SetFramelessResponse> handle(const Messages::WindowServer::SetFrameless&) override; + virtual Messages::WindowServer::SetGlobalCursorTrackingResponse handle(const Messages::WindowServer::SetGlobalCursorTracking&) override; + virtual Messages::WindowServer::SetWindowOpacityResponse handle(const Messages::WindowServer::SetWindowOpacity&) override; + virtual Messages::WindowServer::SetWindowBackingStoreResponse handle(const Messages::WindowServer::SetWindowBackingStore&) override; + virtual Messages::WindowServer::SetWindowHasAlphaChannelResponse handle(const Messages::WindowServer::SetWindowHasAlphaChannel&) override; + virtual Messages::WindowServer::SetWindowAlphaHitThresholdResponse handle(const Messages::WindowServer::SetWindowAlphaHitThreshold&) override; + virtual Messages::WindowServer::MoveWindowToFrontResponse handle(const Messages::WindowServer::MoveWindowToFront&) override; + virtual Messages::WindowServer::SetFullscreenResponse handle(const Messages::WindowServer::SetFullscreen&) override; + virtual Messages::WindowServer::SetFramelessResponse handle(const Messages::WindowServer::SetFrameless&) override; virtual void handle(const Messages::WindowServer::AsyncSetWallpaper&) override; - virtual OwnPtr<Messages::WindowServer::SetBackgroundColorResponse> handle(const Messages::WindowServer::SetBackgroundColor&) override; - virtual OwnPtr<Messages::WindowServer::SetWallpaperModeResponse> handle(const Messages::WindowServer::SetWallpaperMode&) override; - virtual OwnPtr<Messages::WindowServer::GetWallpaperResponse> handle(const Messages::WindowServer::GetWallpaper&) override; - virtual OwnPtr<Messages::WindowServer::SetResolutionResponse> handle(const Messages::WindowServer::SetResolution&) override; - virtual OwnPtr<Messages::WindowServer::SetWindowCursorResponse> handle(const Messages::WindowServer::SetWindowCursor&) override; - virtual OwnPtr<Messages::WindowServer::SetWindowCustomCursorResponse> handle(const Messages::WindowServer::SetWindowCustomCursor&) override; - virtual OwnPtr<Messages::WindowServer::PopupMenuResponse> handle(const Messages::WindowServer::PopupMenu&) override; - virtual OwnPtr<Messages::WindowServer::DismissMenuResponse> handle(const Messages::WindowServer::DismissMenu&) override; - virtual OwnPtr<Messages::WindowServer::SetWindowIconBitmapResponse> handle(const Messages::WindowServer::SetWindowIconBitmap&) override; - virtual OwnPtr<Messages::WindowServer::StartDragResponse> handle(const Messages::WindowServer::StartDrag&) override; - virtual OwnPtr<Messages::WindowServer::SetSystemThemeResponse> handle(const Messages::WindowServer::SetSystemTheme&) override; - virtual OwnPtr<Messages::WindowServer::GetSystemThemeResponse> handle(const Messages::WindowServer::GetSystemTheme&) override; - virtual OwnPtr<Messages::WindowServer::SetWindowBaseSizeAndSizeIncrementResponse> handle(const Messages::WindowServer::SetWindowBaseSizeAndSizeIncrement&) override; - virtual OwnPtr<Messages::WindowServer::SetWindowResizeAspectRatioResponse> handle(const Messages::WindowServer::SetWindowResizeAspectRatio&) override; + virtual Messages::WindowServer::SetBackgroundColorResponse handle(const Messages::WindowServer::SetBackgroundColor&) override; + virtual Messages::WindowServer::SetWallpaperModeResponse handle(const Messages::WindowServer::SetWallpaperMode&) override; + virtual Messages::WindowServer::GetWallpaperResponse handle(const Messages::WindowServer::GetWallpaper&) override; + virtual Messages::WindowServer::SetResolutionResponse handle(const Messages::WindowServer::SetResolution&) override; + virtual Messages::WindowServer::SetWindowCursorResponse handle(const Messages::WindowServer::SetWindowCursor&) override; + virtual Messages::WindowServer::SetWindowCustomCursorResponse handle(const Messages::WindowServer::SetWindowCustomCursor&) override; + virtual Messages::WindowServer::PopupMenuResponse handle(const Messages::WindowServer::PopupMenu&) override; + virtual Messages::WindowServer::DismissMenuResponse handle(const Messages::WindowServer::DismissMenu&) override; + virtual Messages::WindowServer::SetWindowIconBitmapResponse handle(const Messages::WindowServer::SetWindowIconBitmap&) override; + virtual Messages::WindowServer::StartDragResponse handle(const Messages::WindowServer::StartDrag&) override; + virtual Messages::WindowServer::SetSystemThemeResponse handle(const Messages::WindowServer::SetSystemTheme&) override; + virtual Messages::WindowServer::GetSystemThemeResponse handle(const Messages::WindowServer::GetSystemTheme&) override; + virtual Messages::WindowServer::SetWindowBaseSizeAndSizeIncrementResponse handle(const Messages::WindowServer::SetWindowBaseSizeAndSizeIncrement&) override; + virtual Messages::WindowServer::SetWindowResizeAspectRatioResponse handle(const Messages::WindowServer::SetWindowResizeAspectRatio&) override; virtual void handle(const Messages::WindowServer::EnableDisplayLink&) override; virtual void handle(const Messages::WindowServer::DisableDisplayLink&) override; virtual void handle(const Messages::WindowServer::SetWindowProgress&) override; virtual void handle(const Messages::WindowServer::RefreshSystemTheme&) override; virtual void handle(const Messages::WindowServer::Pong&) override; - virtual OwnPtr<Messages::WindowServer::GetGlobalCursorPositionResponse> handle(const Messages::WindowServer::GetGlobalCursorPosition&) override; - virtual OwnPtr<Messages::WindowServer::SetMouseAccelerationResponse> handle(const Messages::WindowServer::SetMouseAcceleration&) override; - virtual OwnPtr<Messages::WindowServer::GetMouseAccelerationResponse> handle(const Messages::WindowServer::GetMouseAcceleration&) override; - virtual OwnPtr<Messages::WindowServer::SetScrollStepSizeResponse> handle(const Messages::WindowServer::SetScrollStepSize&) override; - virtual OwnPtr<Messages::WindowServer::GetScrollStepSizeResponse> handle(const Messages::WindowServer::GetScrollStepSize&) override; - virtual OwnPtr<Messages::WindowServer::GetScreenBitmapResponse> handle(const Messages::WindowServer::GetScreenBitmap&) override; - virtual OwnPtr<Messages::WindowServer::SetDoubleClickSpeedResponse> handle(const Messages::WindowServer::SetDoubleClickSpeed&) override; - virtual OwnPtr<Messages::WindowServer::GetDoubleClickSpeedResponse> handle(const Messages::WindowServer::GetDoubleClickSpeed&) override; + virtual Messages::WindowServer::GetGlobalCursorPositionResponse handle(const Messages::WindowServer::GetGlobalCursorPosition&) override; + virtual Messages::WindowServer::SetMouseAccelerationResponse handle(const Messages::WindowServer::SetMouseAcceleration&) override; + virtual Messages::WindowServer::GetMouseAccelerationResponse handle(const Messages::WindowServer::GetMouseAcceleration&) override; + virtual Messages::WindowServer::SetScrollStepSizeResponse handle(const Messages::WindowServer::SetScrollStepSize&) override; + virtual Messages::WindowServer::GetScrollStepSizeResponse handle(const Messages::WindowServer::GetScrollStepSize&) override; + virtual Messages::WindowServer::GetScreenBitmapResponse handle(const Messages::WindowServer::GetScreenBitmap&) override; + virtual Messages::WindowServer::SetDoubleClickSpeedResponse handle(const Messages::WindowServer::SetDoubleClickSpeed&) override; + virtual Messages::WindowServer::GetDoubleClickSpeedResponse handle(const Messages::WindowServer::GetDoubleClickSpeed&) override; virtual void handle(Messages::WindowServer::SetWindowModified const&) override; - virtual OwnPtr<Messages::WindowServer::IsWindowModifiedResponse> handle(Messages::WindowServer::IsWindowModified const&) override; + virtual Messages::WindowServer::IsWindowModifiedResponse handle(Messages::WindowServer::IsWindowModified const&) override; Window* window_from_id(i32 window_id); diff --git a/Userland/Services/WindowServer/WMClientConnection.cpp b/Userland/Services/WindowServer/WMClientConnection.cpp index 4a41cbf326..4ffe9b6a04 100644 --- a/Userland/Services/WindowServer/WMClientConnection.cpp +++ b/Userland/Services/WindowServer/WMClientConnection.cpp @@ -33,16 +33,16 @@ void WMClientConnection::die() }); } -OwnPtr<Messages::WindowManagerServer::SetAppletAreaPositionResponse> WMClientConnection::handle(const Messages::WindowManagerServer::SetAppletAreaPosition& message) +Messages::WindowManagerServer::SetAppletAreaPositionResponse WMClientConnection::handle(const Messages::WindowManagerServer::SetAppletAreaPosition& message) { if (m_window_id < 0) { did_misbehave("SetAppletAreaPosition: WM didn't assign window as manager yet"); // FIXME: return ok boolean? - return make<Messages::WindowManagerServer::SetAppletAreaPositionResponse>(); + return {}; } AppletManager::the().set_position(message.position()); - return make<Messages::WindowManagerServer::SetAppletAreaPositionResponse>(); + return {}; } void WMClientConnection::handle(const Messages::WindowManagerServer::SetActiveWindow& message) @@ -116,13 +116,13 @@ void WMClientConnection::handle(const Messages::WindowManagerServer::SetWindowMi WindowManager::the().minimize_windows(window, message.minimized()); } -OwnPtr<Messages::WindowManagerServer::SetEventMaskResponse> WMClientConnection::handle(const Messages::WindowManagerServer::SetEventMask& message) +Messages::WindowManagerServer::SetEventMaskResponse WMClientConnection::handle(const Messages::WindowManagerServer::SetEventMask& message) { m_event_mask = message.event_mask(); - return make<Messages::WindowManagerServer::SetEventMaskResponse>(); + return {}; } -OwnPtr<Messages::WindowManagerServer::SetManagerWindowResponse> WMClientConnection::handle(const Messages::WindowManagerServer::SetManagerWindow& message) +Messages::WindowManagerServer::SetManagerWindowResponse WMClientConnection::handle(const Messages::WindowManagerServer::SetManagerWindow& message) { m_window_id = message.window_id(); @@ -130,7 +130,7 @@ OwnPtr<Messages::WindowManagerServer::SetManagerWindowResponse> WMClientConnecti // receive information about other windows. WindowManager::the().greet_window_manager(*this); - return make<Messages::WindowManagerServer::SetManagerWindowResponse>(); + return {}; } void WMClientConnection::handle(const Messages::WindowManagerServer::SetWindowTaskbarRect& message) diff --git a/Userland/Services/WindowServer/WMClientConnection.h b/Userland/Services/WindowServer/WMClientConnection.h index 1c818bd3f8..fc0f1097e6 100644 --- a/Userland/Services/WindowServer/WMClientConnection.h +++ b/Userland/Services/WindowServer/WMClientConnection.h @@ -27,9 +27,9 @@ public: virtual void handle(const Messages::WindowManagerServer::StartWindowResize&) override; virtual void handle(const Messages::WindowManagerServer::PopupWindowMenu&) override; virtual void handle(const Messages::WindowManagerServer::SetWindowTaskbarRect&) override; - virtual OwnPtr<Messages::WindowManagerServer::SetAppletAreaPositionResponse> handle(const Messages::WindowManagerServer::SetAppletAreaPosition&) override; - virtual OwnPtr<Messages::WindowManagerServer::SetEventMaskResponse> handle(const Messages::WindowManagerServer::SetEventMask&) override; - virtual OwnPtr<Messages::WindowManagerServer::SetManagerWindowResponse> handle(const Messages::WindowManagerServer::SetManagerWindow&) override; + virtual Messages::WindowManagerServer::SetAppletAreaPositionResponse handle(const Messages::WindowManagerServer::SetAppletAreaPosition&) override; + virtual Messages::WindowManagerServer::SetEventMaskResponse handle(const Messages::WindowManagerServer::SetEventMask&) override; + virtual Messages::WindowManagerServer::SetManagerWindowResponse handle(const Messages::WindowManagerServer::SetManagerWindow&) override; unsigned event_mask() const { return m_event_mask; } int window_id() const { return m_window_id; } |