(gnome gtk) behavior when opening the display fails
gregory benison <[email protected]> Thu, 28 Jan 2010 17:05:38 -0800
| Newsgroups | gmane.lisp.guile.gtk |
|---|---|
| Message-ID | <[email protected]> |
Current behavior: $ DISPLAY=foo guile-gnome-2 guile> (use-modules (gnome gtk)) (<unknown>:2018): Gdk-WARNING **: cannot open display: $ i.e. if the display can't be opened for some reason, trying to load (gnome gtk) causes the program simply to exit... which I suppose is correct behavior, but might it be nice to have a way of catching the error so that a program could, for example, print out a "hey, I can't open any displays, what should I do" type of message? diff --git a/gnome/gw/gdk-spec.scm b/gnome/gw/gdk-spec.scm index b002829..2a53a0d 100644 --- a/gnome/gw/gdk-spec.scm +++ b/gnome/gw/gdk-spec.scm @@ -48,7 +48,7 @@ (define-method (initializations-cg (self <gdk-wrapset>) err) (list (next-method) - "gdk_init (NULL, NULL);\n")) + "if(!gdk_init_check (NULL, NULL)) scm_throw(scm_from_locale_symbol(\"no-display\"), SCM_EOL);\n")) (define-class <gdk-event-type> (<gobject-classed-pointer-type>))