]> Dogcows Code - chaz/tint2/blobdiff - src/tint.c
fixed switch between config with killall -SIGUSR1 tint2
[chaz/tint2] / src / tint.c
index 260d93cdecdb610c9e448ca0b8c7570b2d47d285..3eebf88dfe2cb5bf3f670b8949abfcd7dc8479ea 100644 (file)
@@ -115,6 +115,10 @@ void init (int argc, char *argv[])
                        default_icon = imlib_load_image(path);
                g_free(path);
        }
+
+       // get monitor and desktop config
+       get_monitors();
+       get_desktops();
 }
 
 
@@ -636,33 +640,8 @@ void event_configure_notify (Window win)
 {
        // change in root window (xrandr)
        if (win == server.root_win) {
-               int i, old_nb_panel = nb_panel;
-
                get_monitors();
-               if (panel_config.monitor >= 0)
-                       nb_panel = 1;
-               else
-                       nb_panel = server.nb_monitor;
-
-               if (old_nb_panel != nb_panel) {
-                       // changed number of panel
-                       printf("changed number of panel\n");
-                       //realloc(panel1, nb_panel * sizeof(Panel));
-               }
-               for (i=0 ; i < nb_panel && i < old_nb_panel ; i++) {
-                       Panel *panel = &panel1[i];
-
-                       init_panel_size_and_position(panel);
-                       XMoveResizeWindow(server.dsp, panel->main_win, panel->posx, panel->posy, panel->area.width, panel->area.height);
-                       set_panel_background(panel);
-
-                       // force the resize of childs
-                       GSList *l0;
-                       panel->area.resize = 1;
-                       for (l0 = panel->area.list; l0 ; l0 = l0->next)
-                               ((Area*)l0->data)->resize = 1;
-               }
-               panel_refresh = 1;
+               init_panel();
                return;
        }
 
@@ -884,9 +863,13 @@ int main (int argc, char *argv[])
                event_timer();
 
                switch (signal_pending) {
-                       case SIGUSR1:
+                       case SIGUSR1: // reload config file
                                signal_pending = 0;
-                               return 0;
+                               init_config();
+                               config_read_file (config_path);
+                               init_panel();
+                               cleanup_config();
+                               break;
                        case SIGINT:
                        case SIGTERM:
                        case SIGHUP:
This page took 0.021273 seconds and 4 git commands to generate.