1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07:35 +00:00

WindowServer: Add Window "modified" state

This will be used to track which windows contain some kind of unsaved
data that the user may want some help remembering to save. :^)
This commit is contained in:
Andreas Kling 2021-05-01 18:21:34 +02:00
parent 5c385d06e8
commit 492464f4c1
5 changed files with 41 additions and 1 deletions

View file

@ -903,4 +903,26 @@ OwnPtr<Messages::WindowServer::GetScreenBitmapResponse> ClientConnection::handle
return make<Messages::WindowServer::GetScreenBitmapResponse>(bitmap.to_shareable_bitmap());
}
OwnPtr<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 {};
}
auto& window = *it->value;
return make<Messages::WindowServer::IsWindowModifiedResponse>(window.is_modified());
}
void ClientConnection::handle(Messages::WindowServer::SetWindowModified const& message)
{
auto it = m_windows.find(message.window_id());
if (it == m_windows.end()) {
did_misbehave("SetWindowModified: Bad window ID");
return;
}
auto& window = *it->value;
window.set_modified(message.modified());
}
}