The event mask of the widget determines, what kind of event will a particular widget receive. Some event are preconfigured, other events have to be added to the event mask. The gtk_widget_add_events() adds a GDK_CONFIGURE event type to the mask. The GDK_CONFIGURE event type accounts for all size, position and stack order events.
The configure-event is emitted to size, position and stack order events.
void frame_callback(GtkWindow *window, GdkEvent *event, gpointer data) { int x, y; char buf[10]; x = event->configure.x; y = event->configure.y; sprintf(buf, "%d, %d", x, y); gtk_window_set_title(window, buf); }
The callback function has three parameters. The object that emitted the signal, GdkEvent and the optional data. We determine the x, y positions and set it to the title.
No comments:
Post a Comment