home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / bugs / sys5 / 100 next >
Encoding:
Text File  |  1992-09-08  |  2.4 KB  |  87 lines

  1. Path: sparky!uunet!mcsun!uknet!dsbc!dom
  2. From: dom@dsbc.icl.co.uk (Dominic Alston)
  3. Newsgroups: comp.bugs.sys5
  4. Subject: CURSES: libpanel bug with libpanel
  5. Keywords: libpanel,curses
  6. Message-ID: <815@dsbc.icl.co.uk>
  7. Date: 7 Sep 92 17:05:40 GMT
  8. Organization: ICL, Bracknell, Berkshire, RG12 4SN, UK
  9. Lines: 76
  10.  
  11. PANEL's with derived windows does not work with 3 panels active.
  12.  
  13. libpanel does not cope with derived windows properly.
  14. If you create 3 PANELs, one of them containing a 
  15. derived WINDOW, libpanel seems to think parts of the
  16. derived WINDOW need refreshing on a update_panels()
  17. call. 
  18.  
  19. This appears to be a problem with all System V libpanels. (SVR3.2 SVR4.0,..)
  20.  
  21. The following code demonstrates this problem.
  22.  
  23. Compile and run the following program (cc bug.c -lpanel -lcurses -o bug)
  24. Once run, use the arrow keys to move the first window.
  25. You will then notice that the bottom window (the PANEL with the derived
  26. WINDOW) seems to get refreshed wrongly.
  27.  
  28. #include <curses.h>
  29. #include <panel.h>
  30.  
  31. int main(void)
  32. {
  33.  PANEL *p1,*p2,*p3;
  34.  WINDOW *a_wn;
  35.  int x=11,y=11,c,lx,ly;
  36.  
  37.  initscr();
  38.  noecho(); cbreak(); keypad(stdscr,1);
  39.  a_wn = newwin(0,0,0,0);
  40.  p1 = new_panel(derwin(a_wn,10,40,10,10));
  41.  p2 = new_panel(newwin(10,40,11,11));
  42.  p3 = new_panel(newwin(10,40,12,12));
  43.  for (ly=0; ly < getmaxy(a_wn); ly++)
  44.   for (lx=0; lx < getmaxx(a_wn); lx++)
  45.    mvwaddch(a_wn,ly,lx,'%');
  46.  box(panel_window(p1),0,0);
  47.  box(panel_window(p2),0,0);
  48.  box(panel_window(p3),0,0);
  49.  update_panels();
  50.  doupdate();
  51.  while ((c = getch()) != '\033') {
  52.   switch (c) {
  53.    case KEY_UP: y--; break;
  54.    case KEY_DOWN: y++; break;
  55.    case KEY_LEFT: x--; break;
  56.    case KEY_RIGHT: x++; break;
  57.   }
  58.   move_panel(p3,y,x);
  59.   update_panels();
  60.   doupdate();
  61.  }
  62.  endwin();
  63.  return (0);
  64. }
  65.  
  66.  
  67. I have an application that relies heavily on the use of derived windows,
  68. can anyone suggest a solution ???
  69.  
  70. If anyone has a rewritten libpanel library, that has the same optimisation
  71. that libplanel gives, then please send it to me!!
  72.  
  73.  
  74. --
  75. Dominic Alston
  76. International Computers Ltd.               
  77. Lovelace Road.                              dom@oasis.icl.co.uk ||
  78. Bracknell RG12 4SN                          ..!uunet!mcvax!ukc!stc!iclbra!dom ||
  79. Berks, England.                             da16@unix.brighton.ac.uk ||
  80.                                             da16@vms.brighton.ac.uk
  81. Tel: +44 344 424842 x3695 
  82. Fax: +44 344 487832
  83.  
  84. Disclaimer: class myDisclaimer : public stdDisclaimer {
  85.         myDisclaimer() : stdDisclaimer() { }
  86.     }
  87.