Skip to content

Commit

Permalink
Merge pull request #178 from jrincayc/issue_176_alt
Browse files Browse the repository at this point in the history
Issue 176 alt
  • Loading branch information
dmalec committed Jan 21, 2024
2 parents 76ab58b + 0a3309d commit ca23b30
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
5 changes: 3 additions & 2 deletions term.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
10 changes: 5 additions & 5 deletions xgraphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ void placate_x()
XConfigureEvent *xce;
XMotionEvent *xme;
XButtonEvent *xbe;
checkX;
checkX();

while(XCheckWindowEvent(dpy, win, EVENT_MASK, (XEvent *)&event))

Expand Down Expand Up @@ -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();

Expand All @@ -326,7 +326,7 @@ int get_button()

int get_mouse_x()
{
checkX;
checkX(-1);

placate_x();

Expand All @@ -336,7 +336,7 @@ int get_mouse_x()

int get_mouse_y()
{
checkX;
checkX(-1);

placate_x();

Expand Down
13 changes: 10 additions & 3 deletions xgraphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit ca23b30

Please sign in to comment.