Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Gtk+/Gnome Application Development
Prev Home Next

Window Change Events

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().

Gtk+/Gnome Application Development
Prev Home Next

 
 
  Published under free license. Design by Interspire