Re: How to enable "enter-notify-event" for a GtkImage ?



From http://library.gnome.org/devel/gtk/2.11/GtkEventBox.html:

GtkEventBox — A widget used to catch events for widgets which do not have their own window

As far as i understand how Gtk works, it does not create x windows for all widgets for performance reasons. Because events are tracked per x windows, a widget without x window cannot catch events. And because GtkImage does not need events by default, it does not need to have x window.

I have stumbled on this before and my understanding is that this is the way it is meant to be.


Gregory Hosler wrote:
-----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-----

------------------------------------------------------------------------

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


--
Arto Karppinen
------------------------------
arto karppinen iki fi




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