all repos — tint2 @ 87f02c57e6e813ac6b6bf14e6606e84a81180f05

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

fixed segfault with monitor detection

git-svn-id: http://tint2.googlecode.com/svn/trunk@469 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
thilor77 thilor77@121b4492-b84c-0410-8b4c-0d4edfb3f3cc
commit

87f02c57e6e813ac6b6bf14e6606e84a81180f05

parent

299faa4821052ab4eea2ae5b6ada1b3e33d7f677

2 files changed, 8 insertions(+), 5 deletions(-)

jump to
M src/config.csrc/config.c

@@ -155,9 +155,7 @@

int config_get_monitor(char* monitor) { - if (strcmp(monitor, "all") == 0) - return -1; - else { + if (strcmp(monitor, "all") != 0) { char* endptr; int ret_int = strtol(monitor, &endptr, 10); if (*endptr == 0)

@@ -166,6 +164,9 @@ else {

// monitor specified by name, not by index int i, j; for (i=0; i<server.nb_monitor; ++i) { + if (server.monitor[i].names == 0) + // xrandr can't identify monitors + continue; j = 0; while (server.monitor[i].names[j] != 0) { if (strcmp(monitor, server.monitor[i].names[j++]) == 0)

@@ -174,6 +175,7 @@ }

} } } + // monitor == "all" or monitor not found or xrandr can't identify monitors return -1; }
M src/server.csrc/server.c

@@ -253,7 +253,7 @@ if (XineramaIsActive(server.dsp)) {

XineramaScreenInfo *info = XineramaQueryScreens(server.dsp, &nbmonitor); XRRScreenResources *res = XRRGetScreenResourcesCurrent(server.dsp, server.root_win); - if (res->ncrtc >= nbmonitor) { + if (res && res->ncrtc >= nbmonitor) { // use xrandr to identify monitors (does not work with proprietery nvidia drivers) printf("xRandr: Found crtc's: %d\n", res->ncrtc ); server.monitor = malloc(res->ncrtc * sizeof(Monitor));

@@ -307,7 +307,8 @@ server.nb_monitor = i;

server.monitor = realloc(server.monitor, server.nb_monitor * sizeof(Monitor)); qsort(server.monitor, server.nb_monitor, sizeof(Monitor), compareMonitorPos); - XRRFreeScreenResources(res); + if (res) + XRRFreeScreenResources(res); XFree(info); }