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);
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);
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));