GtkWidget::delete_event semantics changed



hey people,

the GtkWIdget::delete_event does now follow the common GtkWidget::*_event
signal semantics, i.e. a return value of FALSE of a signal handler as well
as no signal handler will destroy the widget.
this also changed (back) the default behaviour for the GDK_DELETE event
(window manager "delete" operation).

the new behaviour is to destroy a GtkWidget if a GDK_DELETE event is
received. this can be suppressed by hooking into the GtkWidget::delete_event
signal with a handler returning TRUE (literaly "event is handled, do not
perform further processing"), e.g.

gint
sample_delete_event_handler (GtkWidget          *widget,
                             GdkEventAny        *event)
{
  gint event_handled;
  
  event_handled = TRUE;
  
  return event_handled;
}

as a convenience (and to avoid code duplication in the gimp code), there
is a new function
gint       gtk_widget_delete_hides      (GtkWidget      *widget);

this function can be used as a GtkWidget::delete_event handler:
gtk_signal_connect (GTK_OBJECT (my_window),
		    "delete_event",
		    GTK_SIGNAL_FUNC (gtk_widget_delete_hides),
		    NULL);
it will hide the widget that received the GDK_DELETE event, and return
TRUE, thus to avoid real destruction of the widget.

the new behaviour is currently in CVS and should reach the ones that
are not bleeding-edge developers whith the next Gtk+ version supposedly
0.99.6 within the next two days.


---
ciaoTJ



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