WindowServer: Add WindowServer::async_set_window_parent_from_client()

This allows a client to set the parent for one of its local windows
where the parent window is in another client.
This commit is contained in:
Timothy 2021-07-13 00:35:46 +10:00 committed by Andreas Kling
parent 522f6775a7
commit 88e6d18a61
Notes: sideshowbarker 2024-07-18 08:50:00 +09:00
3 changed files with 20 additions and 0 deletions

View File

@ -1115,4 +1115,21 @@ void ClientConnection::set_flash_flush(bool enabled)
Compositor::the().set_flash_flush(enabled);
}
void ClientConnection::set_window_parent_from_client(i32 client_id, i32 parent_id, i32 child_id)
{
auto child_window = window_from_id(child_id);
if (!child_window)
did_misbehave("SetWindowParentFromClient: Bad child window ID");
auto client_connection = from_client_id(client_id);
if (!client_connection)
did_misbehave("SetWindowParentFromClient: Bad client ID");
auto parent_window = client_connection->window_from_id(parent_id);
if (!parent_window)
did_misbehave("SetWindowParentFromClient: Bad parent window ID");
child_window->set_parent_window(*parent_window);
}
}

View File

@ -164,6 +164,7 @@ private:
virtual Messages::WindowServer::IsWindowModifiedResponse is_window_modified(i32) override;
virtual Messages::WindowServer::GetDesktopDisplayScaleResponse get_desktop_display_scale(u32) override;
virtual void set_flash_flush(bool) override;
virtual void set_window_parent_from_client(i32, i32, i32) override;
Window* window_from_id(i32 window_id);

View File

@ -147,4 +147,6 @@ endpoint WindowServer
get_desktop_display_scale(u32 screen_index) => (int desktop_display_scale)
set_flash_flush(bool enabled) =|
set_window_parent_from_client(i32 client_id, i32 parent_id, i32 child_id) =|
}