Changeset 3fa0181
- Timestamp:
- May 1, 2011, 5:30:33 PM (13 years ago)
- Parents:
- 4fd211f (diff), 7b4f3be (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
fmtext.c
r4479497 r7b4f3be 184 184 } 185 185 186 static void _owl_fmtext_update_colorpair(short fg, short bg, short *pair)187 {188 if (owl_global_get_hascolors(&g)) {189 *pair = owl_fmtext_get_colorpair(fg, bg);190 }191 }192 193 186 static void _owl_fmtext_wcolor_set(WINDOW *w, short pair) 194 187 { 195 if ( owl_global_get_hascolors(&g)) {188 if (has_colors()) { 196 189 wcolor_set(w,pair,NULL); 197 190 wbkgdset(w, COLOR_PAIR(pair)); … … 221 214 bg = default_bgcolor; 222 215 _owl_fmtext_wattrset(w, attr); 223 _owl_fmtext_update_colorpair(fg, bg, &pair);216 pair = owl_fmtext_get_colorpair(fg, bg); 224 217 _owl_fmtext_wcolor_set(w, pair); 225 218 … … 270 263 if (bg == OWL_COLOR_DEFAULT) bg = default_bgcolor; 271 264 _owl_fmtext_wattrset(w, attr); 272 _owl_fmtext_update_colorpair(fg, bg, &pair);265 pair = owl_fmtext_get_colorpair(fg, bg); 273 266 _owl_fmtext_wcolor_set(w, pair); 274 267 … … 662 655 continue */ 663 656 } else if (!strcasecmp(buff, "@color") 664 && owl_global_get_hascolors(&g)665 657 && owl_global_is_colorztext(&g)) { 666 658 g_free(buff); … … 820 812 } 821 813 } 822 if ( owl_global_get_hascolors(&g)) {814 if (has_colors()) { 823 815 for(i = 0; i < 8; i++) { 824 816 short fg, bg; … … 835 827 owl_colorpair_mgr *cpmgr; 836 828 short pair; 829 830 if (!has_colors()) 831 return 0; 837 832 838 833 /* Sanity (Bounds) Check */ … … 852 847 if (!(pair != -1 && pair < cpmgr->next)) { 853 848 /* If we didn't find a pair, search for a free one to assign. */ 854 pair = (cpmgr->next < COLOR_PAIRS) ? cpmgr->next : -1;849 pair = (cpmgr->next < owl_util_get_colorpairs()) ? cpmgr->next : -1; 855 850 if (pair != -1) { 856 851 /* We found a free pair, initialize it. */ -
functions.c
r4fd211f r7b4f3be 1817 1817 owl_global_get_cols(&g)); 1818 1818 1819 if ( owl_global_get_hascolors(&g)) {1819 if (has_colors()) { 1820 1820 owl_fmtext_append_normal(&fm, "Color: Yes\n"); 1821 owl_fmtext_appendf_normal(&fm, "Number of color pairs: %i\n", owl_ global_get_colorpairs(&g));1821 owl_fmtext_appendf_normal(&fm, "Number of color pairs: %i\n", owl_util_get_colorpairs()); 1822 1822 owl_fmtext_appendf_normal(&fm, "Can change colors: %s\n", can_change_color() ? "yes" : "no"); 1823 1823 } else { … … 2226 2226 f = fl->data; 2227 2227 owl_fmtext_append_normal(&fm, " "); 2228 if (owl_global_get_hascolors(&g)) { 2229 owl_fmtext_append_normal_color(&fm, owl_filter_get_name(f), owl_filter_get_fgcolor(f), owl_filter_get_bgcolor(f)); 2230 } else { 2231 owl_fmtext_append_normal(&fm, owl_filter_get_name(f)); 2232 } 2228 owl_fmtext_append_normal_color(&fm, owl_filter_get_name(f), 2229 owl_filter_get_fgcolor(f), 2230 owl_filter_get_bgcolor(f)); 2233 2231 owl_fmtext_append_normal(&fm, "\n"); 2234 2232 } -
global.c
r47e0a6a r7b4f3be 51 51 g->direction=OWL_DIRECTION_DOWNWARDS; 52 52 g->zaway=0; 53 if (has_colors()) {54 g->hascolors=1;55 }56 g->colorpairs=COLOR_PAIRS;57 53 owl_fmtext_init_colorpair_mgr(&(g->cpmgr)); 58 54 g->debug=OWL_DEBUG; … … 574 570 owl_view *owl_global_get_current_view(owl_global *g) { 575 571 return(&(g->current_view)); 576 }577 578 /* has colors */579 580 int owl_global_get_hascolors(const owl_global *g) {581 if (g->hascolors) return(1);582 return(0);583 }584 585 /* color pairs */586 587 int owl_global_get_colorpairs(const owl_global *g) {588 return(g->colorpairs);589 572 } 590 573 -
owl.c
ra2a8833 r9efa5bd 444 444 /* update the terminal if we need to */ 445 445 owl_window_redraw_scheduled(); 446 /* On colorpair shortage, reset and redraw /everything/. NOTE: if 447 * the current screen uses too many colorpairs, this draws448 * everything twice. But this is unlikely; COLOR_PAIRS is 64 with449 * 8+1 colors, and 256^2 with 256+1 colors. (+1 for default.)*/446 /* On colorpair shortage, reset and redraw /everything/. NOTE: if we 447 * still overflow, this be useless work. With 8-colors, we get 64 448 * pairs. With 256-colors, we get 32768 pairs with ext-colors 449 * support and 256 otherwise. */ 450 450 cpmgr = owl_global_get_colorpair_mgr(&g); 451 451 if (cpmgr->overflow) { 452 owl_function_debugmsg("colorpairs: color shortage; reset pairs and redraw. COLOR_PAIRS = %d", COLOR_PAIRS); 452 owl_function_debugmsg("colorpairs: used all %d pairs; reset pairs and redraw.", 453 owl_util_get_colorpairs()); 453 454 owl_fmtext_reset_colorpairs(cpmgr); 454 455 owl_function_full_redisplay(); -
owl.h
r283ff1e r7b4f3be 610 610 char *startupargs; 611 611 int nextmsgid; 612 int hascolors;613 int colorpairs;614 612 owl_colorpair_mgr cpmgr; 615 613 pid_t newmsgproc_pid; -
util.c
re56303f r9efa5bd 715 715 } 716 716 717 int owl_util_get_colorpairs(void) { 718 #ifndef NCURSES_EXT_COLORS 719 /* Without ext-color support (an ABI change), ncurses only supports 256 720 * different color pairs. However, it gives us a larger number even if your 721 * ncurses is compiled without ext-color. */ 722 return MIN(COLOR_PAIRS, 256); 723 #else 724 return COLOR_PAIRS; 725 #endif 726 } 727 717 728 gulong owl_dirty_window_on_signal(owl_window *w, gpointer sender, const gchar *detailed_signal) 718 729 {
Note: See TracChangeset
for help on using the changeset viewer.