]> Dogcows Code - chaz/tint2/commitdiff
cleanup : remove unneeded title change
authorThierry Lorthiois <lorthiois@bbsoft.fr>
Sat, 23 Oct 2010 13:39:09 +0000 (13:39 +0000)
committerThierry Lorthiois <lorthiois@bbsoft.fr>
Sat, 23 Oct 2010 13:39:09 +0000 (13:39 +0000)
src/config.c
src/taskbar/task.c
src/taskbar/task.h
src/tint.c

index d2b341481e6ca9a6c1fa90772dc9c3f3b82a7bbf..2ff77f548a6122fa2ed3fcf944cb085dd03c704a 100644 (file)
@@ -457,7 +457,6 @@ void add_entry (char *key, char *value)
                panel_config.g_taskbar.background[TASKBAR_NORMAL] = &g_array_index(backgrounds, Background, id);
                if (panel_config.g_taskbar.background[TASKBAR_ACTIVE] == 0)
                        panel_config.g_taskbar.background[TASKBAR_ACTIVE] = panel_config.g_taskbar.background[TASKBAR_NORMAL];
-               //panel_config.g_taskbar.area.bg = panel_config.g_taskbar.bg;
        }
        else if (strcmp (key, "taskbar_active_background_id") == 0) {
                int id = atoi (value);
index 7a5212e794fe9191e8b240c93a11d80f07f2bf99..bdc0fde7b649c12e0333be2e801a63b63c7141c1 100644 (file)
@@ -159,12 +159,12 @@ void remove_task (Task *tsk)
 }
 
 
-void get_title(Task *tsk)
+int get_title(Task *tsk)
 {
        Panel *panel = tsk->area.panel;
        char *title, *name;
 
-       if (!panel->g_task.text && !g_tooltip.enabled) return;
+       if (!panel->g_task.text && !g_tooltip.enabled) return 0;
 
        name = server_get_property (tsk->win, server.atom._NET_WM_VISIBLE_NAME, server.atom.UTF8_STRING, 0);
        if (!name || !strlen(name)) {
@@ -184,9 +184,16 @@ void get_title(Task *tsk)
        else title[0] = 0;
        strcat(title, name);
        if (name) XFree (name);
-
-       if (tsk->title)
-               free(tsk->title);
+       
+       if (tsk->title) {
+               // check unecessary title change
+               if (strcmp(tsk->title, title) == 0) {
+                       free(title);
+                       return 0;
+               }
+               else
+                       free(tsk->title);
+       } 
 
        tsk->title = title;
        GPtrArray* task_group = task_get_tasks(tsk->win);
@@ -198,7 +205,7 @@ void get_title(Task *tsk)
                        set_task_redraw(tsk2);
                }
        }
-       set_task_redraw(tsk);
+       return 1;
 }
 
 
@@ -303,7 +310,6 @@ void get_icon (Task *tsk)
                        set_task_redraw(tsk2);
                }
        }
-       set_task_redraw(tsk);
 }
 
 
index 3de591b62ca5858286c0e7bf6ea8dac80199b850..9fe7896ffca7e5a1d654f5e7b75d5bf5a5d8e64b 100644 (file)
@@ -72,7 +72,7 @@ void draw_task (void *obj, cairo_t *c);
 void on_change_task (void *obj);
 
 void get_icon (Task *tsk);
-void get_title(Task *tsk);
+int  get_title(Task *tsk);
 void active_task();
 void set_task_state(Task* tsk, int state);
 void set_task_redraw(Task* tsk);
index b975fecf50a987dde7dc7af203efd3b806aaa630..cc12d44d963b4b67676834769df4a9f4da4180e0 100644 (file)
@@ -584,12 +584,13 @@ void event_property_notify (XEvent *e)
 
                // Window title changed
                if (at == server.atom._NET_WM_VISIBLE_NAME || at == server.atom._NET_WM_NAME || at == server.atom.WM_NAME) {
-                       get_title(tsk);
-                       if (g_tooltip.mapped && (g_tooltip.area == (Area*)tsk)) {
-                               tooltip_copy_text((Area*)tsk);
-                               tooltip_update();
+                       if (get_title(tsk)) {
+                               if (g_tooltip.mapped && (g_tooltip.area == (Area*)tsk)) {
+                                       tooltip_copy_text((Area*)tsk);
+                                       tooltip_update();
+                               }
+                               panel_refresh = 1;
                        }
-                       panel_refresh = 1;
                }
                // Demand attention
                else if (at == server.atom._NET_WM_STATE) {
This page took 0.027495 seconds and 4 git commands to generate.