]> Dogcows Code - chaz/tint2/commitdiff
little cleanup
authorThierry Lorthiois <lorthiois@bbsoft.fr>
Fri, 23 Apr 2010 14:37:39 +0000 (14:37 +0000)
committerThierry Lorthiois <lorthiois@bbsoft.fr>
Fri, 23 Apr 2010 14:37:39 +0000 (14:37 +0000)
src/panel.c
src/panel.h
src/server.c
src/taskbar/taskbar.c
src/taskbar/taskbar.h

index 0cf58187fc006507f33d775ad078d2d4ede68ff0..6c6a4625b66fc6efb17386dcda670eb98c0a4ce5 100644 (file)
@@ -59,8 +59,6 @@ int panel_autohide_hide_timeout;
 int panel_autohide_height;
 int panel_strut_policy;
 
-Task *task_active;
-Task *task_drag;
 int  max_tick_urgent;
 
 // panel's initial config
@@ -83,8 +81,6 @@ void default_panel()
        panel1 = 0;
        nb_panel = 0;
        default_icon = NULL;
-       task_active = 0;
-       task_drag = 0;
        task_dragged = 0;
        panel_horizontal = 1;
        panel_position = CENTER;
@@ -125,7 +121,8 @@ void cleanup_panel()
        }
 
        if (panel1) free(panel1);
-       if (backgrounds) g_array_free(backgrounds, 1);
+       if (backgrounds)
+               g_array_free(backgrounds, 1);
        if (panel_config.g_task.font_desc) pango_font_description_free(panel_config.g_task.font_desc);
 }
 
index 257563a2528dca4963b055847beacf523bc9e0cd..765b5f19e728b2ea7785638f624d7f3136b9a993 100644 (file)
@@ -59,8 +59,6 @@ extern int panel_autohide_hide_timeout;
 extern int panel_autohide_height;  // for vertical panels this is of course the width
 extern int panel_strut_policy;
 
-extern Task *task_active;
-extern Task *task_drag;
 extern int  max_tick_urgent;
 
 extern GArray* backgrounds;
index 20e8095df15a90a3f875f9c3b47e47a9bc83304f..d30b10906ffbb119dc28054ab02e233af8dfd7e5 100644 (file)
@@ -104,7 +104,8 @@ void cleanup_server()
        if (server.monitor) {
                int i;
                for (i=0; i<server.nb_monitor; ++i)
-                       g_strfreev(server.monitor[i].names);
+                       if (server.monitor[i].names)
+                               g_strfreev(server.monitor[i].names);
                free(server.monitor);
        }
        if (server.gc) XFreeGC(server.dsp, server.gc);
@@ -247,15 +248,6 @@ int compareMonitorIncluded(const void *monitor1, const void *monitor2)
 
 void get_monitors()
 {
-       if (server.monitor) {
-               int i;
-               for (i=0; i<server.nb_monitor; ++i)
-                       g_strfreev(server.monitor[i].names);
-               free(server.monitor);
-       }
-       server.nb_monitor = 0;
-       server.monitor = 0;
-
        int i, j, nbmonitor;
        if (XineramaIsActive(server.dsp)) {
                XineramaScreenInfo *info = XineramaQueryScreens(server.dsp, &nbmonitor);
@@ -309,7 +301,8 @@ void get_monitors()
                }
 next:
                for (j=i; j<server.nb_monitor; ++j)
-                       g_strfreev(server.monitor[j].names);
+                       if (server.monitor[j].names)
+                               g_strfreev(server.monitor[j].names);
                server.nb_monitor = i;
                server.monitor = realloc(server.monitor, server.nb_monitor * sizeof(Monitor));
                qsort(server.monitor, server.nb_monitor, sizeof(Monitor), compareMonitorPos);
@@ -324,6 +317,7 @@ next:
                server.monitor[0].x = server.monitor[0].y = 0;
                server.monitor[0].width = DisplayWidth (server.dsp, server.screen);
                server.monitor[0].height = DisplayHeight (server.dsp, server.screen);
+               server.monitor[0].names = 0;
        }
 }
 
index c89d3a66d0e487db56633112d27dd140f02b2c4e..ab6b11d3f029fdf3a7a3354b01a84f9002263d43 100644 (file)
@@ -39,6 +39,9 @@
 */
 GHashTable* win_to_task_table;
 
+Task *task_active;
+Task *task_drag;
+
 guint win_hash(gconstpointer key) { return (guint)*((Window*)key); }
 gboolean win_compare(gconstpointer a, gconstpointer b) { return (*((Window*)a) == *((Window*)b)); }
 void free_ptr_array(gpointer data) { g_ptr_array_free(data, 1); }
@@ -51,6 +54,9 @@ void init_taskbar()
        if (win_to_task_table == 0)
                win_to_task_table = g_hash_table_new_full(win_hash, win_compare, free, free_ptr_array);
 
+       task_active = 0;
+       task_drag = 0;
+
        for (i=0 ; i < nb_panel ; i++) {
                panel = &panel1[i];
 
index e2c55bb448cc9f1f071ecfa684e3245a190c4ad1..3474825d02b959a6a828527fb1d0d745ddf6658d 100644 (file)
@@ -11,6 +11,9 @@
 #include "task.h"
 
 extern GHashTable* win_to_task_table;
+extern Task *task_active;
+extern Task *task_drag;
+
 // tint2 use one taskbar per desktop.
 typedef struct {
        // always start with area
This page took 0.029246 seconds and 4 git commands to generate.