mirror of
https://github.com/VARCem/PDCurses.git
synced 2026-09-23 15:25:01 +00:00
win->_maxx etc. is not standard, and is defined differently in PDCurses
vs. ncurses (off by one), so use getmaxyx() instead. Sadly, getmaxy() isn't standard either, which means undoing a warning cleanup.
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
char *rcsid_newdemo = "$Id: newdemo.c,v 1.12 2005/12/07 01:37:43 wmcbrine Exp $";
|
||||
char *rcsid_newdemo = "$Id: newdemo.c,v 1.13 2005/12/08 16:33:39 wmcbrine Exp $";
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_PROTO) && !defined(__STDC__)
|
||||
@@ -127,10 +127,8 @@ WINDOW *win;
|
||||
WINDOW *swin1, *swin2, *swin3;
|
||||
|
||||
wattrset(win, 0);
|
||||
w = win->_maxx;
|
||||
h = win->_maxy;
|
||||
bx = win->_begx;
|
||||
by = win->_begy;
|
||||
getmaxyx(win, h, w);
|
||||
getbegyx(win, by, bx);
|
||||
sw = w / 3;
|
||||
sh = h / 3;
|
||||
if ((swin1 = derwin(win, sh, sw, 3, 5)) == NULL)
|
||||
@@ -188,8 +186,7 @@ WINDOW *win;
|
||||
wbkgd( win, COLOR_PAIR(1) );
|
||||
wrefresh(win);
|
||||
|
||||
w = win->_maxx;
|
||||
h = win->_maxy;
|
||||
getmaxyx(win, h, w);
|
||||
x1 = 2 + rand() % (w - 4);
|
||||
y1 = 2 + rand() % (h - 4);
|
||||
x2 = 2 + rand() % (w - 4);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
char *rcsid_ptest = "$Id: ptest.c,v 1.8 2005/12/07 01:37:43 wmcbrine Exp $";
|
||||
char *rcsid_ptest = "$Id: ptest.c,v 1.9 2005/12/08 16:33:39 wmcbrine Exp $";
|
||||
#endif
|
||||
|
||||
#include <curses.h>
|
||||
@@ -171,14 +171,15 @@ PANEL *pan;
|
||||
{
|
||||
WINDOW *win = pan->win;
|
||||
char num = *((char *)pan->user + 1);
|
||||
int y,x;
|
||||
int y,x,maxy,maxx;
|
||||
|
||||
box(win, 0, 0);
|
||||
wmove(win,1,1);
|
||||
wprintw(win,"-pan%c-",num);
|
||||
for(y = 2; y < getmaxy(win) - 1; y++)
|
||||
getmaxyx(win,maxy,maxx);
|
||||
for(y = 2; y < maxy - 1; y++)
|
||||
{
|
||||
for(x = 1; x < getmaxx(win) - 1; x++)
|
||||
for(x = 1; x < maxx - 1; x++)
|
||||
{
|
||||
wmove(win,y,x);
|
||||
waddch(win,num);
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
# define CURSES_LIBRARY /* needed for the prototype of PDC_debug */
|
||||
char *rcsid_testcurs = "$Id: testcurs.c,v 1.24 2005/12/08 08:12:31 wmcbrine Exp $";
|
||||
char *rcsid_testcurs = "$Id: testcurs.c,v 1.25 2005/12/08 16:33:39 wmcbrine Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -269,7 +269,7 @@ WINDOW *win;
|
||||
#endif
|
||||
{
|
||||
int i;
|
||||
int OldY;
|
||||
int OldY, OldX;
|
||||
|
||||
/* disable typeahead checking */
|
||||
|
||||
@@ -287,7 +287,7 @@ WINDOW *win;
|
||||
wrefresh (win);
|
||||
};
|
||||
|
||||
OldY = getmaxy (win);
|
||||
getmaxyx (win, OldY, OldX);
|
||||
mvwprintw (win, 6, 1, "The top of the window will scroll");
|
||||
wmove (win, 1, 1);
|
||||
wsetscrreg (win, 0, 4);
|
||||
|
||||
23
demos/tui.c
23
demos/tui.c
@@ -45,7 +45,7 @@ int waitforkey Args((void));
|
||||
void rmerror Args((void));
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
char *rcsid_tui = "$Id: tui.c,v 1.8 2005/12/07 01:37:43 wmcbrine Exp $";
|
||||
char *rcsid_tui = "$Id: tui.c,v 1.9 2005/12/08 16:33:39 wmcbrine Exp $";
|
||||
#endif
|
||||
|
||||
#if defined(__unix) && !defined(__DJGPP__)
|
||||
@@ -185,6 +185,7 @@ chtype color;
|
||||
int hasbox;
|
||||
#endif
|
||||
{
|
||||
int maxy, maxx;
|
||||
chtype attr = color & A_ATTR; /* extract Bold, Reverse, Blink bits */
|
||||
|
||||
setcolor (win, color);
|
||||
@@ -192,12 +193,14 @@ int hasbox;
|
||||
if (has_colors())
|
||||
wbkgd (win, COLOR_PAIR(color & A_CHARTEXT) | (attr & ~A_REVERSE));
|
||||
else
|
||||
wbkgd (win, color);
|
||||
#else
|
||||
wbkgd (win, color);
|
||||
#endif
|
||||
wbkgd (win, color);
|
||||
|
||||
werase (win);
|
||||
if (hasbox && win->_maxy > 2) box (win, 0, 0);
|
||||
|
||||
getmaxyx (win, maxy, maxx);
|
||||
|
||||
if (hasbox && (maxy > 2)) box (win, 0, 0);
|
||||
touchwin (win); wrefresh (win);
|
||||
}
|
||||
|
||||
@@ -439,7 +442,10 @@ void clsbody Args((void))
|
||||
|
||||
int bodylen Args((void))
|
||||
{
|
||||
return wbody->_maxy;
|
||||
int maxy, maxx;
|
||||
|
||||
getmaxyx (wbody, maxy, maxx);
|
||||
return maxy;
|
||||
}
|
||||
|
||||
WINDOW *bodywin Args((void))
|
||||
@@ -691,7 +697,10 @@ int x;
|
||||
char *buf;
|
||||
#endif
|
||||
{
|
||||
werase (win); mvwprintw (win, 0, 0, "%s", padstr (buf, win->_maxx));
|
||||
int maxy, maxx;
|
||||
|
||||
getmaxyx (win, maxy, maxx);
|
||||
werase (win); mvwprintw (win, 0, 0, "%s", padstr (buf, maxx));
|
||||
wmove (win, 0, x); wrefresh (win);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user