corrupt when saved. The problem is that the save dialog damages
the image and we need to wait for it to be refreshed. A more
elegant solution might be to create a callback or event to capture
the image at a later time. Just checking for pending events
looped forever (the interface was never idle). Setting the max loop
count to 5 still showed damage, the value 10 worked YMMV. I didn't
try other values.
Code: Select all
--- celestia-1.4.1/src/celestia/gtk/actions.cpp.orig 2006-01-22 10:59:51.000000000 -0700
+++ celestia-1.4.1/src/celestia/gtk/actions.cpp 2006-02-19 20:54:08.000000000 -0700
@@ -162,11 +162,16 @@
if (gtk_dialog_run(GTK_DIALOG(fs)) == GTK_RESPONSE_ACCEPT)
{
char* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs));
+ gtk_widget_destroy(fs);
+ for (int i=0; i < 10 && gtk_events_pending ();i++)
+ gtk_main_iteration ();
captureImage(filename, app);
g_free(filename);
}
-
- gtk_widget_destroy(fs);
+ else
+ {
+ gtk_widget_destroy(fs);
+ }
}