unmap event not emitted?

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

 



Hi, I'm trying to catch the unmap or unmap-event signals, but it looks
to me like they are not emitted.

(BTW the reason for this is that I'm using an openGL widget and I need
to release textures and other data BEFORE the unrealize event).

The following code shows the problem: the unrealize callback is
called, but the unmap is not.

Thanks

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

GtkWidget *window;
GtkEventBox *eventbox;

static gboolean button_press(GtkWidget *widget, GdkEventButton *event,
gpointer user_data)
{
	printf("Button pressed %d\n", event->button);

	gtk_widget_hide(window);
	return FALSE;
}

static void unmap(GtkWidget *widget, gpointer user_data)
{
	printf("unmap");
}

static gboolean unmap_event(GtkWidget *widget, GdkEvent *event,
gpointer user_data)
{
	printf("unmap-event\n");
	return FALSE;
}

static void unrealize(GtkWidget *widget, gpointer user_data)
{
	printf("unrealize\n");
}

static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)
{
	gtk_main_quit();
	return FALSE;
}

int main(int argc, char *argv[])
{
	gtk_init(&argc, &argv);

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	eventbox = gtk_event_box_new();

	gtk_container_add(GTK_CONTAINER(window), eventbox);

	g_signal_connect(eventbox, "button-press-event",
G_CALLBACK(button_press), NULL);
	g_signal_connect(eventbox, "unmap", G_CALLBACK(unmap), NULL);
	g_signal_connect(eventbox, "unmap-event", G_CALLBACK(unmap_event), NULL);
	g_signal_connect(eventbox, "unrealize", G_CALLBACK(unrealize), NULL);

	g_signal_connect(window, "delete-event", G_CALLBACK (delete_event), NULL);

	gtk_widget_show_all(window);
	gtk_main();

	return 0;
}
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux