Changeset 099597c


Ignore:
Timestamp:
Feb 4, 2011, 5:32:37 PM (13 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.8, release-1.9
Children:
8d553bf
Parents:
e062f97
git-author:
David Benjamin <davidben@mit.edu> (01/25/11 17:27:10)
git-committer:
David Benjamin <davidben@mit.edu> (02/04/11 17:32:37)
Message:
Don't reset colorpairs in the middle of drawing

Resetting colorpairs while drawing the mainwin causes the existing
contents in a popwin to refer to invalid color pairs. We used to draw
the mainwin first and redraw the contents of each window from scratch.
Moving to libpanel in 1.6 changed this, so background colors
occasionally bled into your popwin.

This changes the colorpair logic to only trigger when we need to, and to
forcibly dirty every window if needed. NOTE: if we don't have enough
color-pairs to draw the current screen, this will draw everything twice.
But it will probably almost never happen.

Reported-by: Alex Dehnert <adehnert@mit.edu>
Reviewed-by: Alejandro R. Sedeño <asedeno@mit.edu>
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • fmtext.c

    re062f97 r099597c  
    876876  short i, j;
    877877
     878  cpmgr->overflow = false;
    878879  cpmgr->next = 8;
    879     /* The test is <= because we allocated COLORS+1 entries. */
     880  /* The test is <= because we allocated COLORS+1 entries. */
    880881  for(i = 0; i <= COLORS; i++) {
    881882    for(j = 0; j <= COLORS; j++) {
     
    925926      /* We still don't have a pair, drop the background color. Too bad. */
    926927      owl_function_debugmsg("colorpairs: color shortage - dropping background color.");
     928      cpmgr->overflow = true;
    927929      pair = owl_fmtext_get_colorpair(fg, OWL_COLOR_DEFAULT);
    928930    }
     
    930932      /* We still don't have a pair, defaults all around. */
    931933      owl_function_debugmsg("colorpairs: color shortage - dropping foreground and background color.");
     934      cpmgr->overflow = true;
    932935      pair = 0;
    933936    }
  • mainwin.c

    re062f97 r099597c  
    5353  markedmsgid = owl_global_get_markedmsgid(&g);
    5454  v = owl_global_get_current_view(&g);
    55   owl_fmtext_reset_colorpairs(owl_global_get_colorpair_mgr(&g));
    5655
    5756  if (v==NULL) {
  • owl.c

    rd3941a0 r099597c  
    444444static int owl_refresh_pre_select_action(owl_ps_action *a, void *data)
    445445{
     446  owl_colorpair_mgr *cpmgr;
     447
    446448  /* if a resize has been scheduled, deal with it */
    447449  owl_global_check_resize(&g);
    448450  /* update the terminal if we need to */
    449451  owl_window_redraw_scheduled();
     452  /* On colorpair shortage, reset and redraw /everything/. NOTE: if
     453   * the current screen uses too many colorpairs, this draws
     454   * everything twice. But this is unlikely; COLOR_PAIRS is 64 with
     455   * 8+1 colors, and 256^2 with 256+1 colors. (+1 for default.) */
     456  cpmgr = owl_global_get_colorpair_mgr(&g);
     457  if (cpmgr->overflow) {
     458    owl_function_debugmsg("colorpairs: color shortage; reset pairs and redraw. COLOR_PAIRS = %d", COLOR_PAIRS);
     459    owl_fmtext_reset_colorpairs(cpmgr);
     460    owl_function_full_redisplay();
     461    owl_window_redraw_scheduled();
     462  }
    450463  return 0;
    451464}
  • owl.h

    r7e111f4 r099597c  
    547547  int next;
    548548  short **pairs;
     549  bool overflow;
    549550} owl_colorpair_mgr;
    550551
Note: See TracChangeset for help on using the changeset viewer.