Gtk apps seem to yellow with age....



... or at least they do now (makeshift diff to gdk/x11/gdkcolor-x11.c
attached). caveat: I have not yet gotten to non truecolor visuals, or
theming (pixbuf themes seem to negate the effect).



*** gdkcolor-x11.c	Sat Jun 28 20:24:28 2003
--- gdkcolor-x11.new.c	Sat Jun 28 20:25:03 2003
***************
*** 32,41 ****
  #include "gdkprivate-x11.h"
  #include "gdkscreen-x11.h"
  
- #include <unistd.h>
- #include <sys/stat.h>
- #include <sys/types.h>
- 
  typedef struct _GdkColormapPrivateX11  GdkColormapPrivateX11;
  
  struct _GdkColormapPrivateX11
--- 32,37 ----
***************
*** 1065,1096 ****
      return 0;
  }
  
- 
- time_t self_file_age () {
- 
-   struct stat stats;
-   int mtime;
- 
-   char exename[80];
-   char pidstr[10];
- 
-   strcpy(&exename,"/proc/");
- 
-   sprintf(&pidstr,"%d",getpid());
-   strcat(&exename,&pidstr);
-   strcat(&exename,"/exe");
- 
-   
- 
- 
-   stat(&exename,&stats);
- 
-   mtime=stats.st_mtime;
- 
-   return time(0)-mtime;
- }
- 
- 
  /**
   * gdk_colormap_alloc_colors:
   * @colormap: a #GdkColormap.
--- 1061,1066 ----
***************
*** 1152,1180 ****
      case GDK_VISUAL_DIRECT_COLOR:
      case GDK_VISUAL_TRUE_COLOR:
        visual = colormap->visual;
        for (i = 0; i < ncolors; i++)
  	{
- 
- 	  #define FULLTIME 157680000;
- 
- 
- 	  int b=colors[i].blue;
- 	  int r=colors[i].red;
- 	  int g=colors[i].green;
- 	  double y=(double) self_file_age()/FULLTIME;
- 
- 	  //	  printf("y factor %f\n",y);
- 
- 	  g-=(y*0.15)*g;
- 	  b-=(y*0.35)*b;
- 
- 
- 	  colors[i].red=r;
- 	  colors[i].blue=b;
- 	  colors[i].green=g;
- 
- 	    
- 
  	  colors[i].pixel = (((colors[i].red >> (16 - visual->red_prec)) << visual->red_shift) +
  			     ((colors[i].green >> (16 - visual->green_prec)) << visual->green_shift) +
  			     ((colors[i].blue >> (16 - visual->blue_prec)) << visual->blue_shift));
--- 1122,1130 ----
      case GDK_VISUAL_DIRECT_COLOR:
      case GDK_VISUAL_TRUE_COLOR:
        visual = colormap->visual;
+ 
        for (i = 0; i < ncolors; i++)
  	{
  	  colors[i].pixel = (((colors[i].red >> (16 - visual->red_prec)) << visual->red_shift) +
  			     ((colors[i].green >> (16 - visual->green_prec)) << visual->green_shift) +
  			     ((colors[i].blue >> (16 - visual->blue_prec)) << visual->blue_shift));


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