little cleanup

git-svn-id: http://tint2.googlecode.com/svn/trunk@440 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
thilor77 2010-04-23 14:37:39 +00:00
parent 885377a234
commit b99b5c6b8a
5 changed files with 16 additions and 18 deletions

View 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);
}

View 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;

View 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;
}
}

View 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];

View 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