How to enable "enter-notify-event" for a GtkImage ?
- From: Gregory Hosler <ghosler redhat com>
- To: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: How to enable "enter-notify-event" for a GtkImage ?
- Date: Wed, 02 Apr 2008 20:44:28 +0800
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
on the gtk_widget devhelp page, there is dome documentation about signals common to all
widgets. supposedly.
I have a gtk_image, and i'd like to receive enter/leave notifications.
I have enabled GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK (as near as I can tell) on
the widget (gtk_widget_add_events), and my signal handler just isn't firing...
If I instead enable the NOTIFY_MASK's on an EventBox, then the signal handler see's the
signals.
As a proof of concept, I took the paned.c example from the gtk+ examples, and modified it
(attached) (you'll need to supply your own image :) Anyway, if I change the
g_signal_connect's and the gtk_widget_add_events to the eboxprev (a GtkEventBox), then I
get the interrupts I want. But the problem w/ that approach is that the event box covers
an area greater than the image. I really only want enter/leave on the image.
I know that if I surround the image with an event box, and then surround that with a tight
box (doesn't give extra space to children), with enough layers between the image and the
scroll window, I can get what I want.
But it seems to me that somehow I ought to be able to trigger enter/leave events on the
image itself. Or can not that be done ?
- -Greg
(p.s. I do note the disclaimer surrounding the enter-notify-event/leave-notify-event's. It
says "This signal will be sent to the grab widget if there is one." I suppose the issue is
that the GtkImage isn't "grabbing" the focus, yes ? any way around that ?
- --
+---------------------------------------------------------------------+
Please also check the log file at "/dev/null" for additional information.
(from /var/log/Xorg.setup.log)
| Greg Hosler ghosler redhat com |
+---------------------------------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
iD8DBQFH83+q404fl/0CV/QRAi/XAJ90EXED/PFe7ekVnDyuKiv9KxHWnwCgpriM
vc72SXCWYfyAQAEzuM5HBB0=
=78CZ
-----END PGP SIGNATURE-----
CC = gcc
CFLAGS = -g -Wall \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGDK_PIXBUF_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED
paned: paned.c
$(CC) `pkg-config gtk+-2.0 --cflags --libs` paned.c -o paned $(CFLAGS)
clean:
rm -f *.o paned
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]