bug-guile-ncurses
[Top][All Lists]
Advanced

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

[Bug-guile-ncurses] wgetch after wresize and mvderwin wrong behaviour


From: joseph Dobson
Subject: [Bug-guile-ncurses] wgetch after wresize and mvderwin wrong behaviour
Date: Fri, 15 Feb 2013 18:37:45 +0000

Hello all.

I am running into a problem with ncurses.

I have a window (the main window) and it has a child derived window. The problem my use-case requires me to move and resize the child window, this works fine using the `wresize` and `mvderwin` functions; except if I perform a `wgetch` on that child window, in which case it places the cursor in the right if the frame hadn't moved, and depending on whether or not I refresh the parent on not, it also print the whole of the window at the old position as well.

The code listing demonstrates the problem I am having:

#include <ncurses.h>

int main() {
        WINDOW *win=initscr();
        int y,x,i=3;
        getmaxyx(win, y, x);
        //creates a sub windows 1 col high
        WINDOW *child=derwin(win, i, x, y-i, 0); 
        //doc says to touch before referesh
        touchwin(win);

        mvwaddstr(child, 1, 1, "hello");
        wrefresh(win); //is this the correct order?
        wrefresh(child);
        box(child, '|', '-');

        while(wgetch(child)!='q') {
                ++i;
                mvderwin(child, y-i, 0);
                wresize(child, i, x);
                touchwin(win); //is this the right place?

                wclear(child);  //redraw content
                mvwaddstr(child, 1, 1,"hello");
                box(child, '|', '-');

                wmove(child, 1, 1);

                wrefresh(win);
                wrefresh(child);
        }
        delwin(child);
        delwin(win);
        endwin();
}
//end code listing

Ncurses version: 5.9
System: arch linux
Compiler: gcc 4.7.2

The only "fix" I have come across with is to destroy the old derived window and create a new one in the desired position, but this is an immense faff for nested structures.

Thanks

reply via email to

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