diff --git a/term.c b/term.c index 48ddc42..76e06ed 100644 --- a/term.c +++ b/term.c @@ -95,8 +95,9 @@ extern char **environ, *tgoto(), *tgetstr(); char *termcap_ptr; -int termcap_putter(char ch) { - *termcap_ptr++ = ch; +int termcap_putter(int ch) { + /* XXX: Should this check for any non-char values? */ + *termcap_ptr++ = (char)ch; return 0; } diff --git a/xgraphics.c b/xgraphics.c index 5d1c8d4..afc750a 100644 --- a/xgraphics.c +++ b/xgraphics.c @@ -268,7 +268,7 @@ void placate_x() XConfigureEvent *xce; XMotionEvent *xme; XButtonEvent *xbe; - checkX; + checkX(); while(XCheckWindowEvent(dpy, win, EVENT_MASK, (XEvent *)&event)) @@ -310,14 +310,14 @@ void check_X11_stop() { if (--count == 0) { count = 300; - checkX; + checkX(); placate_x(); } } int get_button() { - checkX; + checkX(0); placate_x(); @@ -326,7 +326,7 @@ int get_button() int get_mouse_x() { - checkX; + checkX(-1); placate_x(); @@ -336,7 +336,7 @@ int get_mouse_x() int get_mouse_y() { - checkX; + checkX(-1); placate_x(); diff --git a/xgraphics.h b/xgraphics.h index 64b01fe..43ab0d7 100644 --- a/xgraphics.h +++ b/xgraphics.h @@ -22,15 +22,22 @@ void logofill(void); #define GR_SIZE 60000 -#define checkX { \ +#define checkX(ret) { \ + if (have_x < 0) real_window_init(); \ + if (!have_x) { \ + err_logo(BAD_GRAPH_INIT,NIL); \ + return ret; \ + } \ +} +/* XXX: Can this be safely used? */ +#define checkXnoreturn { \ if (have_x < 0) real_window_init(); \ if (!have_x) { \ err_logo(BAD_GRAPH_INIT,NIL); \ - return; \ } \ } -#define prepare_to_draw {checkX; placate_x();} +#define prepare_to_draw {checkXnoreturn; placate_x();} #define done_drawing XFlush(dpy) extern void placate_x();