Understand xwindow

xiaoxiao2021-03-06  66

Many people are using xwindow, but they are using some of the XWindows under covering, those packaging are somewhat unstable, occupying a lot of resources, so that some people say that xwindow is garbage. In fact, XWindow is a very good graphics system, you should complain that those unstable packaging, not xwindow itself. XWindow is very clever design, many times it is conceptually more advanced than other window systems, so that it is still the industrial standards on the workstation for many years. Many other window systems are learned from XWindow. XWindow can say too much. Below only to distinguish between the concepts that are easily confusing, some suggestions that use it correctly. The resolution X Server and X Client This is what I have been asked many times by others. I really don't want to say it anymore, so I wrote it here to steal a lazy, hehe. Many people who are familiar with the principle of the Internet will make mistakes for the first time I encounter XWindow. If he logs in to a Sun server from a Windows machine with Exceed through xdmcp, he says Exceed is a client, and the Sun Machine is a server. This is completely wrong. Understand the working principle of XWindow, this difference will be obvious. X Server does not refer to the machine you logged in, but refers to a program that is responsible for accepting customer requirements on a machine, displaying graphics requested on the screen, and notifying the message (keyboard, mouse, window message) Customer program. For example, Exceed in the above example is a X Server, which is responsible for controlling the display (Display), the program on the Sun machine, XTERM, XXGDB, DTWM (CDE Window Manager), ... is a client program. They usually use the TCP 6000 port to connect to the Windows machine, and the 6000 port of the Windows machine is made by Exceed Bind and Listen, how, our Internet expert, Exceed looks a server :) For example, when you pass Telnet Start the xterm on the Sun machine, you will display a window on the Exceed screen. The actual thing is: XTERM requests to connect to the 6000 number of the Windows machine, connected to the Exceed, then the xterm requests the resource, then the xterm requests a window on the screen. When you press the "A" button in the XTERM window, Exceed will notify the xterm process, then Xterm will send a datagram, request Exceed, "Please display a letter A at the coordinate (100, 30), then The rectangle is displayed as a cursor. "So, you will display a letter more in your xterm window. Did you understand this? Do not? That is still useful, experience it. XWindow's network transparency just the Exceed user, his client program not only runs on that Sun machine, but also can run on other machines in the network, or on this machine. For example, he may be able to log in to several Sun workstations through Telnet, several Linux PCs, he can boot XTERM on those machines, displayed on this Windows machine on Exceed. If it installs Cygwin, he can also start the xterm of the Cygwin on this machine, display it in the same way.

If he uses XRDB in this machine's Exceed set xterm style, such as background midnightblue, foreground white, font - * - Adobe-coier - *, ..., then, Sun, Linux, Cygwin's XTERM, although there is no configuration But they know: "This X Server requires me to use this background color, this foreground, this font ...", they will display the same style window on your screen. Use the mouse to select a paragraph, then you can press the character in the middle of the other program to paste the characters. No matter where this program is running. Take a look at a bigger picture: there is three machines on your screen, the GVIM on the two machines, the Mozilla on the two machines is displayed, and they are allocated by this machine's FVWM manipulation, they can freely Copy the copy paste ... From here you can initially get the network transparency of XWindow, which makes you convenient to operate a lot of machines. What is window manager? Many people don't know what the window manager is going. They think GNOME and KDE are window manager, and the window manager is capable of providing a toolbar, configuring a desktop background, setting a lot of menus. In fact, window manager is only part of GNOME and KDE, and its main function is that you usually have no attention, but it is very important. The main function of the window manager is: mobile window, change window size, iconization (minimize) window, change window laminated order ... Usually the usual x client does not need to know someone wants to move it, it only knows the listening window manager if. If there is no window manager running, your program will be a pile, you can't manipulate the program covered below, you can only use the top programs, and you can't move it, you can't change its size. Such systems cannot be used at all! In fact, the title, button, beautiful border on your window is all provided by the window manager, not the program yourself, so you can change any windows with the window manager. When you click on the button at close the window, you actually click on the window manager to place a small window above your program window. After it is clicked, window manager will notify the program: "Hey! Some people want to Fall you, you are ready to prepare for the post, then quit it. "Different machines are in the window displayed by the window, unified and commanded by the window manager. For example, the window manager determines: there should be four buttons above the XTERM window, one on the left, click it to display the window operation menu, and the other three are maximized, minimize and close, respectively. The window uses a 7pixel thick border. When the window appears, first find an empty position on the desktop. If you can't find it, find a location that can minimize other windows ... These are the duties of the window manager. What is GNOME and KDE? Some people call GNOME and KDE called window manager, and even some people call them xwindow. I often see someone asking: "Which xwindow is good? GNOME is also KDE?" In fact, you don't have GNOME and KDE or use XWindow. GNOME and KDE are "Desktop System", a collection of many programs and libraries. Their design purpose is to provide a consistent convenient way of operation to meet the needs of ordinary users.

They not only contain window manager, but also many utilities and applications, such as configuration programs, toolbars, editors, plot tools ... In fact, GNOME can work with many window manager, in history, GNOME useful window management ENGLIGHTENMENT, SAWMILL, SAWFISH, METACITY. The window manager of KDE is called KWIN. You also know, design a complete set of applications: editor, drawing program, browser, ... is very difficult. So they are definitely a dedicated editor, drawing program, browser. However, users who require less high can also use them. Do a fun test with xwindow Now let's make a trial to cause you to interested in xwindow. Many people don't know how to start "xwindow". In fact, XWindow's start-up mode is simple. First, start your X Server. Under Linux, you can enter "X &" directly, let a X Server run in the background. In this way, an arbulus that occupies the entire screen (root window) will appear. If you are Exceed or X-Win32, you need to set the screen to "Single Window" to see this window. Then, Linux users need to set a password with XAuth, so others can't illegally connect your X Server. You need Ctrl-Alt-F1 to switch to TTY1 to enter this command. Users of Exceed and X-Win32 don't need this step. The following example only uses Linux as an example, and the user of other systems can paint scoop. Xauth add: 0. `Mcookie` well, now you can try to start a xterm to this X Server: xterm -display: 0

Switch to X by ALT-F7, you see a xterm that is not managed by Window Manager. Try to move it? Switch to TTY1 to start another XTERM, two xterm coincident? How do you enter it in the first xterm? Is this painful? Then you can launch a window manager in xterm, such as TWM, run "TWM &" directly. You find that the XTERM window has been added with the title bar, buttons, and borders, you can now move them. Try to kill TWM, look at those title bar, buttons, do you disappear? You know the role of the window manager. Now tell you how to use XDMCP Broadcast, bypass the CDE's login interface, use the CDE on the Sun machine. In fact, you only need to change the "TWM" of the example to the CDE, or start the DTSession. They are generally under / usr / dt / bin. SUN has another window manager called OpenLook, it is called OLWM in the system, you can find it yourself. Now if you install a fvwm on the Sun machine, you know how to get fvwm by bypassing the CDE login? You don't need to be root, you can use the FVWM you like. The function of the .xdefaults files After understanding the working principle of X, you can use .xdefaults to configure your program. Some people don't understand .xdefaults is used to do what, I like to use shell alias to have some commands with many parameters, or write some shell script, only one line with many lines with many parameters, and then he said: ". Xdefaults is useless "Actually .xdefaults have many benefits than these methods. First, almost all X client programs can get configuration information from the .xdefaults file, such as foreground color, background color, font ... so you can configure all X programs in the same file, without writing so many shell script . Also, if you write these configuration information to the data structure of the root window with XRDB .XDefaults, not the X program on the local machine will also follow the same style. For example, if you have these contents in your .xdefaults: xterm.Background: MidNightBluexterm.Foreground: White

转载请注明原文地址:https://www.9cbs.com/read-89210.html

New Post(0)