]> Dogcows Code - chaz/tint2/commitdiff
added taskbar_active_background_id to change current desktop background
authorThierry Lorthiois <lorthiois@bbsoft.fr>
Sun, 30 Aug 2009 15:40:02 +0000 (15:40 +0000)
committerThierry Lorthiois <lorthiois@bbsoft.fr>
Sun, 30 Aug 2009 15:40:02 +0000 (15:40 +0000)
ChangeLog
src/config.c
src/taskbar/taskbar.c
src/tint.c

index 235dfcd62897891e06863f60eb31220c1ece08e8..7c49eed89b9b1ecd3dea1d4687d84cbc5ed20b08 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-30
+- added taskbar_active_background_id to change current desktop background.
+  warning : this feature have a price on cpu (tint2 redraw all task) when you switch desktop.
+  comment out taskbar_active_background_id if you don't want it.
+
 2009-08-30
 - fixed issue 130 by maato
   ordered systray icon with config "systray_sort = asc/desc"
index a7d11a28645354ad66019e0c5b6f809ff33fa1bc..fce3ff98ea1cbb7fd1521049f4639ee6bb514308 100644 (file)
@@ -85,6 +85,7 @@ void init_config()
 
        panel_config = calloc(1, sizeof(Panel));
        systray.sort = 1;
+
        // window manager's menu default value == false
        wm_menu = 0;
        max_tick_urgent = 7;
@@ -476,6 +477,13 @@ void add_entry (char *key, char *value)
       memcpy(&panel_config->g_taskbar.pix.back, &a->pix.back, sizeof(Color));
       memcpy(&panel_config->g_taskbar.pix.border, &a->pix.border, sizeof(Border));
    }
+   else if (strcmp (key, "taskbar_active_background_id") == 0) {
+      int id = atoi (value);
+      Area *a = g_slist_nth_data(list_back, id);
+      memcpy(&panel_config->g_taskbar.pix_active.back, &a->pix.back, sizeof(Color));
+      memcpy(&panel_config->g_taskbar.pix_active.border, &a->pix.border, sizeof(Border));
+               panel_config->g_taskbar.use_active = 1;
+   }
 
    /* Task */
    else if (strcmp (key, "task_text") == 0)
index 5619aa8eee044cd3d5899de8865fb2e133f55d85..6fe5173aa1306eb33860aa183d1ab5877cc2fb66 100644 (file)
@@ -103,6 +103,8 @@ void init_taskbar()
                        tskbar = &panel->taskbar[j];
                        memcpy(&tskbar->area, &panel->g_taskbar, sizeof(Area));
                        tskbar->desktop = j;
+                       if (j == server.desktop && tskbar->area.use_active)
+                               tskbar->area.is_active = 1;
 
                        // add taskbar to the panel
                        panel->area.list = g_slist_append(panel->area.list, tskbar);
index 4eb8cc7cbec7380443fabd338bfd13203db8204a..a75b1b4d4117ec860665e17ac3b03e0cbb3e9973 100644 (file)
@@ -388,6 +388,35 @@ void event_property_notify (XEvent *e)
       // Change desktop
       else if (at == server.atom._NET_CURRENT_DESKTOP) {
          server.desktop = server_get_current_desktop ();
+                       for (i=0 ; i < nb_panel ; i++) {
+                          Panel *panel = &panel1[i];
+                               if (panel_mode == MULTI_DESKTOP && panel->g_taskbar.use_active) {
+                                       // redraw taskbar
+                                       panel_refresh = 1;
+                                       Taskbar *tskbar;
+                                       Task *tsk;
+                                       GSList *l;
+                                       for (j=0 ; j < panel->nb_desktop ; j++) {
+                                               tskbar = &panel->taskbar[j];
+                                               if (tskbar->area.is_active) {
+                                                       tskbar->area.is_active = 0;
+                                                       tskbar->area.redraw = 1;
+                                                       for (l = tskbar->area.list; l ; l = l->next) {
+                                                               tsk = l->data;
+                                                               tsk->area.redraw = 1;
+                                                       }
+                                               }
+                                               if (j == server.desktop) {
+                                                       tskbar->area.is_active = 1;
+                                                       tskbar->area.redraw = 1;
+                                                       for (l = tskbar->area.list; l ; l = l->next) {
+                                                               tsk = l->data;
+                                                               tsk->area.redraw = 1;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
          if (panel_mode != MULTI_DESKTOP) {
                                visible_object();
          }
This page took 0.0319 seconds and 4 git commands to generate.