WPrefs: replace X11 WidthOfScreen/HeightOfScreen with WMScreenWidth/Height
WindowHandling.c and Icons.c called WidthOfScreen(DefaultScreenOfDisplay( WMScreenDisplay(scr))) which dereferences NULL on Wayland (no X Display). Use WMScreenWidth/WMScreenHeight instead — these work on both backends. Also added temporary SIGSEGV backtrace handler to main.c for debugging.
This commit is contained in:
parent
50bc0d35aa
commit
b2f878314c
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include <locale.h>
|
||||
|
||||
#include <signal.h>
|
||||
#include <execinfo.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Reference in New Issue