Re: [gtk-list] GdkEventMotion modifying pixmaps

On Fri, 7 May 1999, Geoff Finger wrote:
> First, the funtion button_press_event gets passed in two values, widget
> and GdkEventMotion *event. However the signal_connect passes in NULL, so
> where do the valuse in event come from? is event some kind of global
> variable? and if so, why does it need to be passed to the function?

gtk_signal_connect() affects two of the arguments to the callback: the
first (object emitting the signal) and the last (user data).
The ones in the middle are added when gtk_signal_emit() is called (grep
for this function in gtkwidget.c and gtkmain.c and you will see where the
event comes from, but otherwise just take my word for it that it magically
gets there).
> However if it isn't, I need to create a struct to package both
> the event and the widget in that I can pass. However how do I figure out
> how to get the proper values into event since it is not immedialty
> apparent where these values come from?

You can't change what's passed for the event parameter, you will need to
use a struct, object data (gtk_object_set_data()), or global variables if
you need to pass more than one thing around.
> The second question is about the image I want to draw in the other window.
> It's supposed to be a closeup of the area clicked on in the first window.
> Is there some way to copy a part of a pixmap to another, but blow it up in
> the process?

No, you'll have to do this by hand. Look at
libgnomeui/gnome-canvas-text.c, they have an example of reading the pixels
out of a pixmap. Then you will have to do some sort of scaling, and write
pixels back to the screen. It's going to be slow and hard to program;
probably a better way to do it is to keep your own internal representation
of whatever's in the pixmap, and render it twice with different scaling
factors. GnomeCanvas does this for free, for example, but you could code
up a less elaborate solution on your own if you wanted. You don't want to
use pixmaps to store your data since they are server-side and there's no
good way to read your data back out.


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