[gtk-list] Re: gtk_signal_connect() w/key_press_event (fwd)



In a previous message, Federico Mena Quintero says:
> GtkText *my_text;
> ...
> gtk_signal_connect (GTK_OBJECT (my_text), "key_press_event",
> 		    (GtkSignalFunc) my_callback,
> 		    0xdeadbeef);
> 
> 
> static gint
> my_callback (GtkText *text, GdkEventKey *event, gpointer data)
> {
> 	printf ("Got %p\n", data);
> }


Duh.  An extra arg.  I knew it would be something simple.  Thanks.  

While I'm here I might as well ask:  what would be recommended for me to
look at for good color handling code.  I have two problems:

1. I need to install a private colormap and have all widgets use it.  I can
do this using a module I wrote previously that only uses Xlib calls (so it
should compile easily on any platform without having to rewrite it) but I'm
not sure how to get all the Gtk widgets to use it.  With Motif it would be
just setting the XmNcolormap resource.  There are a couple of possible Gtk
routines that handle this: gtk_widget_set_default_colormap() and
gtk_widget_push_colormap(), but I'm not sure if these do what I want.
I know there is a routine for converting the XColormap to a GdkColormap,
but after conversion I'm not sure what to do with it.

2. Once I have a private colormap, I want to install colorcells one at a
time, on an as needed basis (ie a user will click on a color and I'll try
to install it if it doesn't already exist).  I've been reading the mailing
list archives and found a few tips on this from Owen, but perhaps there are
some small programs that deal with this?  I could look at the Gimp's color
code but I was hoping for some smaller, simpler code.  I checked the
tutorials and FAQs - the GTK FAQ has a little bit of this and might be
sufficient once I get my colormap problems worked out.
-- 
Michael J. Hammel           |The Space People think factories are musical
The Graphics Muse           |instruments.  They sing along with them.  Each song
mjhammel@graphics-muse.org  |lasts from 8am to 5pm.  No music on weekends.
http://www.graphics-muse.org        Talking Heads - "Stop Making Sense"



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