]> Dogcows Code - chaz/tint2/blobdiff - src/clock/clock.c
Fix segfault when the clock has no background in config
[chaz/tint2] / src / clock / clock.c
index 38cfcde00a24aed84fad0479ffe90a2f2a688b2f..73547d155dc21318c1a458d16e167eef05f8e1c5 100644 (file)
@@ -143,7 +143,9 @@ void init_clock_panel(void *p)
 {
        Panel *panel =(Panel*)p;
        Clock *clock = &panel->clock;
-
+       
+       if (clock->area.bg == 0)
+               clock->area.bg = &g_array_index(backgrounds, Background, 0);
        clock->area.parent = p;
        clock->area.panel = p;
        clock->area._draw_foreground = draw_clock;
@@ -221,8 +223,8 @@ int resize_clock (void *obj)
                        clock->area.width = new_size + 1;
                        clock->time1_posy = (clock->area.height - time_height) / 2;
                        if (time2_format) {
-                               clock->time1_posy -= ((date_height_ink + 2) / 2);
-                               clock->time2_posy = clock->time1_posy + time_height + 2 - (time_height - time_height_ink)/2 - (date_height - date_height_ink)/2;
+                               clock->time1_posy -= (date_height)/2;
+                               clock->time2_posy = clock->time1_posy + time_height;
                        }
                        ret = 1;
                }
@@ -234,8 +236,8 @@ int resize_clock (void *obj)
                        clock->area.height =  new_size;
                        clock->time1_posy = (clock->area.height - time_height) / 2;
                        if (time2_format) {
-                               clock->time1_posy -= ((date_height_ink + 2) / 2);
-                               clock->time2_posy = clock->time1_posy + time_height + 2 - (time_height - time_height_ink)/2 - (date_height - date_height_ink)/2;
+                               clock->time1_posy -= (date_height)/2;
+                               clock->time2_posy = clock->time1_posy + time_height;
                        }
                        ret = 1;
                }
This page took 0.026079 seconds and 4 git commands to generate.