Re: problem handling "mouse button press"



Simon Hookway <lord_seoman hotmail com> writes: 
hmm, i'm now using gtk2, i have a pixmap that i rendered into an
eventbox as a GtkImage. I then render each button from a pixbuf onto
certain portions of the GtkImage to create the buttons. ATM, when i get
a click or release event i use gdk_window_get_pointer and test to see if
the pointer is in the button area. This creates a problem if the button
is irregular in shape.

But because my buttons are still in a pixbuf, i could test the alpha
channel of the original using the pointer location returned from the
gdk_window_get_pointer call (accounting for the offset of course). 

Is there a better way to do this?

I don't think so, no. You don't need the get_pointer(), can just use
event->x, event->y (probably _should_ use them to avoid race
conditions).

Havoc



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