1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:28:11 +00:00

LibGUI+WindowServer: Store the source process' PID in the Window classes

The "Window" classes in LibGUI and WindowServer now store the PID of the
process that created the window. LibGUI's Window obtains the PID in the
constructor via getpid(), and passes it in Window::show() to
WindowServer via the create_window() IPC route. WindowServer then saves
it in its own Window class.
This allows us to find the process that created a window in order to add
process-specific actions to the window.
This commit is contained in:
david072 2023-11-04 19:35:12 +01:00 committed by Andreas Kling
parent 124611b256
commit 4386182be1
7 changed files with 13 additions and 5 deletions

View file

@ -75,6 +75,7 @@ Window* Window::from_window_id(int window_id)
Window::Window(Core::EventReceiver* parent)
: GUI::Object(parent)
, m_menubar(Menubar::construct())
, m_pid(getpid())
{
if (parent)
set_window_mode(WindowMode::Passive);
@ -154,6 +155,7 @@ void Window::show()
ConnectionToWindowServer::the().async_create_window(
m_window_id,
m_pid,
m_rect_when_windowless,
!m_moved_by_client,
m_has_alpha_channel,