Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 176 alt #178

Merged
merged 2 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be checking for non-char values here?

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; \
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is going to cause an error to be missed somewhere?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the other hand, it possibly needs to return an error code to actually have this noticed?

} \
}

#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