mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
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:
parent
70ba844c3c
commit
4fac1a4862
@ -548,6 +548,8 @@ struct _MetaWindow
|
||||
} placement;
|
||||
|
||||
guint unmanage_idle_id;
|
||||
|
||||
pid_t client_pid;
|
||||
};
|
||||
|
||||
struct _MetaWindowClass
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user