GtkGC, GtkGCValues, change values



HI

I'm trying to insert my own colors in the notif
gtk theme engin. In the engine, there are drawing 
functions which are called by gtk (i think) to 
draw all kinds of stuff. Changing the functions
you can make your own rendering engine. The function
declarations look like this:



static void         draw_hline(GtkStyle * style,
                               GdkWindow * window,
                               GtkStateType state_type,
                               GdkRectangle * area,
                               GtkWidget * widget,
                               gchar * detail,
                               gint x1,
                               gint x2,
                               gint y) {

hack()

...the rest...

}


ie the program that is using the functions gives 
some colors, which are contained in GtkStyle. I 
tried to change the colors by inserting a call to
my own hack() function at the top of all drawing 
functions. The function hack() is supposed to 
change the colors to my liking, after which the 
drawing functions continues drawing. However, I dont
know exactly how I should change the color entries.
 I tried some stuff and my function now looks like this






static void hack(GtkStyle* style, GtkStateType state_type) {

  GdkGCValues light_gcv;
  GdkGC *light_gc=NULL;
  GdkColor* colorp=NULL;
  GdkColor color;

  light_gc = style->light_gc[state_type];
  gdk_gc_get_values(light_gc,&light_gcv);

  g_print("->%d",(light_gcv.background).red);

  (color).pixel=(light_gcv.background).pixel;
  (color).red=0;
  (color).green=0;
  (color).blue=0;

  colorp=&color;

  gdk_gc_set_background(light_gc,colorp);

  light_gc = style->light_gc[state_type];
  gdk_gc_get_values(light_gc,&light_gcv);

  g_print("**%d",(light_gcv.background).red);


}



but this doesn't seem to work, probably because
the 'color' is destroyed after the function
has been called. Maybe someone knows how I 
could change the colors using my own function.


best regards

jos




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