I have written some GTK programs using the gtkD bindings for the D programming language that are otherwise console apps, but are capable of displaying plots on the screen and saving them to a file. I'd like to run these on a machine that I only have console-based SSH access to, which means that the plots wouldn't be displayed on the screen, but would still be written to files.
When I call Main.init(), I get a Gtk-WARNING **: cannot open display, as expected. When I call Main.initCheck() instead and ignore the errors, I simply get more errors later in execution related to the lack of a screen.
Is there some easy way to make my program ignore the fact that there's no screen available, do all its on-screen drawing to some dummy device (the graphics equivalent of /dev/null) and still actually draw to Pixmaps and Pixbufs (necessary for saving plots to files) and run the non-GUI-based parts of the app?
Edits: In cases where the app launches a window and blocks on an event loop, the ideal thing to do would be to close the window immediately (or not succeed in opening it in the first place) and continue running the non-GUI based parts of the program. If this is impossible I can work around it by making sure I don't launch any windows.
Also, it appears that Pixbufs and Pixmaps don't work without a screen present. I tried drawing to a Pixmap, creating a Pixbuf out of that, and saving the results to a file, either after calling Main.checkInit() and ignoring the errors or without an init statement and either way GTK complains about lack of a screen.