XOpenDisplay

Glynn Clements glynn at gclements.plus.com
Fri Feb 18 13:42:15 PST 2011


Al'miev Il'dar wrote:

> Hello, i am a beginner in X-Windows, i have a question:
> 
> in the function XOpenDisplay(display_name), where
> 
> display_name=hostname:displaynumber.screennumber,
> 
> 1) does "hostname" mean a name of a computer, physically existing,
> where it would be necessary to open a graphical applications (that is
> a computer-client), or is it a computer-server ?

It's the name of the computer running the X server which the
application wishes to use.

> 2) what is "displaynumber" and "screennumber" in terms of physically
> existing displays-screens and computer-client(s) and computer-server ?

A "display" is an X server. You can run multiple X servers on a single
computer. In the most common case, the computer arbitrates access to
the keyboard, mouse and display, but it can also work if you have
multiple keyboards/mice/displays, or if the X server is using "virtual
hardware", e.g. Xvnc.

> 3) what is the difference between the terms "display" and "screen" ?

Each display is a separate X server, with a keyboard, mouse and one or
more monitors. A screen corresponds to a single monitor on systems
which don't split a single logical screen across all monitors.

> 4) if display_name=NULL, then display is opened in the local
> computer

If you pass NULL as the display name, the value of the DISPLAY
environment variable is used. This may or may not refer to the local
system.

> - this is implicit
> designation of the local computer, How to provide display_name explicitly ? that is
> would it work for example:
> 
> local:0.0 ?

Omit the hostname for a local display, e.g. ":0" for the first X
server running on the local host. If no hostname is given, the
connection will be to a Unix-domain socket in /tmp/.X11-unix. If a
hostname is used, the connection will be a TCP connection to port 6000
plus the display number on the specified host.

A connection via a Unix-domain socket is more likely to succeed than
one via TCP; X servers are often configured to ignore TCP connections
as a security measure. It's also more efficient.

> 3) is it possible to provide "hostname"=1.2.3.4. (which is an
> IP-address), instead of the name of the computer ?

Yes.

-- 
Glynn Clements <glynn at gclements.plus.com>



More information about the xorg mailing list