From: Christian Heller Date: Sat, 24 Aug 2013 03:43:10 +0000 (+0200) Subject: draw_all_wins() returns error code of its draw_scroll_hint() uses. X-Git-Tag: tce~1065 X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7B%20web_path%20%7D%7D/%7B%7Bdb.prefix%7D%7D/test?a=commitdiff_plain;h=8d8eba7405f426c45fd059a17d2f00cfb21c5253;p=plomrogue draw_all_wins() returns error code of its draw_scroll_hint() uses. --- diff --git a/src/windows.c b/src/windows.c index bcfa336..74fb6cf 100644 --- a/src/windows.c +++ b/src/windows.c @@ -554,7 +554,7 @@ extern void shift_active_win(struct WinMeta * wmeta, char dir) -extern void draw_all_wins(struct WinMeta * wmeta) +extern uint8_t draw_all_wins(struct WinMeta * wmeta) { /* Empty everything before filling it a-new. */ erase(); @@ -572,17 +572,23 @@ extern void draw_all_wins(struct WinMeta * wmeta) /* Draw virtual screen scroll hints. */ if (wmeta->pad_offset > 0) { - draw_scroll_hint(&wmeta->padframe, - wmeta->pad_offset, wmeta->pad_offset + 1, '<'); + if (draw_scroll_hint(&wmeta->padframe, + wmeta->pad_offset, wmeta->pad_offset + 1, '<')) + { + return 1; + } } if (wmeta->pad_offset + wmeta->padframe.size.x < getmaxx(wmeta->padframe.curses_win) - 1) { - draw_scroll_hint(&wmeta->padframe, - wmeta->pad_offset + wmeta->padframe.size.x - 1, - getmaxx(wmeta->padframe.curses_win) - - (wmeta->pad_offset + wmeta->padframe.size.x), - '>'); + if (draw_scroll_hint(&wmeta->padframe, + wmeta->pad_offset + wmeta->padframe.size.x - 1, + getmaxx(wmeta->padframe.curses_win) + - (wmeta->pad_offset + wmeta->padframe.size.x), + '>')) + { + return 1; + } } /* Write virtual screen segment to be shown on physical screen into */ @@ -593,6 +599,7 @@ extern void draw_all_wins(struct WinMeta * wmeta) /* Only at the end write accumulated changes to the physical screen. */ doupdate(); + return 0; } diff --git a/src/windows.h b/src/windows.h index 3a6ebd5..98f5d9a 100644 --- a/src/windows.h +++ b/src/windows.h @@ -153,12 +153,13 @@ extern void shift_active_win(struct WinMeta * wmeta, char dir); -/* Draw virtual screen including all windows. Also add scroll hints (a line - * stating that there is more to see on scrolling further into a certain - * direction) for where the edges of the terminal screen hit non-edges of and - * inside the virtual screen. Then update the terminal screen. +/* Draw virtual screen including all windows. Also add scroll hints (see comment + * on draw_scroll_hint()) for where the edges of the terminal screen hit + * non-edges of and inside the virtual screen. Then update the terminal screen. + * + * Returns 0 on success, 1 on error (of scroll hint text memory allocation). */ -extern void draw_all_wins(struct WinMeta * wmeta); +extern uint8_t draw_all_wins(struct WinMeta * wmeta);