[ Usenet FAQs | Web FAQs | Documents | RFC Index ]
Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page
Top Document: comp.windows.x Frequently Asked Questions (FAQ) 7/7
Previous Document: 168) Why do I get a BadMatch error when calling XGetImage?
Next Document: 170) How do I make a "busy cursor" while my application is computing?
-
Search the FAQ Archives
Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page
Top Document: comp.windows.x Frequently Asked Questions (FAQ) 7/7
Previous Document: 168) Why do I get a BadMatch error when calling XGetImage?
Next Document: 170) How do I make a "busy cursor" while my application is computing?
169) How can my application tell if it is being run under X?
A number of programs offer X modes but otherwise run in a straight
character-only mode. The easiest way for an application to determine that it
is running on an X display is to attempt to open a connection to the X
server:
display = XOpenDisplay(display_name);
if (display)
{ do X stuff }
else
{ do curses or something else }
where display_name is either the string specified on the command-line
following -display, by convention, or otherwise is (char*)NULL [in which case
XOpenDisplay uses the value of $DISPLAY, if set].
This is superior to simply checking for the existence a -display command-line
argument or checking for $DISPLAY set in the environment, neither of which is
adequate. [5/91]
Note that there is a lengthy delay if $DISPLAY exists but is set to a machine
which is not currently running an X server.
Top Document: comp.windows.x Frequently Asked Questions (FAQ) 7/7
Previous Document: 168) Why do I get a BadMatch error when calling XGetImage?
Next Document: 170) How do I make a "busy cursor" while my application is computing?
Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page
[ Usenet FAQs | Web FAQs | Documents | RFC Index ]
Send corrections/additions to the FAQ Maintainer:
faq%craft@uunet.uu.net (X FAQ maintenance address)
Last Update October 22 2009 @ 05:36 AM