]> Dogcows Code - chaz/tint2/commitdiff
fixed some bugs
authorThierry Lorthiois <lorthiois@bbsoft.fr>
Sat, 7 Mar 2009 10:05:15 +0000 (10:05 +0000)
committerThierry Lorthiois <lorthiois@bbsoft.fr>
Sat, 7 Mar 2009 10:05:15 +0000 (10:05 +0000)
15 files changed:
ChangeLog
src/clock/clock.c
src/config.c
src/panel.c
src/systray/systraybar.c
src/systray/systraybar.h
src/tint.c
src/tint2
src/util/window.c
tintrc01
tintrc02
tintrc03
tintrc04
tintrc05
tintrc07

index 05cce82aea1b32350efc97d6daa669c44ff2a629..ecdfc588bc78eb7101d871765aa4168e362fef59 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-03-07
+- fixed segfault when time1_format empty
+- fixed systray : when clock change size
+- fixed systray segfault when xrandr change size
+
 2009-03-01
 - fixed segfault on tray application due to tint2
 
index 4d42e9b2345a71e8d0cdd5ceefc3f7cc33fdafe0..288ed942e601181bdb2792fe7fe9f7889c4ea32f 100644 (file)
@@ -177,6 +177,7 @@ void resize_clock (void *obj)
                for (i=0 ; i < nb_panel ; i++) {
                        panel1[i].area.resize = 1;
                }
+               systray.area.resize = 1;
                panel_refresh = 1;
    }
 
index abd0be5532baa536a6e9bfbefa07ebc75afcd595..272bdcf9865888676d42828cd19db04a728e17c1 100644 (file)
@@ -309,9 +309,14 @@ void add_entry (char *key, char *value)
    /* Clock */
    else if (strcmp (key, "time1_format") == 0) {
       if (time1_format) g_free(time1_format);
-      if (strlen(value) > 0) time1_format = strdup (value);
-      else time1_format = 0;
-      panel_config->clock.area.on_screen = 1;
+      if (strlen(value) > 0) {
+       time1_format = strdup (value);
+             panel_config->clock.area.on_screen = 1;
+               }
+      else {
+       time1_format = 0;
+             panel_config->clock.area.on_screen = 0;
+               }
    }
    else if (strcmp (key, "time2_format") == 0) {
       if (time2_format) g_free(time2_format);
index 21a30018ce50231286e030870a82bb2af792b7e4..adccfea88b60786d63be9c564c33ba85d8c8416f 100644 (file)
@@ -134,6 +134,7 @@ void cleanup_panel()
 {
        if (!panel1) return;
 
+       cleanup_systray();
    cleanup_taskbar();
 
        // font allocated once
index 18c1f22e97ed3e4523316d85f75e6274704812da..927f9cb5e9e98cf4d48a721678a49b58262d50a4 100644 (file)
@@ -45,23 +45,14 @@ Systraybar systray;
 
 void init_systray()
 {
-       cleanup_systray();
-
        Panel *panel = &panel1[0];
        systray.area.parent = panel;
        systray.area.panel = panel;
        systray.area._draw_foreground = draw_systray;
        systray.area._resize = resize_systray;
 
-       if (systray.area.on_screen) {
-               if (XGetSelectionOwner(server.dsp, server.atom._NET_SYSTEM_TRAY_SCREEN) != None) {
-                       fprintf(stderr, "tint2 : another systray is running\n");
-                       systray.area.on_screen = 0;
-               }
-       }
-
        if (systray.area.on_screen)
-               systray.area.on_screen = net_init();
+               systray.area.on_screen = init_net();
 
        if (!systray.area.on_screen)
                return;
@@ -94,10 +85,7 @@ void cleanup_systray()
 
        free_area(&systray.area);
 
-       if (net_sel_win != None) {
-               XDestroyWindow(server.dsp, net_sel_win);
-               net_sel_win = None;
-       }
+       cleanup_net();
 }
 
 
@@ -109,11 +97,11 @@ void draw_systray(void *obj, cairo_t *c, int active)
        GSList *l;
        int icon_size;
 
+       printf("draw_systray %d %d\n", systray.area.posx, systray.area.width);
        icon_size = sysbar->area.height - (2 * sysbar->area.pix.border.width) - (2 * sysbar->area.paddingy);
        for (l = systray.list_icons; l ; l = l->next) {
                traywin = (TrayWindow*)l->data;
 
-               printf("draw_systray %d %d\n", systray.area.posx, systray.area.width);
                // watch for the icon trying to resize itself!
                XSelectInput(server.dsp, traywin->id, StructureNotifyMask);
 
@@ -171,8 +159,13 @@ void resize_systray(void *obj)
 }
 
 
-int net_init()
+int init_net()
 {
+       if (XGetSelectionOwner(server.dsp, server.atom._NET_SYSTEM_TRAY_SCREEN) != None) {
+               fprintf(stderr, "tint2 : another systray is running\n");
+               return 0;
+       }
+
        // init systray protocol
    net_sel_win = XCreateSimpleWindow(server.dsp, server.root_win, -1, -1, 1, 1, 0, 0, 0);
 
@@ -202,7 +195,13 @@ int net_init()
 }
 
 
-//int width, height;
+void cleanup_net()
+{
+       if (net_sel_win != None) {
+               XDestroyWindow(server.dsp, net_sel_win);
+               net_sel_win = None;
+       }
+}
 
 /*
 void fix_geometry()
index 071f6f7dbc2ce8f0c204924e3593e9d00e014123..a405dfd48d50747fda223a3dcdeb26c9caf96abc 100644 (file)
@@ -37,8 +37,11 @@ extern Systraybar systray;
 
 void init_systray();
 void cleanup_systray();
-int net_init();
+
+int init_net();
+void cleanup_net();
 void net_message(XClientMessageEvent *e);
+
 void remove_icon(TrayWindow *traywin);
 
 void draw_systray(void *obj, cairo_t *c, int active);
index f54bebe6ee9c5d4e411dbfa4f664ed2cd3ea8c7d..6c4aa688e57975a6918a8c402166f9168c602242 100644 (file)
@@ -86,7 +86,6 @@ void init ()
 
 void cleanup()
 {
-       cleanup_systray();
        cleanup_panel();
 
    if (time1_font_desc) pango_font_description_free(time1_font_desc);
@@ -549,6 +548,7 @@ load_config:
 
                                        case UnmapNotify:
                                        case DestroyNotify:
+                                               if (!systray.area.on_screen) break;
                                                for (it = systray.list_icons; it; it = g_slist_next(it)) {
                                                        if (((TrayWindow*)it->data)->id == e.xany.window) {
                                                                remove_icon((TrayWindow*)it->data);
@@ -558,6 +558,7 @@ load_config:
                                        break;
 
                                        case ClientMessage:
+                                               if (!systray.area.on_screen) break;
                                                //printf("ClientMessage\n");
                                                if (e.xclient.message_type == server.atom._NET_SYSTEM_TRAY_OPCODE && e.xclient.format == 32 && e.xclient.window == net_sel_win) {
                                                        net_message(&e.xclient);
index acb995c7865536cb796b0163ae33c85f7862563f..afcfa53e90ea2f7e70ffcda9a54f1823be91bc4c 100755 (executable)
Binary files a/src/tint2 and b/src/tint2 differ
index 446bf5f0ae29ba16498321cbdfca779a2447abe2..1954ad35effb48fbbb2a7532810c9088f4118f2c 100644 (file)
@@ -65,6 +65,22 @@ void window_toggle_shade (Window win)
    send_event32 (win, server.atom._NET_WM_STATE, 2, server.atom._NET_WM_STATE_SHADED);
 }
 
+/*
+int x11_send_expose(Display *dpy, Window dst, int x, int y, int width, int height)
+{
+       XEvent xe;
+       int rc;
+       xe.type = Expose;
+       xe.xexpose.window = dst;
+       xe.xexpose.x = x;
+       xe.xexpose.y = y;
+       xe.xexpose.width = width;
+       xe.xexpose.height = height;
+       xe.xexpose.count = 0;
+       rc = XSendEvent(tray_data.dpy, dst, True, NoEventMask, &xe);
+       return x11_ok() && rc != 0;
+}
+*/
 
 int window_is_hidden (Window win)
 {
index 92c7bfd90e446bd005d8d41660da41afeecef785..513724a0613ed45c03b25512b5f59ba562127c89 100644 (file)
--- a/tintrc01
+++ b/tintrc01
@@ -55,7 +55,7 @@ task_active_background_id = 2
 #---------------------------------------------
 # SYSTRAYBAR
 #---------------------------------------------
-systray_padding = 0 3 3
+systray_padding = 0 4 5
 systray_background_id = 0
 
 #---------------------------------------------
index c8bf5e2898590f132d58cb6b0d3905debeddf38b..006516d4b728dce6edec793cc5dbf21614ff2f76 100644 (file)
--- a/tintrc02
+++ b/tintrc02
@@ -57,7 +57,7 @@ task_active_background_id = 3
 #---------------------------------------------
 # SYSTRAYBAR
 #---------------------------------------------
-systray_padding = 0 2 2
+systray_padding = 0 2 3
 systray_background_id = 0
 
 #---------------------------------------------
index f85ad49d8f9a401527ce1d57c048c9142cefe6a2..448368f1cd9c699236ef216c23faee065b6f0d92 100644 (file)
--- a/tintrc03
+++ b/tintrc03
@@ -6,11 +6,11 @@
 # BACKGROUND AND BORDER
 #---------------------------------------------
 rounded = 10
-border_width = 1
+border_width = 0
 background_color = #ffffff 40
 border_color = #ffffff 60
 
-rounded = 1
+rounded = 10
 border_width = 0
 background_color = #ffffff 30
 border_color = #ffffff 15
@@ -21,17 +21,17 @@ border_color = #ffffff 15
 #---------------------------------------------
 panel_monitor = all
 panel_position = bottom center
-panel_size = 100% 30
+panel_size = 97% 26
 panel_margin = 0 0
-panel_padding = 6 3 6
+panel_padding = 0 0 10
 font_shadow = 0
 panel_background_id = 0
 
 #---------------------------------------------
 # TASKBAR
 #---------------------------------------------
-taskbar_mode = multi_desktop
-taskbar_padding = 8 0 0
+taskbar_mode = single_desktop
+taskbar_padding = 0 0 0
 taskbar_background_id = 1
 
 #---------------------------------------------
@@ -41,9 +41,9 @@ task_icon = 1
 task_text = 1
 task_width = 160
 task_centered = 1
-task_padding = 2 2
+task_padding = 5 4
 task_font = Dejavu sans 8
-task_font_color = #000000 60
+task_font_color = #000000 65
 task_active_font_color = #000000 100
 task_background_id = 0
 task_active_background_id = 2
@@ -51,13 +51,13 @@ task_active_background_id = 2
 #---------------------------------------------
 # SYSTRAYBAR
 #---------------------------------------------
-#systray_padding = 0 2 2
-systray_background_id = 0
+systray_padding = 8 3 4
+systray_background_id = 1
 
 #---------------------------------------------
 # CLOCK
 #---------------------------------------------
-time1_format = %A %d %H:%M
+#time1_format = %A %d %H:%M
 time1_font = Dejavu sans 10
 #time2_format = %A %d %B
 time2_font = sans 7
index 2e7e90e71ee5c55d5b9707ee041cbdf87e05ede0..0256d4f2746787c817f9aad30795ea46bf64e88f 100644 (file)
--- a/tintrc04
+++ b/tintrc04
@@ -50,7 +50,7 @@ task_active_background_id = 2
 #---------------------------------------------
 # SYSTRAYBAR
 #---------------------------------------------
-systray_padding = 5 3 5
+systray_padding = 6 2 6
 systray_background_id = 1
 
 #---------------------------------------------
index 711208aeefa1bb6b3814f0eaa912bbb77d7a4f2f..78a90f2bed92a85dd9ef937995a00c05febb6760 100644 (file)
--- a/tintrc05
+++ b/tintrc05
@@ -22,7 +22,7 @@ panel_monitor = all
 panel_position = bottom center
 panel_size = 95% 22
 panel_margin = 0 0
-panel_padding = 7 0
+panel_padding = 0 0 0
 font_shadow = 0
 panel_background_id = 1
 
@@ -50,18 +50,18 @@ task_active_background_id = 2
 #---------------------------------------------
 # SYSTRAYBAR
 #---------------------------------------------
-systray_padding = 0 3 4
+systray_padding = 4 3 4
 systray_background_id = 0
 
 #---------------------------------------------
 # CLOCK
 #---------------------------------------------
-time1_format = %H:%M
+time1_format = %H:%M:%S
 time1_font = sans 13
 #time2_format = %A %d %B
 time2_font = sans 7
 clock_font_color = #ffffff 90
-clock_padding = 1 0
+clock_padding = 4 0
 clock_background_id = 0
 
 #---------------------------------------------
index 98cd2177976f7e29f3ca5649677bfe6ed1893e4a..199ef009d7e3041420eb93a38c46e6f299ae8716 100644 (file)
--- a/tintrc07
+++ b/tintrc07
@@ -50,7 +50,7 @@ task_active_background_id = 2
 #---------------------------------------------
 # SYSTRAYBAR
 #---------------------------------------------
-systray_padding = 6 3 4
+systray_padding = 6 3 5
 systray_background_id = 1
 
 #---------------------------------------------
This page took 0.039848 seconds and 4 git commands to generate.