Re: [Midnight Commander] #229: ncurses "default color" change to -1 when available



On Saturday 31 January 2009 20:19:35 Ticket System wrote:
> #229: ncurses "default color" change to -1 when available
> -------------------------------------------+-------------------------------
>- Reporter:  robert david public gmail com  |        Type:  defect
>    Status:  new                            |    Priority:  major
> Milestone:  4.7                            |   Component:  mc-core
>   Version:  4.6.1                          |    Keywords:
>  Blocking:                                 |   Blockedby:
> -------------------------------------------+-------------------------------
>- When using ncurses, there is problem with setting default color to
> transparent on capable terminals. This is caused by color index going from
> 0+ but the default terminal color is -1 in ncurses. So mc doesnt show true
> default color, but BLACK. [[BR]]
>
>  This also has to be dependant on terminal support, if it supports default
>  colors or not. Good inspiration about this is in htop source -> CRT.c ->
>  CRT_setColors


So I have crated a simple patch for this.

Robert


--- a/src/color.c       2009-01-31 23:31:58.000000000 +0100
+++ b/src/color.c       2009-01-31 23:27:05.000000000 +0100
@@ -301,6 +301,7 @@
 
     if (use_colors){
        start_color ();
+       use_default_colors ();
        configure_colors ();
 
 #ifndef HAVE_SLANG
@@ -410,7 +411,7 @@
 void
 mc_init_pair (int index, CTYPE foreground, CTYPE background)
 {
-    init_pair (index, foreground, background);
+    init_pair (index, foreground, (background==0?-1:background));
     if (index > max_index)
        max_index = index;
 }
--- a/src/color.c	2009-01-31 23:31:58.000000000 +0100
+++ b/src/color.c	2009-01-31 23:27:05.000000000 +0100
@@ -301,6 +301,7 @@
 
     if (use_colors){
 	start_color ();
+	use_default_colors ();
 	configure_colors ();
 
 #ifndef HAVE_SLANG
@@ -410,7 +411,7 @@
 void
 mc_init_pair (int index, CTYPE foreground, CTYPE background)
 {
-    init_pair (index, foreground, background);
+    init_pair (index, foreground, (background==0?-1:background));
     if (index > max_index)
 	max_index = index;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]