]> Dogcows Code - chaz/tint2/blobdiff - src/tint.c
moved initial values in function default_xxx
[chaz/tint2] / src / tint.c
index 2c30f3731f1405277199c14d558df643c4078e8e..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);
@@ -166,9 +173,10 @@ void get_snapshot(const char *path)
 {
        Panel *panel = &panel1[0];
 
-       if (panel->temp_pmap) XFreePixmap(server.dsp, panel->temp_pmap);
-       panel->temp_pmap = XCreatePixmap(server.dsp, server.root_win, panel->area.width, panel->area.height, server.depth);
+       if (panel->area.width > server.monitor[0].width)
+               panel->area.width = server.monitor[0].width;
 
+       panel->temp_pmap = XCreatePixmap(server.dsp, server.root_win, panel->area.width, panel->area.height, server.depth);
        refresh(&panel->area);
 
        Imlib_Image img = NULL;
@@ -176,8 +184,14 @@ void get_snapshot(const char *path)
        img = imlib_create_image_from_drawable(0, 0, 0, panel->area.width, panel->area.height, 0);
 
        imlib_context_set_image(img);
+       if (!panel_horizontal) {
+               // rotate 90° vertical panel
+               imlib_image_flip_horizontal();
+               imlib_image_flip_diagonal();
+       }
        imlib_save_image(path);
        imlib_free_image();
+       XFreePixmap(server.dsp, panel->temp_pmap);
 }
 
 
This page took 0.024093 seconds and 4 git commands to generate.