mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:47:47 +00:00
WindowServer: Let clients mark windows as stealable by specific clients
This implements window stealing in WindowServer, which allows clients to mark a window they own as 'stealable' by another client. Indicating that the other client may use it for any purpose. This also updates set_window_parent_from_id so that the client must first mark its window as stealable before allowing other clients to use it as a parent.
This commit is contained in:
parent
f5e0475bdf
commit
9e04ab936f
4 changed files with 54 additions and 1 deletions
|
@ -1129,7 +1129,11 @@ void ClientConnection::set_window_parent_from_client(i32 client_id, i32 parent_i
|
|||
if (!parent_window)
|
||||
did_misbehave("SetWindowParentFromClient: Bad parent window ID");
|
||||
|
||||
child_window->set_parent_window(*parent_window);
|
||||
if (parent_window->is_stealable_by_client(this->client_id())) {
|
||||
child_window->set_parent_window(*parent_window);
|
||||
} else {
|
||||
did_misbehave("SetWindowParentFromClient: Window is not stealable");
|
||||
}
|
||||
}
|
||||
|
||||
Messages::WindowServer::GetWindowRectFromClientResponse ClientConnection::get_window_rect_from_client(i32 client_id, i32 window_id)
|
||||
|
@ -1145,4 +1149,36 @@ Messages::WindowServer::GetWindowRectFromClientResponse ClientConnection::get_wi
|
|||
return window->rect();
|
||||
}
|
||||
|
||||
void ClientConnection::add_window_stealing_for_client(i32 client_id, i32 window_id)
|
||||
{
|
||||
auto window = window_from_id(window_id);
|
||||
if (!window)
|
||||
did_misbehave("AddWindowStealingForClient: Bad window ID");
|
||||
|
||||
if (!from_client_id(client_id))
|
||||
did_misbehave("AddWindowStealingForClient: Bad client ID");
|
||||
|
||||
window->add_stealing_for_client(client_id);
|
||||
}
|
||||
|
||||
void ClientConnection::remove_window_stealing_for_client(i32 client_id, i32 window_id)
|
||||
{
|
||||
auto window = window_from_id(window_id);
|
||||
if (!window)
|
||||
did_misbehave("RemoveWindowStealingForClient: Bad window ID");
|
||||
|
||||
// Don't check if the client exists, it may have died
|
||||
|
||||
window->remove_stealing_for_client(client_id);
|
||||
}
|
||||
|
||||
void ClientConnection::remove_window_stealing(i32 window_id)
|
||||
{
|
||||
auto window = window_from_id(window_id);
|
||||
if (!window)
|
||||
did_misbehave("RemoveWindowStealing: Bad window ID");
|
||||
|
||||
window->remove_all_stealing();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue