diff --git a/WPrefs.app/Icons.c b/WPrefs.app/Icons.c index 510a437..72597cf 100644 --- a/WPrefs.app/Icons.c +++ b/WPrefs.app/Icons.c @@ -264,8 +264,8 @@ static void createPanel(Panel * p) * ratio as the screen. */ scr = WMWidgetScreen(panel->parent); - swidth = WidthOfScreen(DefaultScreenOfDisplay(WMScreenDisplay(scr))); - sheight = HeightOfScreen(DefaultScreenOfDisplay(WMScreenDisplay(scr))); + swidth = WMScreenWidth(scr); + sheight = WMScreenHeight(scr); width = swidth * (122 - 15 * 2) / sheight; if (width <= (240 - 15 * 2)) { diff --git a/WPrefs.app/WindowHandling.c b/WPrefs.app/WindowHandling.c index 182dd75..b820b64 100644 --- a/WPrefs.app/WindowHandling.c +++ b/WPrefs.app/WindowHandling.c @@ -342,8 +342,8 @@ static void createPanel(Panel * p) * In this area, we want to have a rectangle with the same aspect * ratio as the screen. */ - swidth = WidthOfScreen(DefaultScreenOfDisplay(WMScreenDisplay(scr))); - sheight = HeightOfScreen(DefaultScreenOfDisplay(WMScreenDisplay(scr))); + swidth = WMScreenWidth(scr); + sheight = WMScreenHeight(scr); width = swidth * (109 - 13) / sheight; if (width <= (204 - 13)) { diff --git a/WPrefs.app/main.c b/WPrefs.app/main.c index 9793e7b..1ad2edb 100644 --- a/WPrefs.app/main.c +++ b/WPrefs.app/main.c @@ -26,6 +26,8 @@ #include +#include +#include #include #include @@ -78,6 +80,14 @@ void AddDeadChildHandler(pid_t pid, void (*handler) (void *), void *data) assert(i != MAX_DEATHS); } +static void crash_handler(int sig) { + void *bt[32]; + int n = backtrace(bt, 32); + fprintf(stderr, "\n=== WPrefs CRASH (signal %d) ===\n", sig); + backtrace_symbols_fd(bt, n, STDERR_FILENO); + _exit(1); +} + int main(int argc, char **argv) { WMScreen *scr; @@ -85,6 +95,9 @@ int main(int argc, char **argv) int i; char *display_name = ""; + signal(SIGSEGV, crash_handler); + signal(SIGABRT, crash_handler); + wsetabort(wAbort); memset(DeadHandlers, 0, sizeof(DeadHandlers));