As a GdkWindow is shown,
hidden, resized, or destroyed, events are emitted.
Configure events indicate that the size or position of
the event window has changed. They include the new size
and positon of the window:
typedef struct _GdkEventConfigure GdkEventConfigure;
struct _GdkEventConfigure
{
GdkEventType type;
GdkWindow *window;
gint8 send_event;
gint16 x, y;
gint16 width;
gint16 height;
};
|
All widgets receive this event (since GDK_STRUCTURE_MASK is automatically
in the event mask), but the widget size allocation system
already conveys the necessary information. That is, most
widgets resize their
GdkWindow themselves in response to a size
allocation; configure events just report back the
resize---not very useful. There are two notable
exceptions. First, the toplevel
GtkWindow widget is in charge of initiating the size
allocation process, and has no parent to get an
allocation from, so it monitors configure events to
determine its size allocation. When you resize a GtkWindow using its window manager
decorations, it will receive configure events and act
accordingly. The second exception is GtkDrawingArea.
GtkDrawingArea sends itself a configure event when
it receives its size allocation. This is convenient,
since you will usually want to repaint the contents of
the drawing area if it is resized. Like all "fake" events
GTK+ creates, send_event
will be TRUE for this
configure event.
Other changes in a
GdkWindow are signalled with GdkEventAny; these events contain no
special information, they just tell you that something
has occurred. They are distinguished by their type field:
-
GDK_DELETE means that
the window manager has asked the application to
destroy this window. If a
widget receives the signal corresponding to this
event, and the signal emission returns FALSE, the widget is
automatically destroyed by the GTK+ main loop.
Because FALSE is the
default return value, you must connect a signal
handler which returns
TRUE to prevent users from destroying GtkWindow widgets.
-
GDK_DESTROY means the
window has been destroyed. Widgets normally destroy
their own windows when they are unrealized. If a
widget is not destroyed after a destroy event on its
window, the GTK+ main loop destroys it.
-
GDK_MAP means the
window has been shown on the screen. You should wait
for the first expose event before you draw to the
window, however.
-
GDK_UNMAP means the
window has been hidden; perhaps it was iconified, or
perhaps you called
gtk_widget_hide().