Re: Question about GtkButton->event_window.



Tom Liu wrote:
> I still confuse:
[snip]

> 3: the GtkButton need a gdk window,
> (GTK_WIDGET_FLAGS(GTK_WIDGET(button)) & GTK_NO_WINDOW) should return
> FALSE.

I have here a gtk+-2.2.2 source (didn't go through another
download just to write an email...)

and this is my version of gtkbutton.c:
========================
static void
gtk_button_init (GtkButton *button)
{
  GTK_WIDGET_SET_FLAGS (button, GTK_CAN_FOCUS | GTK_RECEIVES_DEFAULT);
  GTK_WIDGET_SET_FLAGS (button, GTK_NO_WINDOW);
...
========================

That means that a gtkbutton is `GTK_NO_WINDOW', meaning that it
uses the GdkWindow of its parent (container) widget to draw on.

> 2: The GtkButton->event_window covers the area of button in
> GtkWidget->window, All the draw on GtkWidget->window should be covered.

Its called an event_window for a reason, its there to recieve events
(you can not draw on an "event window", only recieve events from X).

since the event_window is only as big as the gtkbutton, it is practicle
to recieve enter/leave notify (because if it used the parent, it would
have to calculate its position relative to its parent every
"motion-notify" to emulate a mouse-over)


I hope this clarifies things,
                                                         -Tristan





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