fix dumb mixed tabs/spaces in last commit, ugh

master
insofaras 2016-08-31 20:08:14 +01:00
parent 38c46c8d5d
commit aff2cddf39
1 changed files with 37 additions and 37 deletions

View File

@ -2142,12 +2142,12 @@ LinuxX11ConnectionWatch(Display* dpy, XPointer cdata, int fd, Bool opening, XPoi
internal void internal void
LinuxFatalErrorMsg(const char* msg) LinuxFatalErrorMsg(const char* msg)
{ {
fprintf(stderr, "Fatal Error: %s\n", msg); fprintf(stderr, "Fatal Error: %s\n", msg);
Display *dpy = XOpenDisplay(0); Display *dpy = XOpenDisplay(0);
if(!dpy){ if(!dpy){
exit(1); exit(1);
} }
int win_w = 450; int win_w = 450;
int win_h = 150 + (strlen(msg) / 40) * 24; int win_h = 150 + (strlen(msg) / 40) * 24;
@ -2157,8 +2157,8 @@ LinuxFatalErrorMsg(const char* msg)
XSizeHints* sh = XAllocSizeHints(); XSizeHints* sh = XAllocSizeHints();
sh->flags = PMinSize; sh->flags = PMinSize;
sh->min_width = win_w; sh->min_width = win_w;
sh->min_height = win_h; sh->min_height = win_h;
XSetWMNormalHints(dpy, w, sh); XSetWMNormalHints(dpy, w, sh);
Atom type = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); Atom type = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
@ -2180,9 +2180,9 @@ LinuxFatalErrorMsg(const char* msg)
XSelectInput(dpy, w, ExposureMask | StructureNotifyMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask); XSelectInput(dpy, w, ExposureMask | StructureNotifyMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask);
XFontStruct* font = XLoadQueryFont(dpy, "-*-fixed-*-*-*-*-*-140-*-*-*-*-iso8859-1"); XFontStruct* font = XLoadQueryFont(dpy, "-*-fixed-*-*-*-*-*-140-*-*-*-*-iso8859-1");
if(!font){ if(!font){
exit(1); exit(1);
} }
XGCValues gcv; XGCValues gcv;
gcv.foreground = WhitePixel(dpy, 0); gcv.foreground = WhitePixel(dpy, 0);
@ -2243,44 +2243,44 @@ LinuxFatalErrorMsg(const char* msg)
redraw = 1; redraw = 1;
} }
if(ev.type == ClientMessage && ev.xclient.window == w && (Atom)ev.xclient.data.l[0] == WM_DELETE_WINDOW){ if(ev.type == ClientMessage && ev.xclient.window == w && (Atom)ev.xclient.data.l[0] == WM_DELETE_WINDOW){
exit(1); exit(1);
} }
if(redraw){ if(redraw){
XClearWindow(dpy, w); XClearWindow(dpy, w);
const char* line_start = msg; const char* line_start = msg;
const char* last_space = NULL; const char* last_space = NULL;
int y = 30; int y = 30;
{ {
const char title[] = "4coder - Fatal Error"; const char title[] = "4coder - Fatal Error";
int width = XTextWidth(font, title, sizeof(title)-1); int width = XTextWidth(font, title, sizeof(title)-1);
int x = (win_w/2) - (width/2); int x = (win_w/2) - (width/2);
XDrawString(dpy, w, gc2, x+2, y+2, title, sizeof(title)-1); XDrawString(dpy, w, gc2, x+2, y+2, title, sizeof(title)-1);
XDrawString(dpy, w, gc, x, y, title, sizeof(title)-1); XDrawString(dpy, w, gc, x, y, title, sizeof(title)-1);
} }
y += 36; y += 36;
int width = XTextWidth(font, "x", 1) * 40; int width = XTextWidth(font, "x", 1) * 40;
int x = (win_w/2) - (width/2); int x = (win_w/2) - (width/2);
for(const char* p = line_start; *p; ++p){ for(const char* p = line_start; *p; ++p){
if(*p == ' ') last_space = p; if(*p == ' ') last_space = p;
if(p - line_start > 40){ if(p - line_start > 40){
if(!last_space) last_space = p; if(!last_space) last_space = p;
XDrawString(dpy, w, gc2, x+2, y+2, line_start, last_space - line_start); XDrawString(dpy, w, gc2, x+2, y+2, line_start, last_space - line_start);
XDrawString(dpy, w, gc, x, y, line_start, last_space - line_start); XDrawString(dpy, w, gc, x, y, line_start, last_space - line_start);
line_start = *last_space == ' ' ? last_space + 1 : p; line_start = *last_space == ' ' ? last_space + 1 : p;
last_space = NULL; last_space = NULL;
y += 18; y += 18;
} }
} }
XDrawString(dpy, w, gc2, x+2, y+2, line_start, strlen(line_start)); XDrawString(dpy, w, gc2, x+2, y+2, line_start, strlen(line_start));
XDrawString(dpy, w, gc, x, y, line_start, strlen(line_start)); XDrawString(dpy, w, gc, x, y, line_start, strlen(line_start));
XDrawRectangles(dpy, w, gc, &button_rect, 1); XDrawRectangles(dpy, w, gc, &button_rect, 1);
if(button_hi || button_trigger){ if(button_hi || button_trigger){