Changeset dffb8b8


Ignore:
Timestamp:
Mar 2, 2010, 9:14:44 PM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.6, release-1.7, release-1.8, release-1.9
Children:
ccafe64
Parents:
b3adfb5
git-author:
David Benjamin <davidben@mit.edu> (02/28/10 18:34:02)
git-committer:
David Benjamin <davidben@mit.edu> (03/02/10 21:14:44)
Message:
Drop popwin and borderwin from owl_popwin

Again, the WINDOWs are effectively owned by their PANELs, so we remove
the extra reference to avoid possible inconsistency.

Because del_panel fails to delwin, we need a little dance to delete both
at once. A future abstraction layer should take care of that.
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • owl.h

    rb3adfb5 rdffb8b8  
    393393 
    394394typedef struct _owl_popwin {
    395   WINDOW *borderwin;
    396395  PANEL *borderpanel;
    397   WINDOW *popwin;
    398396  PANEL *poppanel;
    399397  int lines;
  • popwin.c

    r8ae2de9 rdffb8b8  
    1313{
    1414  int glines, gcols, startcol, startline;
     15  WINDOW *popwin, *borderwin;
    1516
    1617  /* calculate the size of the popwin */
     
    2425  startcol = (gcols-pw->cols)/2;
    2526
    26   pw->borderwin=newwin(pw->lines, pw->cols, startline, startcol);
    27   pw->borderpanel = new_panel(pw->borderwin);
    28   pw->popwin=newwin(pw->lines-2, pw->cols-2, startline+1, startcol+1);
    29   pw->poppanel = new_panel(pw->popwin);
     27  borderwin = newwin(pw->lines, pw->cols, startline, startcol);
     28  pw->borderpanel = new_panel(borderwin);
     29  popwin = newwin(pw->lines-2, pw->cols-2, startline+1, startcol+1);
     30  pw->poppanel = new_panel(popwin);
    3031  pw->needsfirstrefresh=1;
    3132 
    32   meta(pw->popwin,TRUE);
    33   nodelay(pw->popwin, 1);
    34   keypad(pw->popwin, TRUE);
     33  meta(popwin,TRUE);
     34  nodelay(popwin, 1);
     35  keypad(popwin, TRUE);
    3536
    36   werase(pw->popwin);
    37   werase(pw->borderwin);
     37  werase(popwin);
     38  werase(borderwin);
    3839  if (owl_global_is_fancylines(&g)) {
    39     box(pw->borderwin, 0, 0);
     40    box(borderwin, 0, 0);
    4041  } else {
    41     box(pw->borderwin, '|', '-');
    42     wmove(pw->borderwin, 0, 0);
    43     waddch(pw->borderwin, '+');
    44     wmove(pw->borderwin, pw->lines-1, 0);
    45     waddch(pw->borderwin, '+');
    46     wmove(pw->borderwin, pw->lines-1, pw->cols-1);
    47     waddch(pw->borderwin, '+');
    48     wmove(pw->borderwin, 0, pw->cols-1);
    49     waddch(pw->borderwin, '+');
     42    box(borderwin, '|', '-');
     43    wmove(borderwin, 0, 0);
     44    waddch(borderwin, '+');
     45    wmove(borderwin, pw->lines-1, 0);
     46    waddch(borderwin, '+');
     47    wmove(borderwin, pw->lines-1, pw->cols-1);
     48    waddch(borderwin, '+');
     49    wmove(borderwin, 0, pw->cols-1);
     50    waddch(borderwin, '+');
    5051  }
    5152   
     
    5859int owl_popwin_close(owl_popwin *pw)
    5960{
     61  WINDOW *popwin, *borderwin;
     62
     63  popwin = panel_window(pw->poppanel);
     64  borderwin = panel_window(pw->borderpanel);
     65
    6066  del_panel(pw->poppanel);
    6167  del_panel(pw->borderpanel);
    62   delwin(pw->popwin);
    63   delwin(pw->borderwin);
     68  delwin(popwin);
     69  delwin(borderwin);
     70
    6471  pw->active=0;
    6572  owl_global_set_needrefresh(&g);
     
    8592WINDOW *owl_popwin_get_curswin(const owl_popwin *pw)
    8693{
    87   return(pw->popwin);
     94  return panel_window(pw->poppanel);
    8895}
    8996
Note: See TracChangeset for help on using the changeset viewer.