window: Cache the client PID

Since the PID of a window can't change as long as the window exists, we
can safely cache it after we got a valid PID once, so do that by adding
a new `window->client_pid` private property.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1180
This commit is contained in:
Jonas Dreßler 2020-04-06 20:08:12 +02:00 committed by Florian Müllner
parent 70ba844c3c
commit 4fac1a4862
2 changed files with 8 additions and 1 deletions

View File

@ -548,6 +548,8 @@ struct _MetaWindow
} placement;
guint unmanage_idle_id;
pid_t client_pid;
};
struct _MetaWindowClass

View File

@ -1149,6 +1149,8 @@ _meta_window_shared_new (MetaDisplay *display,
window->is_remote = FALSE;
window->startup_id = NULL;
window->client_pid = 0;
window->xtransient_for = None;
window->xclient_leader = None;
@ -7595,7 +7597,10 @@ meta_window_get_pid (MetaWindow *window)
{
g_return_val_if_fail (META_IS_WINDOW (window), 0);
return META_WINDOW_GET_CLASS (window)->get_client_pid (window);
if (window->client_pid == 0)
window->client_pid = META_WINDOW_GET_CLASS (window)->get_client_pid (window);
return window->client_pid;
}
/**