[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CDK & Terminal Resizing
Re: CDK & Terminal Resizing
Sat, 9 Apr 2011 20:50:02 -0400
Thanks for the quick reply.
So, for now, I'm not too worried about making the widgets look right
if the user resizes (to something smaller). However, I would like to
make my program able to "recover" if the user shrinks the terminal to
something smaller than the original.
I'm new to ncurses and CDK, so maybe this is something simple I'm
missing. Lets say on my screen I have all my widgets up and then the
user makes the terminal say 1x1 and then expands it back to the
original size (or greater). I've tried calling refreshCDKScreen()
after the screen is back to the original size, but that doesn't seem
to fix the widgets. Any ideas?
On Fri, Apr 8, 2011 at 8:29 PM, Thomas Dickey <address@hidden> wrote:
> On Fri, 8 Apr 2011, Marc Smith wrote:
>> I didn't see a separate list for "ncurses user questions", so I'm
>> assuming this list is for that as well. If not, I'd appreciate it if
>> anyone could redirect me to the right place.
>> So, I'm using CDK (5.0.20081105) (ncurses 5.7) to develop a text user
>> interface. Resizing terminals doesn't seem to play nice with the CDK
>> widgets -- the text on the screen is messed up after resizing the
>> terminal to something smaller than what was started with and then back
>> to the original size (or bigger).
> yes - it doesn't do that...
> I'd done this more/less for dialog. It was much simpler than CDK would be.
>> I've experimented with other ncurses related things (mc, dialog, etc.)
>> and they seem to resize correctly. I understand I can catch the
>> SIGWINCH via KEY_RESIZE / getch() and I am able to do that, but I'm
>> not sure how I can make the widgets resize "nicely". I've tried using
>> refreshCDKScreen() and others, but I can't get it.
> There's more than one thing which would have to be done.
> When the keypad() function is enabled (which it is), then
> the ncurses getch/wgetch returns KEY_RESIZE when it has updated
> stdscr/curscr to respond to the SIGWINCH.
> At that point, in dialog, I provided for a jump back to the initialization
> region of a widget, so it would then fall into the getch-loop.
> CDK wraps calls to wgetch in getchCDKObject. Some are buried down a level
> or two, making it impractical to "jump back" (other than a setjmp).
> I think, that to make SIGWINCH work here, CDK would have to be reorganized
> to use some sort of event-loop (keeping the wgetch's at that level), and to
> add a list of the widgets, which the event-loop function could adjust in one
> Alternatively (closer to how CDK is done now), it could have a method added
> to each widget to tell it to resize.
>> I'm sure this is something that could be modified in CDK for the
>> widgets to resize nicely, but how can I do this in my own program
>> without modifying CDK? Any ideas?
> You'd have to (in effect) write your own resize functions and register them
> as callbacks. It's probably doable (since the WINDOW's are exposed in the
> widget structures), but rather tedious to implement for the whole
> Thomas E. Dickey