merge r5829,r5830 to 3.4-working
authorMikael Magnusson <mikachu@comhem.se>
Mon, 23 Apr 2007 19:10:45 +0000 (19:10 +0000)
committerMikael Magnusson <mikachu@comhem.se>
Mon, 23 Apr 2007 19:10:45 +0000 (19:10 +0000)
openbox/client.c
openbox/client.h
openbox/prop.c
openbox/prop.h

index 76db97bc82b0da54721fe384e795f9123796b6d2..8e7914029b9d26c8ab507bdea07312a72735c2c9 100644 (file)
 #include "mouse.h"
 #include "render/render.h"
 
+#ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
+
 #include <glib.h>
 #include <X11/Xutil.h>
 
@@ -70,6 +74,7 @@ static void client_get_layer(ObClient *self);
 static void client_get_shaped(ObClient *self);
 static void client_get_mwm_hints(ObClient *self);
 static void client_get_gravity(ObClient *self);
+static void client_get_client_machine(ObClient *self);
 static void client_change_allowed_actions(ObClient *self);
 static void client_change_state(ObClient *self);
 static void client_change_wm_state(ObClient *self);
@@ -625,6 +630,7 @@ void client_unmanage(ObClient *self)
     g_free(self->name);
     g_free(self->class);
     g_free(self->role);
+    g_free(self->client_machine);
     g_free(self->sm_client_id);
     g_free(self);
      
@@ -934,6 +940,7 @@ static void client_get_all(ObClient *self)
        (min/max sizes), so we're ready to set up the decorations/functions */
     client_setup_decor_and_functions(self);
   
+    client_get_client_machine(self);
     client_update_title(self);
     client_update_class(self);
     client_update_sm_client_id(self);
@@ -1642,6 +1649,7 @@ void client_update_wmhints(ObClient *self)
 void client_update_title(ObClient *self)
 {
     gchar *data = NULL;
+    gchar *visible = NULL;
 
     g_free(self->title);
      
@@ -1661,8 +1669,14 @@ void client_update_title(ObClient *self)
         }
     }
 
-    PROP_SETS(self->window, net_wm_visible_name, data);
-    self->title = data;
+    if (self->client_machine) {
+        visible = g_strdup_printf("%s (%s)", data, self->client_machine);
+        g_free(data);
+    } else
+        visible = data;
+
+    PROP_SETS(self->window, net_wm_visible_name, visible);
+    self->title = visible;
 
     if (self->frame)
         frame_adjust_title(self->frame);
@@ -1861,6 +1875,21 @@ void client_update_user_time(ObClient *self)
     }
 }
 
+static void client_get_client_machine(ObClient *self)
+{
+    gchar *data = NULL;
+    gchar localhost[128];
+
+    g_free(self->client_machine);
+
+    if (PROP_GETS(self->window, wm_client_machine, locale, &data)) {
+        gethostname(localhost, 127);
+        localhost[127] = '\0';
+        if (strcmp(localhost, data))
+            self->client_machine = data;
+    }
+}
+
 static void client_change_wm_state(ObClient *self)
 {
     gulong state[2];
index 90c6c059d2e82f35856a5c4d04aa72d003e59965..38722f421b79824c79ac9721dfaa01e50e80b97f 100644 (file)
@@ -116,6 +116,8 @@ struct _ObClient
     gchar *title;
     /*! Window title when iconified */
     gchar *icon_title;
+    /*! Hostname of machine running the client */
+    gchar *client_machine;
 
     /*! The application that created the window */
     gchar *name;
index b3c65d31fc05fe5c0f4c8c885f32068c4d73465e..655fd07b9b8cb02903698d0b9072116972dbc606 100644 (file)
@@ -48,6 +48,7 @@ void prop_startup()
     CREATE(wm_icon_name, "WM_ICON_NAME");
     CREATE(wm_class, "WM_CLASS");
     CREATE(wm_window_role, "WM_WINDOW_ROLE");
+    CREATE(wm_client_machine, "WM_CLIENT_MACHINE");
     CREATE(motif_wm_hints, "_MOTIF_WM_HINTS");
 
     CREATE(sm_client_id, "SM_CLIENT_ID");
index 386b7a8a13185036f6c036a17e68fffd4b2e939a..1d3445f822049a6cb540edd41f6f3e7f273e835c 100644 (file)
@@ -50,6 +50,7 @@ typedef struct Atoms {
     Atom wm_icon_name;
     Atom wm_class;
     Atom wm_window_role;
+    Atom wm_client_machine;
     Atom motif_wm_hints;
 
     /* SM atoms */