mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
Userland: Make IPC handlers return void if they don't have any outputs
This commit is contained in:
parent
7cf2839a26
commit
889359b6f9
Notes:
sideshowbarker
2024-07-18 18:47:39 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/889359b6f99 Pull-request: https://github.com/SerenityOS/serenity/pull/6805 Reviewed-by: https://github.com/alimpfard
30 changed files with 180 additions and 225 deletions
|
@ -30,7 +30,7 @@ void ClientConnection::die()
|
|||
exit(0);
|
||||
}
|
||||
|
||||
Messages::LanguageServer::GreetResponse ClientConnection::handle(const Messages::LanguageServer::Greet& message)
|
||||
void 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,6 @@ Messages::LanguageServer::GreetResponse ClientConnection::handle(const Messages:
|
|||
perror("unveil");
|
||||
exit(1);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
void ClientConnection::handle(const Messages::LanguageServer::FileOpened& message)
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
virtual void die() override;
|
||||
|
||||
protected:
|
||||
virtual Messages::LanguageServer::GreetResponse handle(const Messages::LanguageServer::Greet&) override;
|
||||
virtual void 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;
|
||||
|
|
|
@ -370,8 +370,12 @@ public:
|
|||
)~~~");
|
||||
|
||||
message_generator.append(R"~~~(
|
||||
virtual bool valid() const { return m_ipc_message_valid; }
|
||||
|
||||
virtual IPC::MessageBuffer encode() const override
|
||||
{
|
||||
VERIFY(valid());
|
||||
|
||||
IPC::MessageBuffer buffer;
|
||||
IPC::Encoder stream(buffer);
|
||||
stream << endpoint_magic();
|
||||
|
@ -536,30 +540,42 @@ public:
|
|||
switch (message.message_id()) {
|
||||
)~~~");
|
||||
for (auto& message : endpoint.messages) {
|
||||
auto do_decode_message = [&](const String& name, bool returns_something) {
|
||||
auto do_handle_message = [&](const String& name, bool returns_something) {
|
||||
auto message_generator = endpoint_generator.fork();
|
||||
|
||||
message_generator.set("message.name", name);
|
||||
message_generator.set("message.response_type", message.response_name());
|
||||
message_generator.append(R"~~~(
|
||||
case (int)Messages::@endpoint.name@::MessageID::@message.name@: {
|
||||
)~~~");
|
||||
if (returns_something) {
|
||||
message_generator.append(R"~~~(
|
||||
auto response = handle(static_cast<const Messages::@endpoint.name@::@message.name@&>(message));
|
||||
if (message.outputs.is_empty()) {
|
||||
message_generator.append(R"~~~(
|
||||
handle(static_cast<const Messages::@endpoint.name@::@message.name@&>(message));
|
||||
auto response = Messages::@endpoint.name@::@message.response_type@ { };
|
||||
return make<IPC::MessageBuffer>(response.encode());
|
||||
}
|
||||
)~~~");
|
||||
} else {
|
||||
message_generator.append(R"~~~(
|
||||
auto response = handle(static_cast<const Messages::@endpoint.name@::@message.name@&>(message));
|
||||
if (!response.valid())
|
||||
return {};
|
||||
return make<IPC::MessageBuffer>(response.encode());
|
||||
)~~~");
|
||||
}
|
||||
} else {
|
||||
message_generator.append(R"~~~(
|
||||
handle(static_cast<const Messages::@endpoint.name@::@message.name@&>(message));
|
||||
return {};
|
||||
}
|
||||
)~~~");
|
||||
}
|
||||
message_generator.append(R"~~~(
|
||||
}
|
||||
)~~~");
|
||||
};
|
||||
do_decode_message(message.name, message.is_synchronous);
|
||||
do_handle_message(message.name, message.is_synchronous);
|
||||
if (message.is_synchronous)
|
||||
do_decode_message(message.response_name(), false);
|
||||
do_handle_message(message.response_name(), false);
|
||||
}
|
||||
endpoint_generator.append(R"~~~(
|
||||
default:
|
||||
|
@ -574,7 +590,7 @@ public:
|
|||
message_generator.set("message.name", message.name);
|
||||
|
||||
String return_type = "void";
|
||||
if (message.is_synchronous) {
|
||||
if (message.is_synchronous && !message.outputs.is_empty()) {
|
||||
StringBuilder builder;
|
||||
builder.append("Messages::");
|
||||
builder.append(endpoint.name);
|
||||
|
|
|
@ -23,6 +23,7 @@ public:
|
|||
virtual u32 endpoint_magic() const = 0;
|
||||
virtual int message_id() const = 0;
|
||||
virtual const char* message_name() const = 0;
|
||||
virtual bool valid() const = 0;
|
||||
virtual MessageBuffer encode() const = 0;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -83,13 +83,11 @@ void RequestClient::handle(const Messages::RequestClient::HeadersBecameAvailable
|
|||
}
|
||||
}
|
||||
|
||||
Messages::RequestClient::CertificateRequestedResponse RequestClient::handle(const Messages::RequestClient::CertificateRequested& message)
|
||||
void 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 {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ private:
|
|||
|
||||
virtual void handle(const Messages::RequestClient::RequestProgress&) override;
|
||||
virtual void handle(const Messages::RequestClient::RequestFinished&) override;
|
||||
virtual Messages::RequestClient::CertificateRequestedResponse handle(const Messages::RequestClient::CertificateRequested&) override;
|
||||
virtual void handle(const Messages::RequestClient::CertificateRequested&) override;
|
||||
virtual void handle(const Messages::RequestClient::HeadersBecameAvailable&) override;
|
||||
|
||||
HashMap<i32, RefPtr<Request>> m_requests;
|
||||
|
|
|
@ -147,10 +147,9 @@ void WebContentClient::handle(const Messages::WebContentClient::DidJSConsoleOutp
|
|||
m_view.notify_server_did_js_console_output(message.method(), message.line());
|
||||
}
|
||||
|
||||
Messages::WebContentClient::DidRequestAlertResponse WebContentClient::handle(const Messages::WebContentClient::DidRequestAlert& message)
|
||||
void WebContentClient::handle(const Messages::WebContentClient::DidRequestAlert& message)
|
||||
{
|
||||
m_view.notify_server_did_request_alert({}, message.message());
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WebContentClient::DidRequestConfirmResponse WebContentClient::handle(const Messages::WebContentClient::DidRequestConfirm& message)
|
||||
|
|
|
@ -53,7 +53,7 @@ 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 Messages::WebContentClient::DidRequestAlertResponse handle(const Messages::WebContentClient::DidRequestAlert&) override;
|
||||
virtual void 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;
|
||||
|
|
|
@ -59,9 +59,8 @@ void ClientConnection::did_change_main_mix_volume(Badge<Mixer>, int volume)
|
|||
post_message(Messages::AudioClient::MainMixVolumeChanged(volume));
|
||||
}
|
||||
|
||||
Messages::AudioServer::GreetResponse ClientConnection::handle(const Messages::AudioServer::Greet&)
|
||||
void ClientConnection::handle(const Messages::AudioServer::Greet&)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::AudioServer::GetMainMixVolumeResponse ClientConnection::handle(const Messages::AudioServer::GetMainMixVolume&)
|
||||
|
@ -69,10 +68,9 @@ Messages::AudioServer::GetMainMixVolumeResponse ClientConnection::handle(const M
|
|||
return m_mixer.main_volume();
|
||||
}
|
||||
|
||||
Messages::AudioServer::SetMainMixVolumeResponse ClientConnection::handle(const Messages::AudioServer::SetMainMixVolume& message)
|
||||
void ClientConnection::handle(const Messages::AudioServer::SetMainMixVolume& message)
|
||||
{
|
||||
m_mixer.set_main_volume(message.volume());
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::AudioServer::EnqueueBufferResponse ClientConnection::handle(const Messages::AudioServer::EnqueueBuffer& message)
|
||||
|
@ -105,18 +103,16 @@ Messages::AudioServer::GetPlayedSamplesResponse ClientConnection::handle(const M
|
|||
return played;
|
||||
}
|
||||
|
||||
Messages::AudioServer::SetPausedResponse ClientConnection::handle(const Messages::AudioServer::SetPaused& message)
|
||||
void ClientConnection::handle(const Messages::AudioServer::SetPaused& message)
|
||||
{
|
||||
if (m_queue)
|
||||
m_queue->set_paused(message.paused());
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::AudioServer::ClearBufferResponse ClientConnection::handle(const Messages::AudioServer::ClearBuffer& message)
|
||||
void ClientConnection::handle(const Messages::AudioServer::ClearBuffer& message)
|
||||
{
|
||||
if (m_queue)
|
||||
m_queue->clear(message.paused());
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::AudioServer::GetPlayingBufferResponse ClientConnection::handle(const Messages::AudioServer::GetPlayingBuffer&)
|
||||
|
@ -132,9 +128,8 @@ Messages::AudioServer::GetMutedResponse ClientConnection::handle(const Messages:
|
|||
return m_mixer.is_muted();
|
||||
}
|
||||
|
||||
Messages::AudioServer::SetMutedResponse ClientConnection::handle(const Messages::AudioServer::SetMuted& message)
|
||||
void ClientConnection::handle(const Messages::AudioServer::SetMuted& message)
|
||||
{
|
||||
m_mixer.set_muted(message.muted());
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,17 +36,17 @@ public:
|
|||
static void for_each(Function<void(ClientConnection&)>);
|
||||
|
||||
private:
|
||||
virtual Messages::AudioServer::GreetResponse handle(const Messages::AudioServer::Greet&) override;
|
||||
virtual void 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 void 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 void handle(const Messages::AudioServer::SetPaused&) override;
|
||||
virtual void 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;
|
||||
virtual void handle(const Messages::AudioServer::SetMuted&) override;
|
||||
|
||||
Mixer& m_mixer;
|
||||
RefPtr<BufferQueue> m_queue;
|
||||
|
|
|
@ -35,15 +35,13 @@ void ClientConnection::die()
|
|||
s_connections.remove(client_id());
|
||||
}
|
||||
|
||||
Messages::ClipboardServer::GreetResponse ClientConnection::handle(const Messages::ClipboardServer::Greet&)
|
||||
void ClientConnection::handle(const Messages::ClipboardServer::Greet&)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::ClipboardServer::SetClipboardDataResponse ClientConnection::handle(const Messages::ClipboardServer::SetClipboardData& message)
|
||||
void ClientConnection::handle(const Messages::ClipboardServer::SetClipboardData& message)
|
||||
{
|
||||
Storage::the().set_data(message.data(), message.mime_type(), message.metadata().entries());
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::ClipboardServer::GetClipboardDataResponse ClientConnection::handle(const Messages::ClipboardServer::GetClipboardData&)
|
||||
|
|
|
@ -30,9 +30,9 @@ public:
|
|||
void notify_about_clipboard_change();
|
||||
|
||||
private:
|
||||
virtual Messages::ClipboardServer::GreetResponse handle(const Messages::ClipboardServer::Greet&) override;
|
||||
virtual void 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;
|
||||
virtual void handle(const Messages::ClipboardServer::SetClipboardData&) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -30,9 +30,8 @@ void ClientConnection::die()
|
|||
exit(0);
|
||||
}
|
||||
|
||||
Messages::ImageDecoderServer::GreetResponse ClientConnection::handle(const Messages::ImageDecoderServer::Greet&)
|
||||
void ClientConnection::handle(const Messages::ImageDecoderServer::Greet&)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::ImageDecoderServer::DecodeImageResponse ClientConnection::handle(const Messages::ImageDecoderServer::DecodeImage& message)
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
virtual void die() override;
|
||||
|
||||
private:
|
||||
virtual Messages::ImageDecoderServer::GreetResponse handle(const Messages::ImageDecoderServer::Greet&) override;
|
||||
virtual void handle(const Messages::ImageDecoderServer::Greet&) override;
|
||||
virtual Messages::ImageDecoderServer::DecodeImageResponse handle(const Messages::ImageDecoderServer::DecodeImage&) override;
|
||||
};
|
||||
|
||||
|
|
|
@ -28,9 +28,8 @@ void ClientConnection::die()
|
|||
s_connections.remove(client_id());
|
||||
}
|
||||
|
||||
Messages::LaunchServer::GreetResponse ClientConnection::handle(const Messages::LaunchServer::Greet&)
|
||||
void ClientConnection::handle(const Messages::LaunchServer::Greet&)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::LaunchServer::OpenURLResponse ClientConnection::handle(const Messages::LaunchServer::OpenURL& request)
|
||||
|
@ -67,70 +66,62 @@ Messages::LaunchServer::GetHandlersWithDetailsForURLResponse ClientConnection::h
|
|||
return Launcher::the().handlers_with_details_for_url(url);
|
||||
}
|
||||
|
||||
Messages::LaunchServer::AddAllowedURLResponse ClientConnection::handle(const Messages::LaunchServer::AddAllowedURL& request)
|
||||
void 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");
|
||||
return {};
|
||||
return;
|
||||
}
|
||||
|
||||
if (!request.url().is_valid()) {
|
||||
did_misbehave("Got request to allow invalid URL");
|
||||
return {};
|
||||
return;
|
||||
}
|
||||
|
||||
m_allowlist.empend(String(), false, Vector<URL> { request.url() });
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::LaunchServer::AddAllowedHandlerWithAnyURLResponse ClientConnection::handle(const Messages::LaunchServer::AddAllowedHandlerWithAnyURL& request)
|
||||
void 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");
|
||||
return {};
|
||||
return;
|
||||
}
|
||||
|
||||
if (request.handler_name().is_empty()) {
|
||||
did_misbehave("Got request to allow empty handler name");
|
||||
return {};
|
||||
return;
|
||||
}
|
||||
|
||||
m_allowlist.empend(request.handler_name(), true, Vector<URL>());
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLsResponse ClientConnection::handle(const Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLs& request)
|
||||
void 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");
|
||||
return {};
|
||||
return;
|
||||
}
|
||||
|
||||
if (request.handler_name().is_empty()) {
|
||||
did_misbehave("Got request to allow empty handler name");
|
||||
return {};
|
||||
return;
|
||||
}
|
||||
|
||||
if (request.urls().is_empty()) {
|
||||
did_misbehave("Got request to allow empty URL list");
|
||||
return {};
|
||||
return;
|
||||
}
|
||||
|
||||
m_allowlist.empend(request.handler_name(), false, request.urls());
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::LaunchServer::SealAllowlistResponse ClientConnection::handle(const Messages::LaunchServer::SealAllowlist&)
|
||||
void 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;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,14 +23,14 @@ public:
|
|||
private:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
|
||||
virtual Messages::LaunchServer::GreetResponse handle(const Messages::LaunchServer::Greet&) override;
|
||||
virtual void 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;
|
||||
virtual void handle(const Messages::LaunchServer::AddAllowedURL&) override;
|
||||
virtual void handle(const Messages::LaunchServer::AddAllowedHandlerWithAnyURL&) override;
|
||||
virtual void handle(const Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLs&) override;
|
||||
virtual void handle(const Messages::LaunchServer::SealAllowlist&) override;
|
||||
|
||||
struct AllowlistEntry {
|
||||
String handler_name;
|
||||
|
|
|
@ -28,25 +28,22 @@ void ClientConnection::die()
|
|||
s_connections.remove(client_id());
|
||||
}
|
||||
|
||||
Messages::NotificationServer::GreetResponse ClientConnection::handle(const Messages::NotificationServer::Greet&)
|
||||
void ClientConnection::handle(const Messages::NotificationServer::Greet&)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::NotificationServer::ShowNotificationResponse ClientConnection::handle(const Messages::NotificationServer::ShowNotification& message)
|
||||
void ClientConnection::handle(const Messages::NotificationServer::ShowNotification& message)
|
||||
{
|
||||
auto window = NotificationWindow::construct(client_id(), message.text(), message.title(), message.icon());
|
||||
window->show();
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::NotificationServer::CloseNotificationResponse ClientConnection::handle([[maybe_unused]] const Messages::NotificationServer::CloseNotification& message)
|
||||
void ClientConnection::handle([[maybe_unused]] const Messages::NotificationServer::CloseNotification& message)
|
||||
{
|
||||
auto window = NotificationWindow::get_window_by_id(client_id());
|
||||
if (window) {
|
||||
window->close();
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::NotificationServer::UpdateNotificationIconResponse ClientConnection::handle(const Messages::NotificationServer::UpdateNotificationIcon& message)
|
||||
|
|
|
@ -23,9 +23,9 @@ public:
|
|||
private:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
|
||||
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 void handle(const Messages::NotificationServer::Greet&) override;
|
||||
virtual void handle(const Messages::NotificationServer::ShowNotification&) override;
|
||||
virtual void 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;
|
||||
|
|
|
@ -100,9 +100,8 @@ void ClientConnection::did_request_certificates(Badge<Request>, Request& request
|
|||
post_message(Messages::RequestClient::CertificateRequested(request.id()));
|
||||
}
|
||||
|
||||
Messages::RequestServer::GreetResponse ClientConnection::handle(const Messages::RequestServer::Greet&)
|
||||
void ClientConnection::handle(const Messages::RequestServer::Greet&)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::RequestServer::SetCertificateResponse ClientConnection::handle(const Messages::RequestServer::SetCertificate& message)
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
void did_request_certificates(Badge<Request>, Request&);
|
||||
|
||||
private:
|
||||
virtual Messages::RequestServer::GreetResponse handle(const Messages::RequestServer::Greet&) override;
|
||||
virtual void 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;
|
||||
|
|
|
@ -35,9 +35,8 @@ void ClientConnection::die()
|
|||
s_connections.remove(client_id());
|
||||
}
|
||||
|
||||
Messages::SymbolServer::GreetResponse ClientConnection::handle(const Messages::SymbolServer::Greet&)
|
||||
void ClientConnection::handle(const Messages::SymbolServer::Greet&)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::SymbolServer::SymbolicateResponse ClientConnection::handle(const Messages::SymbolServer::Symbolicate& message)
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
virtual void die() override;
|
||||
|
||||
private:
|
||||
virtual Messages::SymbolServer::GreetResponse handle(const Messages::SymbolServer::Greet&) override;
|
||||
virtual void handle(const Messages::SymbolServer::Greet&) override;
|
||||
virtual Messages::SymbolServer::SymbolicateResponse handle(const Messages::SymbolServer::Symbolicate&) override;
|
||||
};
|
||||
|
||||
|
|
|
@ -58,9 +58,8 @@ const Web::Page& ClientConnection::page() const
|
|||
return m_page_host->page();
|
||||
}
|
||||
|
||||
Messages::WebContentServer::GreetResponse ClientConnection::handle(const Messages::WebContentServer::Greet&)
|
||||
void ClientConnection::handle(const Messages::WebContentServer::Greet&)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
void ClientConnection::handle(const Messages::WebContentServer::UpdateSystemTheme& message)
|
||||
|
|
|
@ -33,7 +33,7 @@ private:
|
|||
Web::Page& page();
|
||||
const Web::Page& page() const;
|
||||
|
||||
virtual Messages::WebContentServer::GreetResponse handle(const Messages::WebContentServer::Greet&) override;
|
||||
virtual void 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;
|
||||
|
|
|
@ -31,9 +31,8 @@ void ClientConnection::die()
|
|||
Core::EventLoop::current().quit(0);
|
||||
}
|
||||
|
||||
Messages::WebSocketServer::GreetResponse ClientConnection::handle(const Messages::WebSocketServer::Greet&)
|
||||
void ClientConnection::handle(const Messages::WebSocketServer::Greet&)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WebSocketServer::ConnectResponse ClientConnection::handle(const Messages::WebSocketServer::Connect& message)
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
virtual void die() override;
|
||||
|
||||
private:
|
||||
virtual Messages::WebSocketServer::GreetResponse handle(const Messages::WebSocketServer::Greet&) override;
|
||||
virtual void 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;
|
||||
|
|
|
@ -89,16 +89,15 @@ Messages::WindowServer::CreateMenubarResponse ClientConnection::handle(const Mes
|
|||
return menubar_id;
|
||||
}
|
||||
|
||||
Messages::WindowServer::DestroyMenubarResponse ClientConnection::handle(const Messages::WindowServer::DestroyMenubar& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
m_menubars.remove(it);
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::CreateMenuResponse ClientConnection::handle(const Messages::WindowServer::CreateMenu& message)
|
||||
|
@ -109,29 +108,28 @@ Messages::WindowServer::CreateMenuResponse ClientConnection::handle(const Messag
|
|||
return menu_id;
|
||||
}
|
||||
|
||||
Messages::WindowServer::DestroyMenuResponse ClientConnection::handle(const Messages::WindowServer::DestroyMenu& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
auto& menu = *(*it).value;
|
||||
menu.close();
|
||||
m_menus.remove(it);
|
||||
remove_child(menu);
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetWindowMenubarResponse ClientConnection::handle(const Messages::WindowServer::SetWindowMenubar& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
window = it->value;
|
||||
}
|
||||
|
@ -140,15 +138,14 @@ Messages::WindowServer::SetWindowMenubarResponse ClientConnection::handle(const
|
|||
auto it = m_menubars.find(message.menubar_id());
|
||||
if (it == m_menubars.end()) {
|
||||
did_misbehave("SetWindowMenubar: Bad menubar ID");
|
||||
return nullptr;
|
||||
return;
|
||||
}
|
||||
menubar = *(*it).value;
|
||||
}
|
||||
window->set_menubar(menubar);
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::AddMenuToMenubarResponse ClientConnection::handle(const Messages::WindowServer::AddMenuToMenubar& message)
|
||||
void ClientConnection::handle(const Messages::WindowServer::AddMenuToMenubar& message)
|
||||
{
|
||||
int menubar_id = message.menubar_id();
|
||||
int menu_id = message.menu_id();
|
||||
|
@ -156,26 +153,25 @@ Messages::WindowServer::AddMenuToMenubarResponse ClientConnection::handle(const
|
|||
auto jt = m_menus.find(menu_id);
|
||||
if (it == m_menubars.end()) {
|
||||
did_misbehave("AddMenuToMenubar: Bad menubar ID");
|
||||
return nullptr;
|
||||
return;
|
||||
}
|
||||
if (jt == m_menus.end()) {
|
||||
did_misbehave("AddMenuToMenubar: Bad menu ID");
|
||||
return nullptr;
|
||||
return;
|
||||
}
|
||||
auto& menubar = *(*it).value;
|
||||
auto& menu = *(*jt).value;
|
||||
menubar.add_menu(menu);
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::AddMenuItemResponse ClientConnection::handle(const Messages::WindowServer::AddMenuItem& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
auto& menu = *(*it).value;
|
||||
auto menu_item = make<MenuItem>(menu, identifier, message.text(), message.shortcut(), message.enabled(), message.checkable(), message.checked());
|
||||
|
@ -185,49 +181,46 @@ Messages::WindowServer::AddMenuItemResponse ClientConnection::handle(const Messa
|
|||
menu_item->set_submenu_id(message.submenu_id());
|
||||
menu_item->set_exclusive(message.exclusive());
|
||||
menu.add_item(move(menu_item));
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::PopupMenuResponse ClientConnection::handle(const Messages::WindowServer::PopupMenu& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
auto& menu = *(*it).value;
|
||||
menu.popup(position);
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::DismissMenuResponse ClientConnection::handle(const Messages::WindowServer::DismissMenu& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
auto& menu = *(*it).value;
|
||||
menu.close();
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::UpdateMenuItemResponse ClientConnection::handle(const Messages::WindowServer::UpdateMenuItem& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
auto& menu = *(*it).value;
|
||||
auto* menu_item = menu.item_with_identifier(message.identifier());
|
||||
if (!menu_item) {
|
||||
did_misbehave("UpdateMenuItem: Bad menu item identifier");
|
||||
return nullptr;
|
||||
return;
|
||||
}
|
||||
menu_item->set_text(message.text());
|
||||
menu_item->set_shortcut_text(message.shortcut());
|
||||
|
@ -236,65 +229,59 @@ Messages::WindowServer::UpdateMenuItemResponse ClientConnection::handle(const Me
|
|||
menu_item->set_default(message.is_default());
|
||||
if (message.checkable())
|
||||
menu_item->set_checked(message.checked());
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::AddMenuSeparatorResponse ClientConnection::handle(const Messages::WindowServer::AddMenuSeparator& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
auto& menu = *(*it).value;
|
||||
menu.add_item(make<MenuItem>(menu, MenuItem::Separator));
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::MoveWindowToFrontResponse ClientConnection::handle(const Messages::WindowServer::MoveWindowToFront& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
WindowManager::the().move_to_front_and_make_active(*(*it).value);
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetFullscreenResponse ClientConnection::handle(const Messages::WindowServer::SetFullscreen& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
it->value->set_fullscreen(message.fullscreen());
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetFramelessResponse ClientConnection::handle(const Messages::WindowServer::SetFrameless& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
it->value->set_frameless(message.frameless());
|
||||
WindowManager::the().tell_wms_window_state_changed(*it->value);
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetWindowOpacityResponse ClientConnection::handle(const Messages::WindowServer::SetWindowOpacity& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
it->value->set_opacity(message.opacity());
|
||||
return {};
|
||||
}
|
||||
|
||||
void ClientConnection::handle(const Messages::WindowServer::AsyncSetWallpaper& message)
|
||||
|
@ -304,16 +291,14 @@ void ClientConnection::handle(const Messages::WindowServer::AsyncSetWallpaper& m
|
|||
});
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetBackgroundColorResponse ClientConnection::handle(const Messages::WindowServer::SetBackgroundColor& message)
|
||||
void ClientConnection::handle(const Messages::WindowServer::SetBackgroundColor& message)
|
||||
{
|
||||
Compositor::the().set_background_color(message.background_color());
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetWallpaperModeResponse ClientConnection::handle(const Messages::WindowServer::SetWallpaperMode& message)
|
||||
void ClientConnection::handle(const Messages::WindowServer::SetWallpaperMode& message)
|
||||
{
|
||||
Compositor::the().set_wallpaper_mode(message.mode());
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::GetWallpaperResponse ClientConnection::handle(const Messages::WindowServer::GetWallpaper&)
|
||||
|
@ -326,15 +311,14 @@ Messages::WindowServer::SetResolutionResponse ClientConnection::handle(const Mes
|
|||
return { WindowManager::the().set_resolution(message.resolution().width(), message.resolution().height(), message.scale_factor()), WindowManager::the().resolution(), WindowManager::the().scale_factor() };
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetWindowTitleResponse ClientConnection::handle(const Messages::WindowServer::SetWindowTitle& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
it->value->set_title(message.title());
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::GetWindowTitleResponse ClientConnection::handle(const Messages::WindowServer::GetWindowTitle& message)
|
||||
|
@ -357,12 +341,12 @@ Messages::WindowServer::IsMaximizedResponse ClientConnection::handle(const Messa
|
|||
return it->value->is_maximized();
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetWindowIconBitmapResponse ClientConnection::handle(const Messages::WindowServer::SetWindowIconBitmap& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
auto& window = *(*it).value;
|
||||
|
||||
|
@ -374,7 +358,6 @@ Messages::WindowServer::SetWindowIconBitmapResponse ClientConnection::handle(con
|
|||
|
||||
window.frame().invalidate_titlebar();
|
||||
WindowManager::the().tell_wms_window_icon_changed(window);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetWindowRectResponse ClientConnection::handle(const Messages::WindowServer::SetWindowRect& message)
|
||||
|
@ -413,18 +396,18 @@ Messages::WindowServer::GetWindowRectResponse ClientConnection::handle(const Mes
|
|||
return it->value->rect();
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetWindowMinimumSizeResponse ClientConnection::handle(const Messages::WindowServer::SetWindowMinimumSize& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
auto& window = *(*it).value;
|
||||
if (window.is_fullscreen()) {
|
||||
dbgln("ClientConnection: Ignoring SetWindowMinimumSize request for fullscreen window");
|
||||
return nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
window.set_minimum_size(message.size());
|
||||
|
@ -440,8 +423,6 @@ Messages::WindowServer::SetWindowMinimumSizeResponse ClientConnection::handle(co
|
|||
if (did_size_clamp)
|
||||
window.refresh_client_size();
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::GetWindowMinimumSizeResponse ClientConnection::handle(const Messages::WindowServer::GetWindowMinimumSize& message)
|
||||
|
@ -602,13 +583,13 @@ void ClientConnection::handle(const Messages::WindowServer::DidFinishPainting& m
|
|||
WindowSwitcher::the().refresh_if_needed();
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetWindowBackingStoreResponse ClientConnection::handle(const Messages::WindowServer::SetWindowBackingStore& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
auto& window = *(*it).value;
|
||||
if (window.last_backing_store() && window.last_backing_store_serial() == message.serial()) {
|
||||
|
@ -627,79 +608,72 @@ Messages::WindowServer::SetWindowBackingStoreResponse ClientConnection::handle(c
|
|||
|
||||
if (message.flush_immediately())
|
||||
window.invalidate(false);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetGlobalCursorTrackingResponse ClientConnection::handle(const Messages::WindowServer::SetGlobalCursorTracking& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
it->value->set_global_cursor_tracking_enabled(message.enabled());
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetWindowCursorResponse ClientConnection::handle(const Messages::WindowServer::SetWindowCursor& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
auto& window = *(*it).value;
|
||||
if (message.cursor_type() < 0 || message.cursor_type() >= (i32)Gfx::StandardCursor::__Count) {
|
||||
did_misbehave("SetWindowCursor: Bad cursor type");
|
||||
return nullptr;
|
||||
return;
|
||||
}
|
||||
window.set_cursor(Cursor::create((Gfx::StandardCursor)message.cursor_type()));
|
||||
if (&window == WindowManager::the().hovered_window())
|
||||
Compositor::the().invalidate_cursor();
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetWindowCustomCursorResponse ClientConnection::handle(const Messages::WindowServer::SetWindowCustomCursor& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
auto& window = *(*it).value;
|
||||
if (!message.cursor().is_valid()) {
|
||||
did_misbehave("SetWindowCustomCursor: Bad cursor");
|
||||
return nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
window.set_cursor(Cursor::create(*message.cursor().bitmap()));
|
||||
Compositor::the().invalidate_cursor();
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetWindowHasAlphaChannelResponse ClientConnection::handle(const Messages::WindowServer::SetWindowHasAlphaChannel& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
it->value->set_has_alpha_channel(message.has_alpha_channel());
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetWindowAlphaHitThresholdResponse ClientConnection::handle(const Messages::WindowServer::SetWindowAlphaHitThreshold& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
it->value->set_alpha_hit_threshold(message.threshold());
|
||||
return {};
|
||||
}
|
||||
|
||||
void ClientConnection::handle(const Messages::WindowServer::StartWindowResize& request)
|
||||
|
@ -743,33 +717,29 @@ Messages::WindowServer::GetSystemThemeResponse ClientConnection::handle(const Me
|
|||
return name;
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetWindowBaseSizeAndSizeIncrementResponse ClientConnection::handle(const Messages::WindowServer::SetWindowBaseSizeAndSizeIncrement& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
auto& window = *it->value;
|
||||
window.set_base_size(message.base_size());
|
||||
window.set_size_increment(message.size_increment());
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetWindowResizeAspectRatioResponse ClientConnection::handle(const Messages::WindowServer::SetWindowResizeAspectRatio& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
auto& window = *it->value;
|
||||
window.set_resize_aspect_ratio(message.resize_aspect_ratio());
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void ClientConnection::handle(const Messages::WindowServer::EnableDisplayLink&)
|
||||
|
@ -823,15 +793,14 @@ Messages::WindowServer::GetGlobalCursorPositionResponse ClientConnection::handle
|
|||
return Screen::the().cursor_location();
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetMouseAccelerationResponse ClientConnection::handle(const Messages::WindowServer::SetMouseAcceleration& message)
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
WindowManager::the().set_acceleration_factor(factor);
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::GetMouseAccelerationResponse ClientConnection::handle(const Messages::WindowServer::GetMouseAcceleration&)
|
||||
|
@ -839,28 +808,29 @@ Messages::WindowServer::GetMouseAccelerationResponse ClientConnection::handle(co
|
|||
return Screen::the().acceleration_factor();
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetScrollStepSizeResponse ClientConnection::handle(const Messages::WindowServer::SetScrollStepSize& message)
|
||||
void ClientConnection::handle(const Messages::WindowServer::SetScrollStepSize& message)
|
||||
{
|
||||
if (message.step_size() < scroll_step_size_min) {
|
||||
did_misbehave("SetScrollStepSize with bad scroll step size");
|
||||
return nullptr;
|
||||
return;
|
||||
}
|
||||
WindowManager::the().set_scroll_step_size(message.step_size());
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::GetScrollStepSizeResponse ClientConnection::handle(const Messages::WindowServer::GetScrollStepSize&)
|
||||
{
|
||||
return Screen::the().scroll_step_size();
|
||||
}
|
||||
Messages::WindowServer::SetDoubleClickSpeedResponse ClientConnection::handle(const Messages::WindowServer::SetDoubleClickSpeed& message)
|
||||
|
||||
void 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 nullptr;
|
||||
return;
|
||||
}
|
||||
WindowManager::the().set_double_click_speed(message.speed());
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowServer::GetDoubleClickSpeedResponse ClientConnection::handle(const Messages::WindowServer::GetDoubleClickSpeed&)
|
||||
{
|
||||
return WindowManager::the().double_click_speed();
|
||||
|
|
|
@ -89,62 +89,62 @@ private:
|
|||
|
||||
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 void 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 void handle(const Messages::WindowServer::DestroyMenu&) override;
|
||||
virtual void handle(const Messages::WindowServer::AddMenuToMenubar&) override;
|
||||
virtual void handle(const Messages::WindowServer::SetWindowMenubar&) override;
|
||||
virtual void handle(const Messages::WindowServer::AddMenuItem&) override;
|
||||
virtual void handle(const Messages::WindowServer::AddMenuSeparator&) override;
|
||||
virtual void 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 void 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 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 void 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 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::SetGlobalCursorTracking&) override;
|
||||
virtual void handle(const Messages::WindowServer::SetWindowOpacity&) override;
|
||||
virtual void handle(const Messages::WindowServer::SetWindowBackingStore&) override;
|
||||
virtual void handle(const Messages::WindowServer::SetWindowHasAlphaChannel&) override;
|
||||
virtual void handle(const Messages::WindowServer::SetWindowAlphaHitThreshold&) override;
|
||||
virtual void handle(const Messages::WindowServer::MoveWindowToFront&) override;
|
||||
virtual void handle(const Messages::WindowServer::SetFullscreen&) override;
|
||||
virtual void handle(const Messages::WindowServer::SetFrameless&) override;
|
||||
virtual void handle(const Messages::WindowServer::AsyncSetWallpaper&) override;
|
||||
virtual Messages::WindowServer::SetBackgroundColorResponse handle(const Messages::WindowServer::SetBackgroundColor&) override;
|
||||
virtual Messages::WindowServer::SetWallpaperModeResponse handle(const Messages::WindowServer::SetWallpaperMode&) override;
|
||||
virtual void handle(const Messages::WindowServer::SetBackgroundColor&) override;
|
||||
virtual void 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 void handle(const Messages::WindowServer::SetWindowCursor&) override;
|
||||
virtual void handle(const Messages::WindowServer::SetWindowCustomCursor&) override;
|
||||
virtual void handle(const Messages::WindowServer::PopupMenu&) override;
|
||||
virtual void handle(const Messages::WindowServer::DismissMenu&) override;
|
||||
virtual void 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::SetWindowBaseSizeAndSizeIncrement&) override;
|
||||
virtual void 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 Messages::WindowServer::GetGlobalCursorPositionResponse handle(const Messages::WindowServer::GetGlobalCursorPosition&) override;
|
||||
virtual Messages::WindowServer::SetMouseAccelerationResponse handle(const Messages::WindowServer::SetMouseAcceleration&) override;
|
||||
virtual void 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 void 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 void 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 Messages::WindowServer::IsWindowModifiedResponse handle(Messages::WindowServer::IsWindowModified const&) override;
|
||||
|
|
|
@ -33,16 +33,15 @@ void WMClientConnection::die()
|
|||
});
|
||||
}
|
||||
|
||||
Messages::WindowManagerServer::SetAppletAreaPositionResponse WMClientConnection::handle(const Messages::WindowManagerServer::SetAppletAreaPosition& message)
|
||||
void 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 {};
|
||||
return;
|
||||
}
|
||||
|
||||
AppletManager::the().set_position(message.position());
|
||||
return {};
|
||||
}
|
||||
|
||||
void WMClientConnection::handle(const Messages::WindowManagerServer::SetActiveWindow& message)
|
||||
|
@ -116,21 +115,18 @@ void WMClientConnection::handle(const Messages::WindowManagerServer::SetWindowMi
|
|||
WindowManager::the().minimize_windows(window, message.minimized());
|
||||
}
|
||||
|
||||
Messages::WindowManagerServer::SetEventMaskResponse WMClientConnection::handle(const Messages::WindowManagerServer::SetEventMask& message)
|
||||
void WMClientConnection::handle(const Messages::WindowManagerServer::SetEventMask& message)
|
||||
{
|
||||
m_event_mask = message.event_mask();
|
||||
return {};
|
||||
}
|
||||
|
||||
Messages::WindowManagerServer::SetManagerWindowResponse WMClientConnection::handle(const Messages::WindowManagerServer::SetManagerWindow& message)
|
||||
void WMClientConnection::handle(const Messages::WindowManagerServer::SetManagerWindow& message)
|
||||
{
|
||||
m_window_id = message.window_id();
|
||||
|
||||
// Let the window manager know that we obtained a manager window, and should
|
||||
// receive information about other windows.
|
||||
WindowManager::the().greet_window_manager(*this);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void WMClientConnection::handle(const Messages::WindowManagerServer::SetWindowTaskbarRect& message)
|
||||
|
|
|
@ -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 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;
|
||||
virtual void handle(const Messages::WindowManagerServer::SetAppletAreaPosition&) override;
|
||||
virtual void handle(const Messages::WindowManagerServer::SetEventMask&) override;
|
||||
virtual void handle(const Messages::WindowManagerServer::SetManagerWindow&) override;
|
||||
|
||||
unsigned event_mask() const { return m_event_mask; }
|
||||
int window_id() const { return m_window_id; }
|
||||
|
|
Loading…
Reference in a new issue