]> Dogcows Code - chaz/tint2/blobdiff - src/systray/systraybar.c
*fix* use ascending and descending instead of asc and desc
[chaz/tint2] / src / systray / systraybar.c
index 41303dcc03589c119ce0caa7264b36fcb528bd6b..af79d1f0adae30ab9ad5291e7df32e0ede1edaf2 100644 (file)
@@ -180,7 +180,7 @@ int init_net()
                int actual_format;
                unsigned long nitems;
                unsigned long bytes_after;
-               unsigned char *prop;
+               unsigned char *prop = 0;
                int pid;
 
                _NET_WM_PID = XInternAtom(server.dsp, "_NET_WM_PID", True);
@@ -189,7 +189,7 @@ int init_net()
                int ret = XGetWindowProperty(server.dsp, win, _NET_WM_PID, 0, 1024, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, &prop);
 
                fprintf(stderr, "tint2 : another systray is running");
-               if (ret == 0) {
+               if (ret == Success && prop) {
                        pid = prop[1] * 256;
                        pid += prop[0];
                        fprintf(stderr, " pid=%d", pid);
@@ -319,8 +319,12 @@ gboolean add_icon(Window id)
        traywin = g_new0(TrayWindow, 1);
        traywin->id = id;
 
-       //      systray.list_icons = g_slist_prepend(systray.list_icons, traywin);
-       systray.list_icons = g_slist_insert_sorted(systray.list_icons, traywin, compare_traywindows);
+       if (systray.sort == 3)
+               systray.list_icons = g_slist_prepend(systray.list_icons, traywin);
+       else if (systray.sort == 2)
+               systray.list_icons = g_slist_append(systray.list_icons, traywin);
+       else
+               systray.list_icons = g_slist_insert_sorted(systray.list_icons, traywin, compare_traywindows);
        systray.area.resize = 1;
        systray.area.redraw = 1;
        //printf("add_icon id %lx, %d\n", id, g_slist_length(systray.list_icons));
This page took 0.020826 seconds and 4 git commands to generate.