]> Dogcows Code - chaz/tint2/commitdiff
panel_items : fixed change number of desktop
authorThierry Lorthiois <lorthiois@bbsoft.fr>
Sun, 19 Sep 2010 08:34:24 +0000 (08:34 +0000)
committerThierry Lorthiois <lorthiois@bbsoft.fr>
Sun, 19 Sep 2010 08:34:24 +0000 (08:34 +0000)
src/panel.c
src/panel.h
src/tint.c

index e3910157819bdda1dc609ba806f78ef6f209f4b4..2d34c573dc5a2558995d9c83d9e81ba018839358 100644 (file)
@@ -126,7 +126,7 @@ void cleanup_panel()
 
 void init_panel()
 {
-       int i;
+       int i, k;
        Panel *p;
 
        if (panel_config.monitor > (server.nb_monitor-1)) {
@@ -174,7 +174,24 @@ void init_panel()
                p->g_task.area.panel = p;
                init_panel_size_and_position(p);
                // add childs according to panel_items
-               set_panel_items(p);
+               for (k=0 ; k < strlen(panel_items_order) ; k++) {
+                       if (panel_items_order[k] == 'L') 
+                               init_launcher_panel(p);
+                       if (panel_items_order[k] == 'T')
+                               init_taskbar_panel(p);
+#ifdef ENABLE_BATTERY
+                       if (panel_items_order[k] == 'B')
+                               init_battery_panel(p);
+#endif
+                       if (panel_items_order[k] == 'S') {
+                               // TODO : check systray is only on 1 panel
+                               init_systray_panel(p);
+                               refresh_systray = 1;
+                       }
+                       if (panel_items_order[k] == 'C')
+                               init_clock_panel(p);
+               }
+               set_panel_items_order(p);
 
                // catch some events
                XSetWindowAttributes att = { .colormap=server.colormap, .background_pixel=0, .border_pixel=0 };
@@ -453,7 +470,7 @@ void update_strut(Panel* p)
 }
 
 
-void set_panel_items(Panel *p)
+void set_panel_items_order(Panel *p)
 {
        int k, j;
        
@@ -463,31 +480,22 @@ void set_panel_items(Panel *p)
        }
 
        for (k=0 ; k < strlen(panel_items_order) ; k++) {
-               if (panel_items_order[k] == 'L') {
-                       init_launcher_panel(p);
+               if (panel_items_order[k] == 'L') 
                        p->area.list = g_slist_append(p->area.list, &p->launcher);
-               }
                if (panel_items_order[k] == 'T') {
-                       init_taskbar_panel(p);
                        for (j=0 ; j < p->nb_desktop ; j++)
                                p->area.list = g_slist_append(p->area.list, &p->taskbar[j]);
                }
 #ifdef ENABLE_BATTERY
-               if (panel_items_order[k] == 'B') {
-                       init_battery_panel(p);
+               if (panel_items_order[k] == 'B') 
                        p->area.list = g_slist_append(p->area.list, &p->battery);
-               }
 #endif
                if (panel_items_order[k] == 'S') {
                        // TODO : check systray is only on 1 panel
-                       init_systray_panel(p);
-                       refresh_systray = 1;
                        p->area.list = g_slist_append(p->area.list, &systray);
                }
-               if (panel_items_order[k] == 'C') {
-                       init_clock_panel(p);
+               if (panel_items_order[k] == 'C')
                        p->area.list = g_slist_append(p->area.list, &p->clock);
-               }
        }
 }
 
index 083d0f1cf540b89388f3ae39516c9dd389175491..21e9a14c686be3d89d1919ec029dc161c2992d2f 100644 (file)
@@ -137,7 +137,7 @@ void init_panel();
 void init_panel_size_and_position(Panel *panel);
 int  resize_panel(void *obj);
 
-void set_panel_items(Panel *p);
+void set_panel_items_order(Panel *p);
 void set_panel_properties(Panel *p);
 void visible_object();
 
index 2ba8727d05297a8b5188db4e1dcb812773f27e2a..80a7dd9488592bdef3fa91c376562e9a0af11f63 100644 (file)
@@ -487,11 +487,13 @@ void event_property_notify (XEvent *e)
 
                // Change number of desktops
                else if (at == server.atom._NET_NUMBER_OF_DESKTOPS) {
+                       if (!taskbar_enabled) return;
                        server.nb_desktop = server_get_number_of_desktop ();
                        cleanup_taskbar();
                        init_taskbar();
                        for (i=0 ; i < nb_panel ; i++) {
-                               set_panel_items(&panel1[i]);
+                               init_taskbar_panel(&panel1[i]);
+                               set_panel_items_order(&panel1[i]);
                                panel1[i].area.resize = 1;
                        }
                        visible_object();
@@ -501,6 +503,7 @@ void event_property_notify (XEvent *e)
                }
                // Change desktop
                else if (at == server.atom._NET_CURRENT_DESKTOP) {
+                       if (!taskbar_enabled) return;
                        int old_desktop = server.desktop;
                        server.desktop = server_get_current_desktop ();
                        for (i=0 ; i < nb_panel ; i++) {
This page took 0.029855 seconds and 4 git commands to generate.