]> Dogcows Code - chaz/tint2/commitdiff
moved initial values in function default_xxx
authorThierry Lorthiois <lorthiois@bbsoft.fr>
Sun, 18 Apr 2010 12:07:36 +0000 (12:07 +0000)
committerThierry Lorthiois <lorthiois@bbsoft.fr>
Sun, 18 Apr 2010 12:07:36 +0000 (12:07 +0000)
21 files changed:
src/battery/battery.c
src/battery/battery.h
src/clock/clock.c
src/clock/clock.h
src/config.c
src/config.h
src/panel.c
src/server.c
src/server.h
src/systray/systraybar.c
src/systray/systraybar.h
src/taskbar/task.c
src/taskbar/task.h
src/taskbar/taskbar.c
src/taskbar/taskbar.h
src/tint.c
src/tooltip/tooltip.c
src/tooltip/tooltip.h
src/util/area.c
src/util/timer.c
src/util/timer.h

index 9124e1648ac148a0177d1a8ce7515253d7f857e1..82aabab322edd9db41d9945a19c119e15537db13 100644 (file)
 #include "clock.h"
 #include "timer.h"
 
-PangoFontDescription *bat1_font_desc=0;
-PangoFontDescription *bat2_font_desc=0;
+PangoFontDescription *bat1_font_desc;
+PangoFontDescription *bat2_font_desc;
 struct batstate battery_state;
 int battery_enabled;
 int percentage_hide;
-static timeout* battery_timeout=0;
+static timeout* battery_timeout;
 
 static char buf_bat_percentage[10];
 static char buf_bat_time[20];
 
 int8_t battery_low_status;
 unsigned char battery_low_cmd_send;
-char *battery_low_cmd=0;
-char *path_energy_now=0;
-char *path_energy_full=0;
-char *path_current_now=0;
-char *path_status=0;
+char *battery_low_cmd;
+char *path_energy_now;
+char *path_energy_full;
+char *path_current_now;
+char *path_status;
 
 void update_batterys(void* arg)
 {
@@ -77,6 +77,32 @@ void update_batterys(void* arg)
        }
 }
 
+void default_battery()
+{
+       battery_enabled = 0;
+       percentage_hide = 101;
+       battery_low_cmd_send = 0;
+       battery_timeout = 0;
+       bat1_font_desc = 0;
+       bat2_font_desc = 0;
+       battery_low_cmd = 0;
+       path_energy_now = 0;
+       path_energy_full = 0;
+       path_current_now = 0;
+       path_status = 0;
+}
+
+void cleanup_battery()
+{
+       if (bat1_font_desc) pango_font_description_free(bat1_font_desc);
+       if (bat2_font_desc) pango_font_description_free(bat2_font_desc);
+       if (path_energy_now) g_free(path_energy_now);
+       if (path_energy_full) g_free(path_energy_full);
+       if (path_current_now) g_free(path_current_now);
+       if (path_status) g_free(path_status);
+       if (battery_low_cmd) g_free(battery_low_cmd);
+}
+
 
 void init_battery()
 {
@@ -156,43 +182,6 @@ void init_battery()
 }
 
 
-void cleanup_battery()
-{
-       battery_enabled = 0;
-       percentage_hide = 101;
-       battery_low_cmd_send = 0;
-
-       if (bat1_font_desc) {
-               pango_font_description_free(bat1_font_desc);
-               bat1_font_desc = 0;
-       }
-       if (bat2_font_desc) {
-               pango_font_description_free(bat2_font_desc);
-               bat2_font_desc = 0;
-       }
-       if (path_energy_now) {
-               g_free(path_energy_now);
-               path_energy_now = 0;
-       }
-       if (path_energy_full) {
-               g_free(path_energy_full);
-               path_energy_full = 0;
-       }
-       if (path_current_now) {
-               g_free(path_current_now);
-               path_current_now = 0;
-       }
-       if (path_status) {
-               g_free(path_status);
-               path_status = 0;
-       }
-       if (battery_low_cmd) {
-               g_free(battery_low_cmd);
-               battery_low_cmd = 0;
-       }
-}
-
-
 void init_battery_panel(void *p)
 {
        Panel *panel = (Panel*)p;
index 2e99abdc9545a2b89d26ecff0c58c79e5e72f5f0..65a8a1eb17702231b42f8d0e2dc449733b4f2c45 100644 (file)
@@ -57,6 +57,10 @@ extern int8_t battery_low_status;
 extern char *battery_low_cmd;
 extern char *path_energy_now, *path_energy_full, *path_current_now, *path_status;
 
+// default values
+void default_battery();
+// freed memory
+void cleanup_battery();
 
 // initialize clock : y position, ...
 void update_battery();
@@ -64,9 +68,6 @@ void update_battery();
 void init_battery();
 void init_battery_panel(void *panel);
 
-// freed memory and set default values
-void cleanup_battery();
-
 void draw_battery(void *obj, cairo_t *c);
 
 void resize_battery(void *obj);
index d020c5269fb33109494cd6a412d311d3fe238720..273fb818e17991089c391a52a85d1b9dc5ea9924 100644 (file)
 #include "timer.h"
 
 
-char *time1_format=0;
-char *time1_timezone=0;
-char *time2_format=0;
-char *time2_timezone=0;
-char *time_tooltip_format=0;
-char *time_tooltip_timezone=0;
-char *clock_lclick_command=0;
-char *clock_rclick_command=0;
+char *time1_format;
+char *time1_timezone;
+char *time2_format;
+char *time2_timezone;
+char *time_tooltip_format;
+char *time_tooltip_timezone;
+char *clock_lclick_command;
+char *clock_rclick_command;
 struct timeval time_clock;
-PangoFontDescription *time1_font_desc=0;
-PangoFontDescription *time2_font_desc=0;
+PangoFontDescription *time1_font_desc;
+PangoFontDescription *time2_font_desc;
 static char buf_time[40];
 static char buf_date[40];
 static char buf_tooltip[40];
 int clock_enabled;
-static timeout* clock_timeout=0;
+static timeout* clock_timeout;
+
+
+void default_clock()
+{
+       clock_enabled = 0;
+       clock_timeout = 0;
+       time1_format = 0;
+       time1_timezone = 0;
+       time2_format = 0;
+       time2_timezone = 0;
+       time_tooltip_format = 0;
+       time_tooltip_timezone = 0;
+       clock_lclick_command = 0;
+       clock_rclick_command = 0;
+       time1_font_desc = 0;
+       time2_font_desc = 0;
+}
+
+void cleanup_clock()
+{
+       if (time1_font_desc) pango_font_description_free(time1_font_desc);
+       if (time2_font_desc) pango_font_description_free(time2_font_desc);
+       if (time1_format) g_free(time1_format);
+       if (time2_format) g_free(time2_format);
+       if (time_tooltip_format) g_free(time_tooltip_format);
+       if (time1_timezone) g_free(time1_timezone);
+       if (time2_timezone) g_free(time2_timezone);
+       if (time_tooltip_timezone) g_free(time_tooltip_timezone);
+       if (clock_lclick_command) g_free(clock_lclick_command);
+       if (clock_rclick_command) g_free(clock_rclick_command);
+}
 
 
 void update_clocks_sec(void* arg)
@@ -160,52 +191,6 @@ void init_clock_panel(void *p)
 }
 
 
-void cleanup_clock()
-{
-       clock_enabled = 0;
-       if (time1_font_desc) {
-               pango_font_description_free(time1_font_desc);
-               time1_font_desc = 0;
-       }
-       if (time2_font_desc) {
-               pango_font_description_free(time2_font_desc);
-               time2_font_desc = 0;
-       }
-       if (time1_format) {
-               g_free(time1_format);
-               time1_format = 0;
-       }
-       if (time2_format) {
-               g_free(time2_format);
-               time2_format = 0;
-       }
-       if (time_tooltip_format) {
-               g_free(time_tooltip_format);
-               time_tooltip_format = 0;
-       }
-       if (time1_timezone) {
-               g_free(time1_timezone);
-               time1_timezone = 0;
-       }
-       if (time2_timezone) {
-               g_free(time2_timezone);
-               time2_timezone = 0;
-       }
-       if (time_tooltip_timezone) {
-               g_free(time_tooltip_timezone);
-               time_tooltip_timezone = 0;
-       }
-       if (clock_lclick_command) {
-               g_free(clock_lclick_command);
-               clock_lclick_command = 0;
-       }
-       if (clock_rclick_command) {
-               g_free(clock_rclick_command);
-               clock_rclick_command = 0;
-       }
-}
-
-
 void draw_clock (void *obj, cairo_t *c)
 {
        Clock *clock = obj;
index e86cbf6a9ee90ec450211c65407fc67dd4c2a47b..4db15c31614185518bb6acde84401eee4fc4a268 100644 (file)
@@ -37,13 +37,15 @@ extern char *clock_rclick_command;
 extern int clock_enabled;
 
 
+// default values
+void default_clock();
+// freed memory
+void cleanup_clock();
+
 // initialize clock : y position, precision, ...
 void init_clock();
 void init_clock_panel(void *panel);
 
-// freed memory and set default values
-void cleanup_clock();
-
 void draw_clock (void *obj, cairo_t *c);
 
 void resize_clock (void *obj);
index 30aa6e122f700d614d63b93501ddb58f2f9768aa..cc8cb5587ee50c50efe202954c0d72c3f840f08d 100644 (file)
@@ -52,8 +52,8 @@
 #endif
 
 // global path
-char *config_path = 0;
-char *snapshot_path = 0;
+char *config_path;
+char *snapshot_path;
 
 // --------------------------------------------------
 // backward compatibility
@@ -63,6 +63,20 @@ static int old_task_icon_size;
 static int old_config_file;
 
 
+void default_config()
+{
+       config_path = 0;
+       snapshot_path = 0;
+       old_config_file = 1;
+}
+
+void cleanup_config()
+{
+       if (config_path) g_free(config_path);
+       if (snapshot_path) g_free(snapshot_path);
+}
+
+
 void init_config()
 {
        if (backgrounds)
@@ -88,9 +102,6 @@ printf("*** init_config()\n");
                pango_font_description_free(panel_config.g_task.font_desc);
        }
        memset(&panel_config, 0, sizeof(Panel));
-       systray.alpha = 100;
-       systray.sort = 3;
-       old_config_file = 1;
 
        // window manager's menu default value == false
        wm_menu = 0;
@@ -103,11 +114,6 @@ printf("*** init_config()\n");
 }
 
 
-void cleanup_config()
-{
-}
-
-
 void extract_values (const char *value, char **value1, char **value2, char **value3)
 {
        char *b=0, *c=0;
index c472f1959cf033d67a40b9581c085fa2f87c590a..68bf8a0f8d73cf3eb0f12f92ee41f99c8ce3518d 100644 (file)
 extern char *config_path;
 extern char *snapshot_path;
 
-void init_config();
+// default values
+void default_config();
+// freed memory
 void cleanup_config();
+
+void init_config();
 int  config_read_file (const char *path);
 int  config_read ();
 
index 203e818231b16d0e5d1b14c1aa38bb6b67639c03..66fc90e6711676642b778f983d97ffd69c9748ab 100644 (file)
@@ -288,6 +288,7 @@ void cleanup_panel()
 {
        if (!panel1) return;
 
+printf("*** cleanup_panel()\n");
        task_active = 0;
        task_drag = 0;
 
@@ -568,7 +569,7 @@ void set_panel_background(Panel *p)
        else if (!panel_horizontal && panel_position & RIGHT)
                xoff = p->area.width-p->hidden_width;
 
-       if (real_transparency) {
+       if (server.real_transparency) {
                clear_pixmap(p->area.pix, 0, 0, p->area.width, p->area.height);
        }
        else {
index 118311c31f494611bb6cbffb9779a3d967a0babf..20e8095df15a90a3f875f9c3b47e47a9bc83304f 100644 (file)
@@ -33,8 +33,6 @@
 
 void server_catch_error (Display *d, XErrorEvent *ev){}
 
-int real_transparency = 0;
-
 void server_init_atoms ()
 {
        server.atom._XROOTPMAP_ID = XInternAtom (server.dsp, "_XROOTPMAP_ID", False);
@@ -96,10 +94,6 @@ void server_init_atoms ()
        server.atom.XdndAware = XInternAtom(server.dsp, "XdndAware", False);
        server.atom.XdndPosition = XInternAtom(server.dsp, "XdndPosition", False);
        server.atom.XdndStatus = XInternAtom(server.dsp, "XdndStatus", False);
-
-       server.colormap = 0;
-       server.monitor = 0;
-       server.gc = 0;
 }
 
 
@@ -391,7 +385,7 @@ void server_init_visual()
                attrs.event_mask = StructureNotifyMask;
                XChangeWindowAttributes (server.dsp, server.composite_manager, CWEventMask, &attrs);
 
-               real_transparency = 1;
+               server.real_transparency = 1;
                server.depth = 32;
                printf("real transparency on... depth: %d\n", server.depth);
                server.colormap = XCreateColormap(server.dsp, server.root_win, visual, AllocNone);
@@ -399,7 +393,7 @@ void server_init_visual()
        }
        else {
                // no composite manager or snapshot mode => fake transparency
-               real_transparency = 0;
+               server.real_transparency = 0;
                server.depth = DefaultDepth(server.dsp, server.screen);
                printf("real transparency off.... depth: %d\n", server.depth);
                server.colormap = DefaultColormap(server.dsp, server.screen);
index cc6ffeea9aaf74b8d6ed4f752eb1225ac45a4eb4..83501c79299682b23bd7c3d5ad5bd17482142393 100644 (file)
@@ -13,7 +13,7 @@
 #include <X11/Xatom.h>
 #include <X11/extensions/Xinerama.h>
 
-extern int real_transparency;
+
 typedef struct Global_atom
 {
        Atom _XROOTPMAP_ID;
@@ -87,6 +87,7 @@ typedef struct
        Display *dsp;
        Window root_win;
        Window composite_manager;
+       int real_transparency;
        // current desktop
        int desktop;
        int screen;
@@ -110,6 +111,9 @@ typedef struct
 Server_global server;
 
 
+// freed memory
+void cleanup_server();
+
 void send_event32 (Window win, Atom at, long data1, long data2, long data3);
 int  get_property32 (Window win, Atom at, Atom type);
 void *server_get_property (Window win, Atom at, Atom type, int *num_results);
@@ -117,7 +121,6 @@ Atom server_get_atom (char *atom_name);
 void server_catch_error (Display *d, XErrorEvent *ev);
 void server_init_atoms ();
 void server_init_visual();
-void cleanup_server();
 
 // detect root background
 void get_root_pixmap();
index 89e5fee029ba76a9ca5d1c96c393ffe93db50863..81eba8f8edac0920c59af99d463b5a6c57bba1f4 100644 (file)
@@ -51,9 +51,32 @@ int systray_enabled;
 int systray_max_icon_size;
 
 // background pixmap if we render ourselves the icons
-static Pixmap render_background = 0;
+static Pixmap render_background;
 
 
+void default_systray()
+{
+printf("*** default_systray()\n");
+       memset(&systray, 0, sizeof(Systraybar));
+       render_background = 0;
+       systray.alpha = 100;
+       systray.sort = 3;
+       systray.area._draw_foreground = draw_systray;
+       systray.area._resize = resize_systray;
+}
+
+void cleanup_systray()
+{
+       systray_enabled = 0;
+       systray_max_icon_size = 0;
+       systray.area.on_screen = 0;
+       free_area(&systray.area);
+       if (render_background) {
+               XFreePixmap(server.dsp, render_background);
+               render_background = 0;
+       }
+}
+
 void init_systray()
 {
        start_net();
@@ -66,8 +89,6 @@ void init_systray()
                systray.alpha = 100;
                systray.brightness = systray.saturation = 0;
        }
-       systray.area._draw_foreground = draw_systray;
-       systray.area._resize = resize_systray;
        systray.area.resize = 1;
        systray.area.redraw = 1;
        systray.area.on_screen = 1;
@@ -92,22 +113,9 @@ void init_systray_panel(void *p)
 }
 
 
-void cleanup_systray()
-{
-       systray_enabled = 0;
-       systray_max_icon_size = 0;
-       systray.area.on_screen = 0;
-       free_area(&systray.area);
-       if (render_background) {
-               XFreePixmap(server.dsp, render_background);
-               render_background = 0;
-       }
-}
-
-
 void draw_systray(void *obj, cairo_t *c)
 {
-       if (real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
+       if (server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
                if (render_background) XFreePixmap(server.dsp, render_background);
                render_background = XCreatePixmap(server.dsp, server.root_win, systray.area.width, systray.area.height, server.depth);
                XCopyArea(server.dsp, systray.area.pix, render_background, server.gc, 0, 0, systray.area.width, systray.area.height, 0, 0);
@@ -446,7 +454,7 @@ gboolean add_icon(Window id)
 
        // watch for the icon trying to resize itself!
        XSelectInput(server.dsp, traywin->tray_id, StructureNotifyMask);
-       if (real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
+       if (server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
                traywin->damage = XDamageCreate(server.dsp, traywin->id, XDamageReportRawRectangles);
                XCompositeRedirectWindow(server.dsp, traywin->id, CompositeRedirectManual);
        }
@@ -550,7 +558,7 @@ void systray_render_icon_now(void* t)
                return;
        }
        Picture pict_image;
-       if (real_transparency)
+       if (server.real_transparency)
                pict_image = XRenderCreatePicture(server.dsp, traywin->id, f, 0, 0);
        else
                pict_image = XRenderCreatePicture(server.dsp, traywin->tray_id, f, 0, 0);
@@ -592,7 +600,7 @@ void systray_render_icon_now(void* t)
 
 void systray_render_icon(TrayWindow* traywin)
 {
-       if (real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
+       if (server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
                // wine tray icons update whenever mouse is over them, so we limit the updates to 50 ms
                if (traywin->render_timeout == 0)
                        traywin->render_timeout = add_timeout(50, 0, systray_render_icon_now, traywin);
index d18d12eea34921e89acfce4bc0786f20f8568cfd..631e59864c9ed80514194ba782fd1a2e0b1e8d5d 100644 (file)
@@ -52,13 +52,15 @@ extern int refresh_systray;
 extern int systray_enabled;
 extern int systray_max_icon_size;
 
-void init_systray();
+// default values
+void default_systray();
+// freed memory
+void cleanup_systray();
 
+// initialize protocol and panel position
+void init_systray();
 void init_systray_panel(void *p);
 
-// freed memory and set default values
-void cleanup_systray();
-
 void draw_systray(void *obj, cairo_t *c);
 void resize_systray(void *obj);
 
index 92a6ff80a365a0ed3b47f745fc692b94e9075c4a..d0b247f3cd67df00eed39c72e62d7aa933940e54 100644 (file)
@@ -35,8 +35,8 @@
 #include "tooltip.h"
 #include "timer.h"
 
-static timeout* urgent_timeout = 0;
-static GSList* urgent_list = 0;
+timeout* urgent_timeout;
+GSList* urgent_list;
 
 const char* task_get_tooltip(void* obj)
 {
@@ -325,7 +325,7 @@ void draw_task_icon (Task *tsk, int text_width)
 
        // Render
        imlib_context_set_image (tsk->icon[tsk->current_state]);
-       if (real_transparency) {
+       if (server.real_transparency) {
                render_image(tsk->area.pix, pos_x, panel->g_task.icon_posy, imlib_image_get_width(), imlib_image_get_height() );
        }
        else {
index 9e637588dc94d9da5cbd5c767b1978002ae2d1ff..d519de1c23126d5f14cc63f606971fd614df7694 100644 (file)
 #include <pango/pangocairo.h>
 #include <Imlib2.h>
 #include "common.h"
+#include "timer.h"
 
 
 enum { TASK_NORMAL, TASK_ACTIVE, TASK_ICONIFIED, TASK_URGENT, TASK_STATE_COUNT };
+extern timeout* urgent_timeout;
+extern GSList* urgent_list;
 
 // --------------------------------------------------
 // global task parameter
index 38d1f09d29ab2dd4ca731adf6d6e36c21b048d3f..34f49b0a52accebe6e2230d33376c04b930c4ea3 100644 (file)
@@ -37,7 +37,7 @@
    element. However for omnipresent windows (windows which are visible in every taskbar) the array
    contains to every Task* on each panel a pointer (i.e. GPtrArray.len == server.nb_desktop)
 */
-GHashTable* win_to_task_table = 0;
+GHashTable* win_to_task_table;
 
 guint win_hash(gconstpointer key) { return (guint)*((Window*)key); }
 gboolean win_compare(gconstpointer a, gconstpointer b) { return (*((Window*)a) == *((Window*)b)); }
@@ -171,6 +171,13 @@ void taskbar_remove_task(gpointer key, gpointer value, gpointer user_data)
        remove_task(task_get_task(*(Window*)key));
 }
 
+void default_taskbar()
+{
+       win_to_task_table = 0;
+       urgent_timeout = 0;
+       urgent_list = 0;
+}
+
 void cleanup_taskbar()
 {
        Panel *panel;
index 25a8dd167716908fa64cbd3a14093e923a429f55..a04060c857cb7fa0bcd144760a697a3dda3d0e9c 100644 (file)
@@ -33,11 +33,14 @@ typedef struct {
        int use_active;
 } Global_taskbar;
 
-void init_taskbar();
 
-// freed memory and set default values
+// default values
+void default_taskbar();
+// freed memory
 void cleanup_taskbar();
 
+void init_taskbar();
+
 Task *task_get_task (Window win);
 GPtrArray* task_get_tasks(Window win);
 void task_refresh_tasklist ();
index b0152c63434e7ea74d0ef2b9cb8eab924f059ffd..35141b06829593afece63cfed2a2b55b03c5960b 100644 (file)
@@ -42,6 +42,7 @@
 #include "tooltip.h"
 #include "timer.h"
 
+
 void signal_handler(int sig)
 {
        // signal handler is light as it should be
@@ -53,6 +54,16 @@ void init (int argc, char *argv[])
 {
        int i;
 
+       // set global data
+       default_timeout();
+       default_systray();
+       memset(&server, 0, sizeof(Server_global));
+       default_battery();
+       default_clock();
+       default_taskbar();
+       default_tooltip();
+       default_config();
+
        // read options
        for (i = 1; i < argc; ++i) {
                if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help"))       {
@@ -91,10 +102,6 @@ void init (int argc, char *argv[])
 //     sigaddset(&block_mask, SIGHUP);
 //     sigaddset(&block_mask, SIGUSR1);
 //     sigprocmask(SIG_BLOCK, &block_mask, 0);
-
-       // set global data
-       memset(&server, 0, sizeof(Server_global));
-       memset(&systray, 0, sizeof(Systraybar));
 }
 
 void init_X11()
@@ -140,7 +147,8 @@ void init_X11()
 
 void cleanup()
 {
-       stop_all_timeouts();
+printf("*** cleanup()\n");
+       cleanup_timeout();
        cleanup_systray();
        stop_net();
        cleanup_panel();
@@ -149,13 +157,12 @@ void cleanup()
 #ifdef ENABLE_BATTERY
        cleanup_battery();
 #endif
+       cleanup_config();
 
        if (default_icon) {
                imlib_context_set_image(default_icon);
                imlib_free_image();
        }
-       if (config_path) g_free(config_path);
-       if (snapshot_path) g_free(snapshot_path);
 
        cleanup_server();
        if (server.dsp) XCloseDisplay(server.dsp);
index f94e08b8d06d77cd6ed6519eced8638b0c9b894e..a724473c397cf4b7cc5ecda5cb8a0c56f65110a9 100644 (file)
@@ -34,23 +34,29 @@ void start_show_timeout();
 void start_hide_timeout();
 void stop_tooltip_timeout();
 
-// give the tooltip some reasonable default values
-Tooltip g_tooltip = {
-       .tooltip_text = 0,
-       .area = 0,
-       .panel = 0,
-       .window = 0,
-       .show_timeout_msec = 0,
-       .hide_timeout_msec = 0,
-       .enabled = False,
-       .mapped = False,
-       .paddingx = 0,
-       .paddingy = 0,
-       .font_color = { .color={1, 1, 1}, .alpha=1 },
-       .bg = 0,
-       .font_desc = 0,
-       .timeout = 0
-};
+Tooltip g_tooltip;
+
+
+void default_tooltip()
+{
+       // give the tooltip some reasonable default values
+       memset(&g_tooltip, 0, sizeof(Tooltip));
+
+       g_tooltip.font_color.color[0] = 1;
+       g_tooltip.font_color.color[1] = 1;
+       g_tooltip.font_color.color[2] = 1;
+       g_tooltip.font_color.alpha = 1;
+}
+
+void cleanup_tooltip()
+{
+       stop_tooltip_timeout();
+       tooltip_hide(0);
+       tooltip_copy_text(0);
+       if (g_tooltip.window) XDestroyWindow(server.dsp, g_tooltip.window);
+       if (g_tooltip.font_desc) pango_font_description_free(g_tooltip.font_desc);
+}
+
 
 void init_tooltip()
 {
@@ -69,23 +75,6 @@ void init_tooltip()
 }
 
 
-void cleanup_tooltip()
-{
-       stop_tooltip_timeout();
-       tooltip_hide(0);
-       g_tooltip.enabled = False;
-       tooltip_copy_text(0);
-       if (g_tooltip.window) {
-               XDestroyWindow(server.dsp, g_tooltip.window);
-               g_tooltip.window = 0;
-       }
-       if (g_tooltip.font_desc) {
-               pango_font_description_free(g_tooltip.font_desc);
-               g_tooltip.font_desc = 0;
-       }
-}
-
-
 void tooltip_trigger_show(Area* area, Panel* p, int x_root, int y_root)
 {
        x = x_root;
@@ -215,7 +204,7 @@ void tooltip_update()
        c = cairo_create(cs);
        Color bc = g_tooltip.bg->back;
        Border b = g_tooltip.bg->border;
-       if (real_transparency) {
+       if (server.real_transparency) {
                clear_pixmap(g_tooltip.window, 0, 0, width, height);
                draw_rect(c, b.width, b.width, width-2*b.width, height-2*b.width, b.rounded-b.width/1.571);
                cairo_set_source_rgba(c, bc.color[0], bc.color[1], bc.color[2], bc.alpha);
@@ -226,8 +215,10 @@ void tooltip_update()
        }
        cairo_fill(c);
        cairo_set_line_width(c, b.width);
-       if (real_transparency) draw_rect(c, b.width/2.0, b.width/2.0, width - b.width, height - b.width, b.rounded);
-       else cairo_rectangle(c, b.width/2.0, b.width/2.0, width-b.width, height-b.width);
+       if (server.real_transparency)
+               draw_rect(c, b.width/2.0, b.width/2.0, width - b.width, height - b.width, b.rounded);
+       else
+               cairo_rectangle(c, b.width/2.0, b.width/2.0, width-b.width, height-b.width);
        cairo_set_source_rgba(c, b.color[0], b.color[1], b.color[2], b.alpha);
        cairo_stroke(c);
 
index 1b1ad677013e8adf7ebfb518a913725326e342fd..e4e54d37ee6838aa40a7178776835cb3c63e3be7 100644 (file)
@@ -42,8 +42,13 @@ typedef struct {
 
 extern Tooltip g_tooltip;
 
-void init_tooltip();
+
+// default values
+void default_tooltip();
+// freed memory
 void cleanup_tooltip();
+
+void init_tooltip();
 void tooltip_trigger_show(Area* area, Panel* p, int x, int y);
 void tooltip_show(void* /*arg*/);
 void tooltip_update();
index e9eabc3384c6c500089f2f0c7583133912e5ba56..61bf4fcc0b59eecc1baa02ded5019b3a197c516f 100644 (file)
@@ -101,7 +101,7 @@ void draw (Area *a)
        a->pix = XCreatePixmap (server.dsp, server.root_win, a->width, a->height, server.depth);
 
        // add layer of root pixmap (or clear pixmap if real_transparency==true)
-       if (real_transparency)
+       if (server.real_transparency)
                clear_pixmap(a->pix, 0 ,0, a->width, a->height);
        XCopyArea (server.dsp, ((Panel *)a->panel)->temp_pmap, a->pix, server.gc, a->posx, a->posy, a->width, a->height, 0, 0);
 
index 8de7eec891795811da885208e3a9721ab2054c91..b4db7f48dfa0915eec9692bbece3937781d4d63f 100644 (file)
@@ -22,8 +22,9 @@
 
 #include "timer.h"
 
-GSList* timeout_list = 0;
+GSList* timeout_list;
 struct timeval next_timeout;
+GHashTable* multi_timeouts;
 
 
 // functions and structs for multi timeouts
@@ -45,6 +46,24 @@ struct _timeout {
        multi_timeout* multi_timeout;
 };
 
+
+void default_timeout()
+{
+       timeout_list = 0;
+       multi_timeouts = 0;
+}
+
+void cleanup_timeout()
+{
+       while (timeout_list) {
+               timeout* t = timeout_list->data;
+               if (t->multi_timeout)
+                       stop_multi_timeout(t);
+               free(t);
+               timeout_list = g_slist_remove(timeout_list, t);
+       }
+}
+
 void add_timeout_intern(int value_msec, int interval_msec, void(*_callback)(void*), void* arg, timeout* t);
 gint compare_timeouts(gconstpointer t1, gconstpointer t2);
 gint compare_timespecs(const struct timespec* t1, const struct timespec* t2);
@@ -61,8 +80,6 @@ void callback_multi_timeout(void* mth);
 void remove_from_multi_timeout(timeout* t);
 void stop_multi_timeout(timeout* t);
 
-GHashTable* multi_timeouts = 0;
-
 /** Implementation notes for timeouts: The timeouts are kept in a GSList sorted by their
        * expiration time.
        * That means that update_next_timeout() only have to consider the first timeout in the list,
@@ -156,18 +173,6 @@ void stop_timeout(timeout* t)
 }
 
 
-void stop_all_timeouts()
-{
-       while (timeout_list) {
-               timeout* t = timeout_list->data;
-               if (t->multi_timeout)
-                       stop_multi_timeout(t);
-               free(t);
-               timeout_list = g_slist_remove(timeout_list, t);
-       }
-}
-
-
 void add_timeout_intern(int value_msec, int interval_msec, void(*_callback)(), void* arg, timeout *t)
 {
        t->interval_msec = interval_msec;
index 22a5ee3607334ef222c11fd25f945fba308fa0c9..251b732f72d8e4f04c8de0dfa9ab5ba4abea332d 100644 (file)
@@ -36,6 +36,11 @@ typedef struct _timeout timeout;
   * integral multiple of the other.
 **/
 
+/** default values **/
+void default_timeout();
+/** freed memory : stops all timeouts **/
+void cleanup_timeout();
+
 /** installs a timeout with the first timeout of 'value_msec' and then a periodic timeout with
   * 'interval_msec'. '_callback' is the callback function when the timer reaches the timeout.
   * returns a pointer to the timeout, which is needed for stopping it again
@@ -48,9 +53,6 @@ void change_timeout(timeout* t, int value_msec, int interval_msec, void (*_callb
 /** stops the timeout 't' **/
 void stop_timeout(timeout* t);
 
-/** stops all timeouts **/
-void stop_all_timeouts();
-
 /** update_next_timeout updates next_timeout to the value, when the next installed timeout will expire **/
 void update_next_timeout();
 
This page took 0.05092 seconds and 4 git commands to generate.