[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ncurses-bug
Subject:    Re: copywin() behaves oddly... can anyone explain?
From:       William McBrine <wmcbrine () gmail ! com>
Date:       2007-05-08 10:04:33
Message-ID: alpine.DEB.0.82.0705080556330.2781 () alanis ! playgroup
[Download RAW message or body]

On Mon, 7 May 2007, Bryan Christ wrote:

> Can anyone explain this behavior:
>
> /* this doesnt work */
> mirror=dupwin(window);	/* window is a subwin	*/
> getmaxyx(window,y,x);
> copywin(window,0,0,0,0,y,x,FALSE);  /* <--copywin will return ERR */
>
> /* this does work, same as above but... */
> copywin(window,0,0,0,0,y-1,x-1,FALSE)

The parameters to copywin() are the window coordinates for the upper left 
and lower right corners of the rectangle. The return values from 
getmaxyx(), on the other hand, are the size of the window. (Or to quote 
X/Open: "The getmaxyx() macro stores the number of rows of the specified 
window in y and stores the window's number of columns in x.")

So, a 50x20 window would give y = 20, x = 50 from getmaxyx(), but (since 
the coordinates start at 0, 0) the lower right corner, for copywin(), 
would be 19, 49.

-- 
William McBrine <wmcbrine@gmail.com>


_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-ncurses
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic