Re: GTK Kill



On Mon, Sep 09, 2002 at 12:40:07PM +0200, Sven Neumann wrote:
> Ayose <zubzet yahoo es> writes:
> 
> > On Thu, Sep 05, 2002 at 02:17:42PM +0200, Stöhr Kirsten wrote:
> > > Which sub-routine is called when a gtk program is killed by a Window
> > > Manager (like WindowMaker)?
> > > 
> > 
> > I think the SIGPIPE signal is sent to the program.
> 
> first, the "delete_event" is sent to the window that is being closed.
> 

Yes... delete_event is sent when the window is *closed*, but Stöhr asked
when the window is *killed* :-)

With this useless program I can see the difference between GTK/delete_event
and UNIX/SIGPIPE.

#include <signal.h>
#include <gtk/gtk.h>

void sigpipe(int signal)
{
	g_print("SIGPIPE\n");
}

void delete()
{
	g_print("END\n");
	gtk_main_quit();
}

int main(int argc, char** argv)
{
	GtkWidget *w;

	signal(SIGPIPE, sigpipe);

	gtk_init(&argc,&argv);

	w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	g_signal_connect(G_OBJECT(w), "delete_event", G_CALLBACK(delete), 0);
	gtk_widget_show(w);

	gtk_main();
}



This works with WindowMaker, and with the item Kill in the window menu.
If I kill the window with xkill, nothing appears.


-- 
Ayose Cazorla León
Debian GNU/Linux - setepo



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