🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.sys5
Article #160

CURSES: libpanel bug with libpanel

#160
From: Dominic Alston
Date: Mon, 07 Sep 1992 17:05
76 lines
2563 bytes
PANEL's with derived windows does not work with 3 panels active.

libpanel does not cope with derived windows properly.
If you create 3 PANELs, one of them containing a 
derived WINDOW, libpanel seems to think parts of the
derived WINDOW need refreshing on a update_panels()
call. 

This appears to be a problem with all System V libpanels. (SVR3.2 SVR4.0,..)

The following code demonstrates this problem.

Compile and run the following program (cc bug.c -lpanel -lcurses -o bug)
Once run, use the arrow keys to move the first window.
You will then notice that the bottom window (the PANEL with the derived
WINDOW) seems to get refreshed wrongly.

#include <curses.h>
#include <panel.h>

int main(void)
{
 PANEL *p1,*p2,*p3;
 WINDOW *a_wn;
 int x=11,y=11,c,lx,ly;

 initscr();
 noecho(); cbreak(); keypad(stdscr,1);
 a_wn = newwin(0,0,0,0);
 p1 = new_panel(derwin(a_wn,10,40,10,10));
 p2 = new_panel(newwin(10,40,11,11));
 p3 = new_panel(newwin(10,40,12,12));
 for (ly=0; ly < getmaxy(a_wn); ly++)
  for (lx=0; lx < getmaxx(a_wn); lx++)
   mvwaddch(a_wn,ly,lx,'%');
 box(panel_window(p1),0,0);
 box(panel_window(p2),0,0);
 box(panel_window(p3),0,0);
 update_panels();
 doupdate();
 while ((c = getch()) != '\033') {
  switch (c) {
   case KEY_UP: y--; break;
   case KEY_DOWN: y++; break;
   case KEY_LEFT: x--; break;
   case KEY_RIGHT: x++; break;
  }
  move_panel(p3,y,x);
  update_panels();
  doupdate();
 }
 endwin();
 return (0);
}


I have an application that relies heavily on the use of derived windows,
can anyone suggest a solution ???

If anyone has a rewritten libpanel library, that has the same optimisation
that libplanel gives, then please send it to me!!


--
Dominic Alston
International Computers Ltd.               
Lovelace Road.                              dom@oasis.icl.co.uk ||
Bracknell RG12 4SN                          ..!uunet!mcvax!ukc!stc!iclbra!dom ||
Berks, England.                             da16@unix.brighton.ac.uk ||
                                            da16@vms.brighton.ac.uk
Tel: +44 344 424842 x3695 
Fax: +44 344 487832

Disclaimer: class myDisclaimer : public stdDisclaimer {
		myDisclaimer() : stdDisclaimer() { }
	}
Technical Details
Message-ID: <815@dsbc.icl.co.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!dsbc!dom

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!dsbc!dom
From: dom@dsbc.icl.co.uk (Dominic Alston)
Newsgroups: comp.bugs.sys5
Subject: CURSES: libpanel bug with libpanel
Keywords: libpanel,curses
Message-ID: <815@dsbc.icl.co.uk>
Date: 7 Sep 92 17:05:40 GMT
Organization: ICL, Bracknell, Berkshire, RG12 4SN, UK
Lines: 76