[mutter] Accessors for pid and name of client machine associated with MetaWindow



commit 8b7b41df419aca7f5471c64432dd80ea4eedbcb1
Author: Tomas Frydrych <tf linux intel com>
Date:   Fri Jul 31 18:52:25 2009 +0100

    Accessors for pid and name of client machine associated with MetaWindow
    
    http://bugzilla.gnome.org/show_bug.cgi?id=590388

 src/core/window.c    |   37 +++++++++++++++++++++++++++++++++++++
 src/include/window.h |    3 ++-
 2 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index 6f62e0c..168ca0e 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 d5929fd..d26c972 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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]