Hello Jannis! This has nothing to do with vertical pointer movement vs. horizontal > pointer movement. >
Yes, I know, I was only trying to explain the situation --vertically between EventBox vs. horizontally within the same EventBox, since I have all EventBox widgets arranged in a VBox. I recently had to solve the same problem (having an icon, a label > and a button in an event box). First of all, what it sounds like > you're trying to do is control the prelight state of the event > boxes and render their content differently when they are prelit. > > What you can do to achieve this is override the enter_notify and > leave_notify handlers. In enter_notify, set the state to prelight. In > leave_notify, check whether the pointer has moved to the button or > whether it has left the event box entirely. You can do that with a > combination of gtk_widget_get_pointer() and gdk_window_get_geometry(). > > Here's how I did it in Thunar: > > > http://git.xfce.org/xfce/thunar/tree/thunar/thunar-shortcut-row.c?h=jannis/new-shortcuts-pane#n688 > > Hope this helps, > Yes! That have helped a lot. I've already managed to fix it thanks to you. Thanks a lot!! :) And also thanks to you Bill for your suggestion. 2011/7/27 Jannis Pohlmann <jan...@xfce.org> > Hi, > > On Tue, 26 Jul 2011 21:07:56 +0200 > Valentín <valen...@sanva.net> wrote: > > > Hello!! > > > > I have a problem with enter_notify_event and leave_notify_event. Let > > me explain: > > > > I have an VBox with 5 EventBox widgets, and inside each EventBox I > > have a HBox with one Label and 2 Buttons. I connect the signals > > enter_notify_event and leave_notify_event of each of the EventBox > > widgets to a callback and everything seems to work well: If you move > > the mouse pointer vertically between EventBox widgets you can see the > > events --I print a message from those mentioned callbacks, and I also > > modify the Labels making their text bold on enter_notify_event and > > normal on leave_notify_event. > > > > But If you move the mouse pointer horizontally --within the same > > EventBox-- you'll also get enter/leave_notify_events, and this > > shouldn't happen since the mouse pointer is always inside the > > EventBox. More precisely, you'll get a leave_notify_event when moving > > the pointer to a button (although the button is a child of the > > EventBox) and the corresponding enter_notify_event when going back > > from the button's area to another area also inside the EventBox. > > This has nothing to do with vertical pointer movement vs. horizontal > pointer movement. As soon as you hover the button inside the event box > you'll get a leave notify event. That's normal and it only happens > with widgets that have a GdkWindow (such as GtkButton). > > I recently had to solve the same problem (having an icon, a label > and a button in an event box). First of all, what it sounds like > you're trying to do is control the prelight state of the event > boxes and render their content differently when they are prelit. > > What you can do to achieve this is override the enter_notify and > leave_notify handlers. In enter_notify, set the state to prelight. In > leave_notify, check whether the pointer has moved to the button or > whether it has left the event box entirely. You can do that with a > combination of gtk_widget_get_pointer() and gdk_window_get_geometry(). > > Here's how I did it in Thunar: > > > http://git.xfce.org/xfce/thunar/tree/thunar/thunar-shortcut-row.c?h=jannis/new-shortcuts-pane#n688 > > Hope this helps, > Jannis > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list