Re: problem handling "mouse button press"
- From: Simon Hookway <lord_seoman hotmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: problem handling "mouse button press"
- Date: 19 Mar 2002 17:22:59 +1100
On Tue, 2002-03-19 at 14:37, Havoc Pennington wrote:
Simon Hookway <lord_seoman hotmail com> writes:
Actually, i found that the eventbox has the button_press and
button_release masks set as default.
Good, convenient.
The next problem is this will catch the button press anywhere on the
pixmap.
Hmm. Would be easier if you were using GdkPixbuf/GtkImage from GTK 2.
Then you could just check the value of the alpha channel at the
clicked pixel.
With GTK 1.2, you will need to gdk_image_get_from_drawable() the mask
for the pixmap, then gdk_image_get_pixel() the pixel at the place
where the user clicked.
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?
You only need to get_from_drawable() a 1x1 area where the user
clicked, so should be pretty fast. Don't get the whole bitmap.
Havoc
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Simon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]