Don't update hints when the title is the same. mikabox-3.4.6
authorMikael Magnusson <mikachu@comhem.se>
Tue, 18 Dec 2007 20:42:29 +0000 (21:42 +0100)
committerMikael Magnusson <mikachu@comhem.se>
Sat, 2 Feb 2008 20:50:23 +0000 (21:50 +0100)
What I really wanted was to not redraw the titlebar but that seems much harder.

openbox/client.c

index 3e571e043d09ba517af47744cb9778c101e56d9b..c12728d6a0e86b41ca9d847503d854b63cf7114f 100644 (file)
@@ -1878,8 +1878,6 @@ void client_update_title(ObClient *self)
     gchar *data = NULL;
     gchar *visible = NULL;
 
-    g_free(self->title);
-
     /* try netwm */
     if (!OBT_PROP_GETS(self->window, NET_WM_NAME, utf8, &data)) {
         /* try old x stuff */
@@ -1911,15 +1909,18 @@ void client_update_title(ObClient *self)
         g_free(data);
     }
 
-    OBT_PROP_SETS(self->window, NET_WM_VISIBLE_NAME, utf8, visible);
-    self->title = visible;
+    if (!self->title || strcmp(self->title, visible)) {
+        OBT_PROP_SETS(self->window, NET_WM_VISIBLE_NAME, utf8, visible);
+        g_free(self->title);
+        self->title = visible;
+    } else
+        g_free(visible);
 
     if (self->frame)
         frame_adjust_title(self->frame);
 
     /* update the icon title */
     data = NULL;
-    g_free(self->icon_title);
 
     /* try netwm */
     if (!OBT_PROP_GETS(self->window, NET_WM_ICON_NAME, utf8, &data))
@@ -1943,8 +1944,12 @@ void client_update_title(ObClient *self)
         g_free(data);
     }
 
-    OBT_PROP_SETS(self->window, NET_WM_VISIBLE_ICON_NAME, utf8, visible);
-    self->icon_title = visible;
+    if (!self->icon_title || strcmp(self->icon_title, visible)) {
+        OBT_PROP_SETS(self->window, NET_WM_VISIBLE_ICON_NAME, utf8, visible);
+        g_free(self->icon_title);
+        self->icon_title = visible;
+    } else
+        g_free(visible);
 }
 
 void client_update_strut(ObClient *self)