Changeset 8ae2de9 for global.c


Ignore:
Timestamp:
Mar 2, 2010, 9:14:44 PM (15 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.6, release-1.7, release-1.8, release-1.9
Children:
b928b3a
Parents:
be1ae91
git-author:
David Benjamin <davidben@mit.edu> (10/30/09 14:31:56)
git-committer:
David Benjamin <davidben@mit.edu> (03/02/10 21:14:44)
Message:
Attach PANELs to all of our WINDOWs

We replace wnoutrefresh with update_panels (except in set cursor; there
we have to guarantee that the window is empty.). The viewwin does not
get a PANEL because it's weird and currently leeches onto someone else's
WINDOW.

Resizing is also rather fiddly because panel wants to know about window
resizes. Not completely sure I got it right yet. The only library I know
of that does something like with with ncurses (libgnt) and they
endwin/refresh to resize the screen.

Signed-off-by: David Benjamin <davidben@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • global.c

    r516c27e r8ae2de9  
    126126}
    127127
     128/* If *pan does not exist, we create a new panel, otherwise we replace the
     129   window in *pan with win.
     130
     131   libpanel PANEL objects cannot exist without owner a valid window. This
     132   maintains the invariant for _owl_global_setup_windows. */
     133void _owl_panel_set_window(PANEL **pan, WINDOW *win)
     134{
     135  WINDOW *oldwin;
     136  if (*pan) {
     137    oldwin = panel_window(*pan);
     138    replace_panel(*pan, win);
     139    delwin(oldwin);
     140  } else {
     141    *pan = new_panel(win);
     142  }
     143}
     144
    128145void _owl_global_setup_windows(owl_global *g) {
    129146  int cols, typwin_lines;
     
    142159
    143160  /* create the new windows */
    144   g->recwin=newwin(g->recwinlines, cols, 0, 0);
     161  g->recwin = newwin(g->recwinlines, cols, 0, 0);
    145162  if (g->recwin==NULL) {
    146163    owl_function_debugmsg("_owl_global_setup_windows: newwin returned NULL\n");
     
    148165    exit(50);
    149166  }
     167  _owl_panel_set_window(&g->recpan, g->recwin);
    150168     
    151   g->sepwin=newwin(1, cols, g->recwinlines, 0);
    152   g->msgwin=newwin(1, cols, g->recwinlines+1, 0);
    153   g->typwin=newwin(typwin_lines, cols, g->recwinlines+2, 0);
     169  g->sepwin = newwin(1, cols, g->recwinlines, 0);
     170  _owl_panel_set_window(&g->seppan, g->sepwin);
     171  g->msgwin = newwin(1, cols, g->recwinlines+1, 0);
     172  _owl_panel_set_window(&g->msgpan, g->msgwin);
     173  g->typwin = newwin(typwin_lines, cols, g->recwinlines+2, 0);
     174  _owl_panel_set_window(&g->typpan, g->typwin);
    154175
    155176  owl_editwin_set_curswin(g->tw, g->typwin, typwin_lines, g->cols);
     
    469490  if (!g->resizepending) return;
    470491
    471   /* delete the current windows */
    472   delwin(g->recwin);
    473   delwin(g->sepwin);
    474   delwin(g->msgwin);
    475   delwin(g->typwin);
    476492  if (!isendwin()) {
    477493    endwin();
    478494  }
    479 
    480   refresh();
    481495
    482496  /* get the new size */
Note: See TracChangeset for help on using the changeset viewer.