diff options
author | ache <ache@FreeBSD.org> | 1995-05-15 16:40:02 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1995-05-15 16:40:02 +0000 |
commit | 042ea47697e097f4a8fc31bcc301c5a308a098a1 (patch) | |
tree | ac333a0c3b5f7a94dd4acd90c9913845e7158926 /gnu/lib/libdialog/kernel.c | |
parent | ab5358efa756e4b7379dddf24f5c744c129fa7d5 (diff) | |
download | FreeBSD-src-042ea47697e097f4a8fc31bcc301c5a308a098a1.zip FreeBSD-src-042ea47697e097f4a8fc31bcc301c5a308a098a1.tar.gz |
Fix draw shadow bug, when shadow reaches end of the screen,
bringed by devmenu or tzsetup f.e.
Diffstat (limited to 'gnu/lib/libdialog/kernel.c')
-rw-r--r-- | gnu/lib/libdialog/kernel.c | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/gnu/lib/libdialog/kernel.c b/gnu/lib/libdialog/kernel.c index 2afae58..f719f79 100644 --- a/gnu/lib/libdialog/kernel.c +++ b/gnu/lib/libdialog/kernel.c @@ -378,30 +378,44 @@ void draw_box(WINDOW *win, int y, int x, int height, int width, chtype box, chty void draw_shadow(WINDOW *win, int y, int x, int height, int width) { int i,sx,sy; + chtype attrs; if (has_colors()) { /* Whether terminal supports color? */ getbegyx(win,sy,sx); - /* small touch */ - wattrset(win, A_INVIS); - wmove(win, y + height, x + 2); - for (i = 0; i < width; i++) - waddch(win, ' '); - /* end touch */ - wattrset(win, shadow_attr); - wmove(win, y + height, x + 2); - for (i = 0; i < width; i++) - waddch(win, mvwinch(newscr, sy+y+height, sx+x+2+i) & A_CHARTEXT); - for (i = y + 1; i < y + height + 1; i++) { - /* small touch */ - wattrset(win, A_INVIS); - wmove(win, i, x + width); - waddstr(win, " "); - /* end touch */ - wattrset(win, shadow_attr); - wmove(win, i, x + width); - waddch(win, mvwinch(newscr, sy+i, sx+x+width) & A_CHARTEXT); - waddch(win, mvwinch(newscr, sy+i, sx+x+width+1) & A_CHARTEXT); + attrs = getattrs(win); + if (y+height < getmaxy(win)) { + /* small touch */ + wattrset(win, A_INVIS); + wmove(win, y + height, x + 2); + for (i = 0; i < width; i++) + if (i+x+2 < getmaxx(win)) + waddch(win, ' '); + /* end touch */ + wattrset(win, shadow_attr); + wmove(win, y + height, x + 2); + for (i = 0; i < width; i++) + if (i+x+2 < getmaxx(win)) + waddch(win, mvwinch(newscr, sy+y+height, sx+x+2+i) & A_CHARTEXT); + } + if (x+width < getmaxx(win)) { + for (i = y + 1; i < y + height + 1; i++) { + if (i < getmaxy(win)) { + /* small touch */ + wattrset(win, A_INVIS); + wmove(win, i, x + width); + waddch(win, ' '); + if (x+width+1 < getmaxx(win)) + waddch(win, ' '); + /* end touch */ + wattrset(win, shadow_attr); + wmove(win, i, x + width); + waddch(win, mvwinch(newscr, sy+i, sx+x+width) & A_CHARTEXT); + if (x+width+1 < getmaxx(win)) + waddch(win, mvwinch(newscr, sy+i, sx+x+width+1) & A_CHARTEXT); + } + } } + wattrset(win, attrs); wnoutrefresh(win); } } |