RE: Question about GtkButton->event_window.
- From: "Tom Liu" <tom liu flextrade com>
- To: "'Tristan Van Berkom'" <vantr touchtunes com>
- Cc: <gtk-app-devel-list gnome org>
- Subject: RE: Question about GtkButton->event_window.
- Date: Thu, 19 Feb 2004 15:23:12 -0500
Check this Gtk+ source code:(gtkbutton.cpp)
static void gtk_button_realize (GtkWidget *widget)
{
[snip]
attributes.event_mask = gtk_widget_get_events (widget);
attributes.event_mask |= (GDK_EXPOSURE_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK);
[snip]
button->event_window = gdk_window_new (gtk_widget_get_parent_window
(widget),
&attributes, attributes_mask);
gdk_window_set_user_data (button->event_window, button);
[snip]
}
We can see GtkButton->event_window has GDK_EXPOSURE_MASK, means it will
fire the expose event? But I tried to hook the widget->expose_event, and
the GtkButton->event_window didn't send the "expose-event".
Thanks.
Tom
-----Original Message-----
From: gtk-app-devel-list-admin gnome org [mailto:gtk-app-devel-list-
admin gnome org] On Behalf Of Tristan Van Berkom
Sent: Wednesday, February 18, 2004 2:12 PM
To: Tom Liu
Cc: gtk-app-devel-list gnome org
Subject: 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
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]