I don't know about Qt libraries but I found that just running the GTK
code fragment checked it fairly easily:

/* Simple check for X display with GTK+ */
include <gtk/gtk.h>

void main (int argc, char **argv){

gboolean return_code;

/* Checks is X Server responds to initialization 
   Returns true on success, false on failure */
return_code = gtk_init_check(&argc, &argv);

printf("Return Code: %d\n", return_code);

}

Since I do not code much C anymore, it seemed way too easy of a check
but worked very well.  When I had my DISPLAY set but local X-Server not
running, it returned false but when I ran it with the X-Server running
it correctly displayed true.  It does the same functions as gtk_init but
returns a status code.  

Could this be what is needed here to check to see if curses is called
when the DISPLAY is set but there is no X-Server or permissions are
denied?


>> trying to figure out what happened.  If the interface is being
changed
>> in this manner than it would seem that simple code to check for a
>> responding X-server or if the X-server connection is denied, it would
>> fall back to curses style windows.
>
>That is a good suggestion.  We currently only look on the presence of
>the DISPLAY envvar but don't do any test:
>
>  /* Simple test to check whether DISPLAY is set or the option
--display
>     was given.  Used to decide whether the GUI or curses should be
>     initialized.  */
>  int
>  pinentry_have_display (int argc, char **argv)
>  {
>  #ifndef HAVE_W32CE_SYSTEM
>    const char *s;
>
>    s = getenv ("DISPLAY");
>    if (s && *s)
>      return 1;
>  #endif
>    for (; argc; argc--, argv++)
>      if (!strcmp (*argv, "--display"))
>        return 1;
>    return 0;
>  }
>
>If someone can come up with a simple test to check the presence of an X
>server, it should be easy to include it.  Note that we don't use Xlib
>directly but GTk+ or Qt.  I don't know whether gtk_init returns an
error
>and we would be able fallback to the curses implementation then.
Anyone
>care to test this? (pinentry/gtk+-2/pinentry-gtk-2.c)/
>
>
>Salam-Shalom,
>
>   Werner
>
>--
>Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
>
>
 
Proud partner. Susan G. Komen for the Cure.
 
Please consider our environment before printing this e-mail or attachments.
----------------------------------
CONFIDENTIALITY NOTICE: This e-mail may contain privileged or confidential 
information and is for the sole use of the intended recipient(s). If you are 
not the intended recipient, any disclosure, copying, distribution, or use of 
the contents of this information is prohibited and may be unlawful. If you have 
received this electronic transmission in error, please reply immediately to the 
sender that you have received the message in error, and delete it. Thank you.
----------------------------------

_______________________________________________
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users

Reply via email to