Hi,

2010/11/24 Brian Tietz <sdbti...@yahoo.com>:
> I am creating two widget subclasses, one which is a subclass of GtkContainer 
> and one which is a subclass of GtkButton.  Both need to receive the 
> enter-notify signal.  I can successfully obtain the enter-notify signal fot 
> GtkButton in my_button_subclass_init:
>
>     g_gtk_button_mouse_enter_notify_event = widget_class->enter_notify_event;
>     widget_class->enter_notify_event = my_button_subclass_enter_notify_event;
>
> That function does get called, I do my thing, and then call the GtkButton 
> class version.  When I try to do the same thing for my GtkContainer subclass 
> though, it doesn't happen.  I more or less understand this: my GtkContainer 
> subclass is GTK_NO_WINDOW, and according to the Gtk docs I need to put it 
> inside of a GtkEventBox.  Fair enough.  But I am studying gtkbutton.c so see 
> how to do this right and to copy its methodology, and it isn't creating 
> GtkEventBox.  I found a clue in gtk_button_realize: it's calling 
> gdk_window_new, so it seems that GtkButton has its own GdkWindow, which would 
> explain why it received enter-notify events.  Fair enough.  Here's the weird 
> part though.  I found that GtkButton has the GTK_NO_WINDOW flag set!  Any 
> help in understanding these behaviors and observations would be appreciated.

You need to call gtk_widget_add_events() on your widget and add the
event GDK_ENTER_NOTIFY_MASK.

  http://library.gnome.org/devel/gtk/stable/GtkWidget.html#gtk-widget-add-events
  http://library.gnome.org/devel/gdk/2.22/gdk-Events.html#GdkEventMask


HTH
Kind Regards
-- 
Mike
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to