diff --git a/src/core/window.c b/src/core/window.c index 6f62e0cb6..168ca0eb8 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -8668,3 +8668,40 @@ meta_window_get_transient_for (MetaWindow *window) else return NULL; } + +/** + * meta_window_get_pid: + * @window: a #MetaWindow + * + * Returns pid of the process that created this window, if known (obtained from + * the _NET_WM_PID property). + * + * Return value: (transfer none): the pid, or -1 if not known. + */ +int +meta_window_get_pid (MetaWindow *window) +{ + g_return_val_if_fail (META_IS_WINDOW (window), -1); + + return window->net_wm_pid; +} + +/** + * meta_window_get_client_machine: + * @window: a #MetaWindow + * + * Returns name of the client machine from which this windows was created, + * if known (obtained from the WM_CLIENT_MACHINE property). + * + * Return value: (transfer none): the machine name, or NULL; the string is + * owned by the window manager and should not be freed or modified by the + * caller. + */ +const char * +meta_window_get_client_machine (MetaWindow *window) +{ + g_return_val_if_fail (META_IS_WINDOW (window), NULL); + + return window->wm_client_machine; +} + diff --git a/src/include/window.h b/src/include/window.h index d5929fdf7..d26c9723f 100644 --- a/src/include/window.h +++ b/src/include/window.h @@ -112,5 +112,6 @@ const char *meta_window_get_title (MetaWindow *window); MetaWindow *meta_window_get_transient_for (MetaWindow *window); void meta_window_delete (MetaWindow *window, guint32 timestamp); - +int meta_window_get_pid (MetaWindow *window); +const char *meta_window_get_client_machine (MetaWindow *window); #endif