bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to dynamically change the window's layout and size ?


From: Howard
Subject: Re: How to dynamically change the window's layout and size ?
Date: Fri, 07 Nov 2008 11:47:31 -0500
User-agent: Thunderbird 1.5.0.12 (X11/20071019)

In fluxbox xterm on FC6 I get the same as you describe , and why not?
I am new to ncurses too. It seems to me that once something is written
to the screen buffer it's going to stay in the same locations until it is
re-written to a different location.
So our programs need to detect and handle screen resize events.
The 'handling' will be different from program to program.
There's no way ncurses could anticipate what your program should do.
Here's something which may hels me determine what I will want to do:
----------
#include <ncurses.h> /* screen_resize-1.c */
#include <string.h>

/********************** MAIN() **************************************/
int main(void)
{
int c, i, y, x, maxy, maxx, r1y, r1x, resz;

x= y= r1x= r1y= resz= 0;
c= 0x19a;

initscr();
cbreak();
/* raw(); */
keypad(stdscr, TRUE);

getmaxyx(stdscr, maxy, maxx);

mvprintw( r1y++, r1x," maxy=%3d maxx=%3d y=%3d x=%3d",
maxy, maxx, y, x);
mvprintw( r1y++, r1x," Try some resizes, 'X' to quit...");

for(i = 0; (c = getch()) != 'X'; i++)
{
getmaxyx(stdscr, maxy, maxx);
if(c == 0x19a)
{
printw( " Do Resize Stuff");
for(y= 0; y < maxy; y++)
mvaddch( y, maxx - 1, 'X');
for(x= 0; x < maxx; x++)
mvaddch( maxy - 1, x, 'Y');
}
mvprintw( r1y++, r1x,"%3d) maxy=%3d maxx=%3d y=%3d x=%3d c=%3x %c ",
i, maxy, maxx, y, x, c, c);
if(r1y >= (maxy - 2))
r1y = 4;
}

endwin();
return 0;
}
/*
keypad false resize event is:
12) maxy=49 maxx=101 y=49 x=101 c=19a ~Z

ctl-d is:
7) maxy=41 maxx=119 y=41 x=119 c= 4 ^D
-----
keypad TRUE resize event is:
4) maxy=51 maxx=142 y=51 x=142 c=19a ~Z
5) maxy=51 maxx=142 y=51 x=142 c=ffffffff �

ctl-d is:
2) maxy=41 maxx=119 y=41 x=119 c= 4 ^D
*/
----------
As you will see many questions arise...
I suppose this is something to consider from the beginning.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]