]> Dogcows Code - chaz/tint2/blobdiff - src/tint.c
patch by Christian Ruppert, configure option for battery
[chaz/tint2] / src / tint.c
index 2f95994c6e238bd00c09158ea580dc060e3083e1..baaaf0326928a82b3a478d29304042830b9bc267 100644 (file)
@@ -50,8 +50,9 @@ void init ()
 {
        // Set signal handler
    signal(SIGUSR1, signal_handler);
-   signal(SIGINT, signal_handler);
-   signal(SIGTERM, signal_handler);
+       signal(SIGINT, signal_handler);
+       signal(SIGTERM, signal_handler);
+       signal(SIGHUP, signal_handler);
 
    // set global data
    memset(&server, 0, sizeof(Server_global));
@@ -92,6 +93,7 @@ void cleanup()
    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);
+#ifdef ENABLE_BATTERY
    if (bat1_font_desc) pango_font_description_free(bat1_font_desc);
    if (bat2_font_desc) pango_font_description_free(bat2_font_desc);
        if (battery_low_cmd) g_free(battery_low_cmd);
@@ -99,6 +101,7 @@ void cleanup()
        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);
+#endif
        if (clock_lclick_command) g_free(clock_lclick_command);
        if (clock_rclick_command) g_free(clock_rclick_command);
 
@@ -457,25 +460,6 @@ void event_expose (XEvent *e)
        if (!panel) return;
        // TODO : one panel_refresh per panel ?
    panel_refresh = 1;
-/*
-       if (systray.area.on_screen) {
-               // force trayer refresh
-               //XClearWindow(tray_data.dpy, ti->mid_parent);
-               //x11_send_visibility(tray_data.dpy, dst, VisibilityFullyObscured);
-               //x11_send_visibility(tray_data.dpy, dst, VisibilityUnobscured);
-
-               GSList *l;
-               TrayWindow *traywin;
-               for (l = systray.list_icons; l ; l = l->next) {
-                       traywin = (TrayWindow*)l->data;
-                       // send Expose event
-                       XClearArea(server.dsp, traywin->id, 0, 0, systray.area.width, systray.area.height, True);
-                       //printf("expose %lx\n", traywin->id);
-               }
-
-               //x11_refresh_window(tray_data.dpy, ti->wid, ti->l.wnd_sz.x, ti->l.wnd_sz.y, True);
-       }
-*/
 }
 
 
@@ -487,8 +471,10 @@ void event_configure_notify (Window win)
        for (l = systray.list_icons; l ; l = l->next) {
                traywin = (TrayWindow*)l->data;
                if (traywin->id == win) {
-                 XMoveResizeWindow(server.dsp, traywin->id, traywin->x, traywin->y, traywin->width, traywin->height);
-                 return;
+                       //printf("move tray %d\n", traywin->x);
+                       XMoveResizeWindow(server.dsp, traywin->id, traywin->x, traywin->y, traywin->width, traywin->height);
+             panel_refresh = 1;
+                       return;
                }
        }
 
@@ -530,11 +516,13 @@ void event_timer()
        }
 
        // update battery
+#ifdef ENABLE_BATTERY
        if (panel1[0].battery.area.on_screen) {
-               update_battery(&battery_state);
+               update_battery();
                for (i=0 ; i < nb_panel ; i++)
                        panel1[i].battery.area.resize = 1;
        }
+#endif
 
        // update clock
    if (time1_format) {
@@ -643,6 +631,7 @@ load_config:
             goto load_config;
                        case SIGINT:
                        case SIGTERM:
+                       case SIGHUP:
                           cleanup ();
                           return 0;
       }
This page took 0.026955 seconds and 4 git commands to generate.