1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:27:45 +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

@ -611,7 +611,7 @@ Window* ConnectionFromClient::window_from_id(i32 window_id)
return it->value.ptr();
}
void ConnectionFromClient::create_window(i32 window_id, Gfx::IntRect const& rect,
void ConnectionFromClient::create_window(i32 window_id, i32 process_id, Gfx::IntRect const& rect,
bool auto_position, bool has_alpha_channel, bool minimizable, bool closeable, bool resizable,
bool fullscreen, bool frameless, bool forced_shadow,
float alpha_hit_threshold, Gfx::IntSize base_size, Gfx::IntSize size_increment,
@ -642,7 +642,7 @@ void ConnectionFromClient::create_window(i32 window_id, Gfx::IntRect const& rect
return;
}
auto window = Window::construct(*this, (WindowType)type, (WindowMode)mode, window_id, minimizable, closeable, frameless, resizable, fullscreen, parent_window);
auto window = Window::construct(*this, (WindowType)type, (WindowMode)mode, window_id, process_id, minimizable, closeable, frameless, resizable, fullscreen, parent_window);
if (auto* blocker = window->blocking_modal_window(); blocker && mode == to_underlying(WindowMode::Blocking)) {
did_misbehave("CreateWindow with illegal mode: Reciprocally blocked");