XWindow sorting (updating .....)

Source: Internet
Author: User

############# Concepts (to be sorted out)

XWindow is the industrial standard for workstation graphics systems. It has many different implementations, and Xorg is used in Ubuntu systems.
(Xgl, an avant-garde graphic interface system, is used to replace X server. In addition, it also provides a window manager)
History
Of course, XWindow has a long history and tradition, but it is not in our scope. Note the following two points:
* The "X" in XWindow is different from that in Xbox. X is only a letter behind W. It should be understood like this. XWindow

Is the successor of window (note that window is not Windows)
* Similarly, we should not describe XWindow as xwindows, which is a type of foul! All great creations should be understood and understood as appropriate.

Respect.

Basic Operating Principle
X Window System adopts the C/S structure, but it is different from the common C/S structure. In a common C/S structure, the provider is a server, that is, a service.

Server (such as the HTTP service and FTP service), the service is called client, that is, the client. But in X Window System, the client is the execution process

The server is the party responsible for displaying the window in which the client runs the program.
The composition of X Window System can be divided into three parts: X server, X client, and X protocol. X Server mainly controls input and output and maintains words

Body, color, and other related resources. It receives input information from the input device and sends it to X client. X client returns the information after processing the information,

X server is also responsible for output to the output device (the display we see. The information transmitted by X server to X client is called event, mainly

Keyboard and mouse input and window status information. The information that X client sends to X server is called request, which requires X server to create a window.

To change the window size and position, or draw and output text on the window. X client is mainly used to complete application computing and processing, and does not accept users'

Input information. All input information is input to X server, and then transmitted to X client in the form of event.

The system receives the user's input information, passes it to the window in the form of a message, and then processes the message in the window ). X

After the client processes the received event, if it needs to output the event to the screen or change the screen appearance, it sends a request to X

Server, which is displayed by X server.
Generally, X Server and X client run on the same computer, but they can also be on different computers on different networks. In X Window

In system, the X client is not related to hardware. It does not care about what graphics card you are using, what displays, and what keyboard and mouse are used.

Server. We usually run xf86config or xf86cfg after xfree86 is installed. The configuration is only related to X server.

Configure the X server. If this parameter is not set, you can run the X client program (for example, xeyes-display xserver: 0) on the xserver.

The large eyes are displayed on the screen 0 (displaynumber is 0) on the machine ).
X protocol is the communication protocol between X Server and X client. X protocol supports common network communication protocols. I can only test

TCP/IP, you can see that X server listens on TCP port 6000. Then the X protocol is located above the transport layer. Should it belong to the application layer ?.
Let's summarize the running process:
(1) You can use the mouse and keyboard to issue operation commands to X server.
(2) X server uses event to transmit user operation information to X client
(3) X client program operations
(4) X client uses request to return the result to be displayed
(5) X server displays the result on the screen

What is window manager?

Many people do not know what the window manager is. They think that gnome and KDE are Window managers, and they think that window managers can provide

Tool bar, which can configure the desktop background and set many menu items. In fact, the window manager is only part of gnome and KDE.

The main function is that you do not pay attention to it at ordinary times, but it is very important. The main functions of the window manager are to move the window and change the window size,

Icons (minimized) window, changing the sequence of window layers ......

Some people call gnome and KDE Window managers, or even xwindows. I often see people asking: "Which kind of XWindow is better?

Ah? Gnome or KDE ?" In fact, you can use XWindow without installing gnome and KDE.

GNOME and KDE are "desktop systems", a collection of many programs and function libraries.

What is gmtms?

Updating ......

############ Principles
1. screen number:
Run the following command in cui mode:
Xdkui @ Debian :~ $ X: 1 &
A gray full screen and a mouse pointer are displayed, Which is X Server, and the screen number is 1. Some people say that F7 corresponds to X with the screen number 0.

Server is actually incorrect. If the number of the first startup screen is 1 and the number of the second startup is 0, F7 corresponds to 1 screen and F8 corresponds to 0 screen ),

Run xdkui @ Debian :~ $ Xeyes-display localhost: 1 &
Press CTRL + ALT + F7 to see that our X client is xeyes. Return to Cui and run
Xdkui @ Debian :~ $ X &
Enable an X Server with screen number 0 and run it again under Cui
Xdkui @ Debian :~ $ Xterm &
At this time, CTRL + ALT + F7 corresponds to screen number 1; F8 corresponds to screen number 0, and its X client is xterm.
2. Run X Window System across networks
Generally, the X server is not installed in Linux, FreeBSD, Solaris, and so on, and many do not even have a monitor. In this way

These systems are installed with simple X client, which is remotely displayed in the X server where administrators sit in the GUI. Assume that the lab uses FreeBSD for network creation.

To provide WWW and FTP services. Generally, an X server is set up on the Administrator's local machine, and then the gateway runs the X client program on SSH or telnet.

On the local display, of course, XDMCP (X Display Manager Control Protocol) is also available, as mentioned in man xsession/etc/X11

/Xsession is generally called by startx (my/etc/X11/xinit/xinitrc calls the xsession script) or display manager, but some

Display Manager only calls xsession instead of xinitrc. Therefore, the GUI can be started normally in either of startx or Display Manager modes.

, It is best to put the program started by X client in the xsession file. To remotely run the X client program, you must set the display environment variable

Host Name: screen number (for example, 192.168.1.2: 0 indicates that X server is the screen 0 on 192.168.1.2) or

Add the-display parameter to the program.

############# Practice (marked as "OK ")
----------- Stage 1

1. Start your X Server:
In Linux, you can directly enter: $ X &
Let an X Server Run in the background. In this way, a window (root window) that occupies the entire Screen appears. For exceed

Or X-win32, you need to set the screen to "Single Window" to see this window.
2. Set a password for X Server:
Input: $ Xauth Add: 0. 'mcooker'
Linux users need to use Xauth to set a password for your X server, so that others cannot illegally connect to your X server. You need

The Ctrl-Alt-F1 switches to tty1 to enter this command. Users of exceed and X-win32 do not need this step.
3. Start an xterm to the X server:
Input: xterm-display: 0
Switch to X by pressing the Alt-F7 and you will see an xterm not managed by the window manager. Cannot be moved. If you switch to tty1, start another

Xterm, two xterms overlap.
4. Start a window manager, such as TWM:
Input: $ TWM &
Xterm windows are added with the title bar, buttons, and borders. Now you can move them. If TWM is killed, the title bars, buttons, and borders

All disappears (it is reasonable to say that if you do not know which window to choose, it may fail to start)
----------- Stage 2
1. Set the simplest X Server + X client: (set the file called by the starx script)
1) Write/usr/bin/X11/X: 1 in. xserverrc
2). Write/usr/bin/X11/xeyes-display localhost in xinitrc: 1
This is the simplest X Server + X client, but the screen number is changed from the default 0 to 1. Here X server is/usr/bin/X11/x

Program, X client is the/usr/bin/X11/xeyes program.
3) input: $ startx
In this way, we can see that only 1) 2) The program set in two steps is started.
2. Set the startup environment (method 1): (for example, set it to The GNOME Environment)
1) Modify (or see add again) $ home/. xinitrc's content is exec gnome-session (that is,/usr/bin/gnome-session)
2) input: $ startx
3. Set the startup environment (method 2): (the result is the same as above)
1) Change the link/usr/bin/X-session-manager to point to gnome-session.
2) input: startx
Note: assume that the $ home/. xinitrc file does not exist. Because of its high priority,/etc/X11/xinit/xinitrc will not be executed.

X-session-manager is used. X-session-managermanager is a link to gnome-session. This

In/etc/X11/xsession. d/50xfree86-common_determine-startup, find the execution part of the variable "Startup", which includes:
If [-x/usr/bin/X-session-manager]; then
Startup = x-session-Manager
Specifies the start of X-session-manager. If this parameter is deleted, the specified X client is executed.
------------ Stage 3
1. Enable an X Server with screen number 0:
Input: $ X: 0 &
Press CTRL + ALT + F1 to return to the previous Cui (CTRL + ALT + F7 corresponds to the first X Server started on the machine, CTRL + ALT + F8 corresponds to the second one, someone said

X Server with screen number 0 corresponding to F7 is actually incorrect. If the screen number of the first start is 1 and the number of the second start is 0, F7 corresponds

1 screen, F8 corresponds to 0 screen)
2. Run xterm on screen 0
Input: xterm-display localhost: 0 &
If you only run xterm without specifying the screen, it seems to be loaded to the first startup ?.
3. Start gnome manually:
1) input: $ X &
2) $ gnome-session
I feel that xinit is not very useful (?? I wonder if it is correct)
4. remotely log on to and run the xterm client through SSH or telnet. The program is displayed locally:
1) remotely Input $ export display = 192.168.1.2: 0 on the X client
Set environment variables to determine the display screen of the remote host client program, or add the "-display" parameter to the X client program, that is, $ xterm -- display: 0.
2) remotely enter $ xterm &
False
Set your own machine to 192.168.1.2 and the above is windows. If you need to pay attention to authorization issues in Linux, set up the file/etc/x0.hosts and enter
X client's ip192.168.1.1, x0.hosts indicates the X client address that is allowed to be connected to the local 0th screens, and the x1.hosts file is
The X client address that can be connected to 1st local screens, and so on, which is in man xserver.

5. XDMCP remote logon and local display

1) modify the configuration file/etc/X11/TPD. conf of the X client machine to enable = true in the [XDMCP] segment.
This allows remote logon. Here, X client is the machine requesting X server.
2) remote input on the X client machine: $ TPD
3) Cui input of local X Server: X-query 192.168.1.1
Here, 192.168.1.1 is the address of the machine where X client opens the machine for the target machine. Now you can see the logon interface.
...... To be continued

############# Configuration
------ Phase 1
. Xdefaults file:
Almost all X client programs can get configuration information from the. xdefaults file, such as foreground color, background color, font ...... In this way, you can

Configure the style of all x programs in a file, instead of writing so many shell scripts.
------ Phase 2
1, $ home/. xinitrc: User's client definition file
2,/etc/X11/xinit/xinitrc: System Client
It contains the statement "./etc/X11/xsession ".
3, $ home/. xserverrc: User's server definition file
4,/etc/X11/xinit/xserverrc: System server
For Files 1-4, startx sets the location of X client to search for $ home/. xinitrc, And then/etc/X11/xinit/xinitrc.

The location of X server is to search for $ home/. xserverrc first, and then/etc/X11/xinit/xserverrc. When X Window is started

The priority of. xinitrc and. xserverrc files is high. When the startx command starts X, if the user directory contains the. xinitrc and. xserverrc files,

It is actually equivalent to the command:
Init $ home/. xinitrc -- $ home/. xserverrc. If the user directory does not exist, the two files are equivalent to xinit.

/Usr/x11r6/lib/X11/xinit/xinitrc --/usr/x11r6/lib/X11/xinit/xserver.
5,/etc/X11/xsession:
Files in the "/etc/X11/xsession. d" Directory
6,/etc/X11/xsession. D:
Several files starting with numbers can be seen in this directory. In fact, these values indicate the priority of these files to be run, which is a small number.

High. In xsession scripts, the LS command is used as the running order by name.
7,/etc/X11/xsession. d/50xfree86-common_determine-startup:
Set the startup program. In fact, set the "Startup" variable. "Startup" variable mentioned in 55gnome-session_gnomerc, in

The 99xfree86-common_start file contains "Exec $ startup" to execute it.
Simply put, you can query/usr/bin/X-session-manager, X-window-manager,/usr/bin/X-terminal-emulator sequentially.

If these three files exist, start them, that is, the X client. If none of them exist, the system reports an error and exits.
8,/usr/bin/X-session-Manager:
This file can be seen as a symbolic connection and eventually connected to/usr/bin/gnome-session, that is, gnome.
Change/usr/bin/X-session-manager to point to the xfce4-session (if installed), and startx will start the xfce4 environment.
Delete/usr/bin/X-session-manager, and then startx. Only the window pointed to by/usr/bin/X-window-manager is started.

Manager, such as blackbox.
For five-8 files, if the xinitrc file in the user directory $ home/. xinitrc contains the exec xfce4-session. Then X client can be said

The most important X-session-manger is started from $ home/. xinitrc. It will not go through the execution process of/etc/X11/xinit/xserverrc.
...... To be continued

############# Process
1. Startup Process
Generally, the startx command is used to access X from the console. Start with startx analysis. First man startx and man xinit can see staratx

And xinit usage:
Startx [[client] Options...] [-- [server] Options...]
Xinit [[client] Options] [-- [server] [display] Options]
The preceding [client] and [server] are called client programs and server programs respectively. The man manual must start with/or.
The startx script is obtained after X-window-system-core is installed. It is all xfree86. in Linux of different release versions, the script should be too small.

Exception.
According to its code, it can be concluded that startx mainly sets the location of X client and X server, processes relevant parameters, and finally submits them to xinit for processing.

We can see that startx sets the position of X client to search for $ home/. xinitrc first, then/etc/X11/xinit/xinitrc; and sets X Server

First, search for $ home/. xserverrc and then/etc/X11/xinit/xserverrc. This explains why we usually start X

Window, The. xinitrc and. xserverrc files in the user directory have a higher priority. So when we use the startx command to start X

In the. xinitrc and. xserverrc files, it is equivalent to the xinit $ home/. xinitrc -- $ home/. xserverrc command. If

If the two files do not exist, it is equivalent to xinit/usr/x11r6/lib/X11/xinit/xinitrc --

/Usr/x11r6/lib/X11/xinit/xserver. And so on.
As for xinit, start X server based on the parameters passed by startx, and then start X client based on xinitrc.
The above is the Startup Process of X Window System. startx is only responsible for passing some parameters. The real X startup is implemented by xinit. Actually, it can be divided

To start X Server and X client. In the user directory, construct. xinitrc (that is, X client) and. xserverrc (that is, X

Server) file. Write/usr/bin/X11/X: 1 in. xserverrc .. Write/usr/bin/X11/xeyes-display in xinitrc

Localhost: 1. This is the simplest X Server + X client, but the screen number is changed from the default 0 to 1. Here X server is

/Usr/bin/X11/X program, and X client is the/usr/bin/X11/xeyes program.
To sum up the startx Startup Process for the ordering machine:
(1) startx sets the location of X client and X server, processes parameters, and CALLS xinit
(2) xinit starts X Server Based on the passed parameters, and then calls X client
(3) set related resources based on xinitrc, and start X client programs such as window manager, input method, and other applications.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.