I need to check X session is up to return a value depending on that, so my application can decide to create windows.
In Gtk+2 there's gtk_init_check, which returns -1 if it can't connect to X session.
In my application I checks DISPLAY variable is set, but that's don't make me content.