aboutsummaryrefslogtreecommitdiff
path: root/src/displaywindow.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/displaywindow.c')
-rw-r--r--src/displaywindow.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/src/displaywindow.c b/src/displaywindow.c
index 46b4822..4f30a3d 100644
--- a/src/displaywindow.c
+++ b/src/displaywindow.c
@@ -111,28 +111,7 @@ static gint displaywindow_gl_motion_notify(GtkWidget *widget, GdkEventMotion *ev
}
-static gint displaywindow_gl_realise(GtkWidget *widget, DisplayWindow *dw) {
-
- GdkGLContext *glcontext = gtk_widget_get_gl_context(widget);
- GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable(widget);
- GLfloat w = widget->allocation.width;
- GLfloat h = widget->allocation.height;
-
- if ( !gdk_gl_drawable_gl_begin(gldrawable, glcontext) ) {
- return 0;
- }
-
- glbits_set_ortho(dw, w, h);
- glbits_prepare(dw);
-
- gdk_gl_drawable_gl_end(gldrawable);
-
- return 0;
-
-}
-
static gint displaywindow_closedown(GtkWidget *widget, DisplayWindow *dw) {
- glbits_free_resources(dw);
gtk_exit(0);
return 0;
}
@@ -367,6 +346,11 @@ static gint displaywindow_refinestack(GtkWidget *widget, DisplayWindow *dw) {
return 0;
}
+static gint displaywindow_gl_destroyed(GtkWidget *widget, DisplayWindow *dw) {
+ glbits_final_free_resources(dw);
+ return 0;
+}
+
static gint displaywindow_extract(GtkWidget *widget, DisplayWindow *dw) {
GtkWidget *d;
@@ -612,10 +596,11 @@ DisplayWindow *displaywindow_open(ControlContext *ctx) {
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), dw->drawing_area, gtk_label_new("Reconstruction"));
gtk_widget_add_events(dw->drawing_area, GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_VISIBILITY_NOTIFY_MASK);
g_signal_connect(GTK_OBJECT(dw->drawing_area), "configure_event", G_CALLBACK(glbits_configure), dw);
- g_signal_connect(GTK_OBJECT(dw->drawing_area), "realize", G_CALLBACK(displaywindow_gl_realise), dw);
+ g_signal_connect(GTK_OBJECT(dw->drawing_area), "realize", G_CALLBACK(glbits_realise), dw);
g_signal_connect(GTK_OBJECT(dw->drawing_area), "expose_event", G_CALLBACK(glbits_expose), dw);
g_signal_connect(GTK_OBJECT(dw->drawing_area), "button_press_event", G_CALLBACK(displaywindow_gl_button_press), dw);
g_signal_connect(GTK_OBJECT(dw->drawing_area), "motion_notify_event", G_CALLBACK(displaywindow_gl_motion_notify), dw);
+ g_signal_connect(GTK_OBJECT(dw->drawing_area), "destroy", G_CALLBACK(displaywindow_gl_destroyed), dw);
dw->stack = imagedisplay_new_nowindow(ctx->images->images[dw->cur_image], IMAGEDISPLAY_SHOW_TILT_AXIS | IMAGEDISPLAY_SHOW_CENTRE, NULL, NULL, NULL);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), dw->stack->vbox, gtk_label_new("Image Stack"));