⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 x-understanding.html

📁 这是很好的学习嵌入式LINUX的文章
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="generator" content="HTML Tidy, see www.w3.org" /><title>Understanding X</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD Handbook" href="index.html" /><link rel="UP" title="The X Window System" href="x11.html" /><link rel="PREVIOUS" title="The X Window System" href="x11.html" /><link rel="NEXT" title="Installing X11" href="x-install.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /></head><body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"alink="#0000FF"><div class="NAVHEADER"><table summary="Header navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><th colspan="3" align="center">FreeBSD Handbook</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="x11.html"accesskey="P">Prev</a></td><td width="80%" align="center" valign="bottom">Chapter 5 The X Window System</td><td width="10%" align="right" valign="bottom"><a href="x-install.html"accesskey="N">Next</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="X-UNDERSTANDING" name="X-UNDERSTANDING">5.2 UnderstandingX</a></h1><p>Using X for the first time can be somewhat of a shock to someone familiar with othergraphical environments, such as <span class="TRADEMARK">Microsoft</span>&reg;&nbsp;<spanclass="TRADEMARK">Windows</span>&reg; or <spanclass="TRADEMARK">Mac&nbsp;OS</span>&reg;.</p><p>While it is not necessary to understand all of the details of various X components andhow they interact, some basic knowledge makes it possible to take advantage of X'sstrengths.</p><div class="SECT2"><h2 class="SECT2"><a id="AEN6046" name="AEN6046">5.2.1 Why X?</a></h2><p>X is not the first window system written for <span class="TRADEMARK">UNIX</span>&reg;,but it is the most popular of them. X's original development team had worked on anotherwindow system prior to writing X. That system's name was ``W'' (for ``Window''). X wasjust the next letter in the Roman alphabet.</p><p>X can be called ``X'', ``X Window System'', ``X11'', and a number of other terms. Youmay find that using the term ``X Windows'' to describe X11 can be offensive to somepeople; for a bit more insight on this, see <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=X&sektion=7&manpath=XFree86+4.4.0"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">X</span>(7)</span></a>.</p></div><div class="SECT2"><h2 class="SECT2"><a id="AEN6060" name="AEN6060">5.2.2 The X Client/Server Model</a></h2><p>X was designed from the beginning to be network-centric, and adopts a``client-server'' model.</p><p>In the X model, the ``X server'' runs on the computer that has the keyboard, monitor,and mouse attached. The server's responsibility includes tasks such as managing thedisplay, handling input from the keyboard and mouse, and so on. Each X application (suchas <b class="APPLICATION">XTerm</b>, or <b class="APPLICATION"><spanclass="TRADEMARK">Netscape</span>&reg;</b>) is a ``client''. A client sends messages tothe server such as ``Please draw a window at these coordinates'', and the server sendsback messages such as ``The user just clicked on the OK button''.</p><p>In a home or small office environment, the X server and the X clients will most likelyrunning on the same computer. However, it is perfectly possible to run the X server on aless powerful desktop computer, and run X applications (the clients) on, say, thepowerful and expensive machine that serves the office. In this scenario the communicationbetween the X client and server takes place over the network.</p><p>This confuses some people, because the X terminology is exactly backward to what theyexpect. They expect the ``X server'' to be the big powerful machine down the hall, andthe ``X client'' to be the machine on their desk.</p><p>It is important to remember that the X server is the machine with the monitor andkeyboard, and the X clients are the programs that display the windows.</p><p>There is nothing in the protocol that forces the client and server machines to berunning the same operating system, or even to be running on the same type of computer. Itis certainly possible to run an X server on <spanclass="TRADEMARK">Microsoft</span>&nbsp;<span class="TRADEMARK">Windows</span> or Apple's<span class="TRADEMARK">Mac&nbsp;OS</span>, and there are various free and commercialapplications available that do exactly that.</p><p>Starting with FreeBSD&nbsp;5.3-RELEASE, the X server that installs with FreeBSD is <bclass="APPLICATION">Xorg</b>, and is available for free, under a license very similar tothe FreeBSD license. Commercial X servers for FreeBSD are also available.</p></div><div class="SECT2"><h2 class="SECT2"><a id="AEN6083" name="AEN6083">5.2.3 The Window Manager</a></h2><p>The X design philosophy is much like the <span class="TRADEMARK">UNIX</span> designphilosophy, ``tools, not policy''. This means that X does not try to dictate how a taskis to be accomplished. Instead, tools are provided to the user, and it is the user'sresponsibility to decide how to use those tools.</p><p>This philosophy extends to X not dictating what windows should look like on screen,how to move them around with the mouse, what keystrokes should be used to move betweenwindows (i.e., <b class="KEYCAP">Alt</b>+<b class="KEYCAP">Tab</b>, in the case of <spanclass="TRADEMARK">Microsoft</span>&nbsp;<span class="TRADEMARK">Windows</span>), what thetitle bars on each window should look like, whether or not they have close buttons onthem, and so on.</p><p>Instead, X delegates this responsibility to an application called a ``WindowManager''. There are dozens of window managers available for X: <bclass="APPLICATION">AfterStep</b>, <b class="APPLICATION">Blackbox</b>, <bclass="APPLICATION">ctwm</b>, <b class="APPLICATION">Enlightenment</b>, <bclass="APPLICATION">fvwm</b>, <b class="APPLICATION">Sawfish</b>, <bclass="APPLICATION">twm</b>, <b class="APPLICATION">Window Maker</b>, and more. Each ofthese window managers provides a different look and feel; some of them support ``virtualdesktops''; some of them allow customized keystrokes to manage the desktop; some have a``Start'' button or similar device; some are ``themeable'', allowing a complete change oflook-and-feel by applying a new theme. These window managers, and many more, areavailable in the <tt class="FILENAME">x11-wm</tt> category of the Ports Collection.</p><p>In addition, the <b class="APPLICATION">KDE</b> and <b class="APPLICATION">GNOME</b>desktop environments both have their own window managers which integrate with thedesktop.</p><p>Each window manager also has a different configuration mechanism; some expectconfiguration file written by hand, others feature GUI tools for most of theconfiguration tasks; at least one (<b class="APPLICATION">Sawfish</b>) has aconfiguration file written in a dialect of the Lisp language.</p><div class="NOTE"><blockquote class="NOTE"><p><b>Focus Policy:</b> Another feature the window manager is responsible for is themouse ``focus policy''. Every windowing system needs some means of choosing a window tobe actively receiving keystrokes, and should visibly indicate which window is active aswell.</p><p>A familiar focus policy is called ``click-to-focus''. This is the model utilized by<span class="TRADEMARK">Microsoft</span>&nbsp;<span class="TRADEMARK">Windows</span>, inwhich a window becomes active upon receiving a mouse click.</p><p>X does not support any particular focus policy. Instead, the window manager controlswhich window has the focus at any one time. Different window managers will supportdifferent focus methods. All of them support click to focus, and the majority of themsupport several others.</p><p>The most popular focus policies are:</p><div class="VARIABLELIST"><dl><dt>focus-follows-mouse</dt><dd><p>The window that is under the mouse pointer is the window that has the focus. This maynot necessarily be the window that is on top of all the other windows. The focus ischanged by pointing at another window, there is no need to click in it as well.</p></dd><dt>sloppy-focus</dt><dd><p>This policy is a small extension to focus-follows-mouse. With focus-follows-mouse, ifthe mouse is moved over the root window (or background) then no window has the focus, andkeystrokes are simply lost. With sloppy-focus, focus is only changed when the cursorenters a new window, and not when exiting the current window.</p></dd><dt>click-to-focus</dt><dd><p>The active window is selected by mouse click. The window may then be ``raised'', andappear in front of all other windows. All keystrokes will now be directed to this window,even if the cursor is moved to another window.</p></dd></dl></div><p>Many window managers support other policies, as well as variations on these. Be sureto consult the documentation for the window manager itself.</p></blockquote></div></div><div class="SECT2"><h2 class="SECT2"><a id="AEN6138" name="AEN6138">5.2.4 Widgets</a></h2><p>The X approach of providing tools and not policy extends to the widgets seen on screenin each application.</p><p>``Widget'' is a term for all the items in the user interface that can be clicked ormanipulated in some way; buttons, check boxes, radio buttons, icons, lists, and so on.<span class="TRADEMARK">Microsoft</span>&nbsp;<span class="TRADEMARK">Windows</span>calls these ``controls''.</p><p><span class="TRADEMARK">Microsoft</span>&nbsp;<span class="TRADEMARK">Windows</span>and Apple's <span class="TRADEMARK">Mac&nbsp;OS</span> both have a very rigid widgetpolicy. Application developers are supposed to ensure that their applications share acommon look and feel. With X, it was not considered sensible to mandate a particulargraphical style, or set of widgets to adhere to.</p><p>As a result, do not expect X applications to have a common look and feel. There areseveral popular widget sets and variations, including the original Athena widget set fromMIT, <b class="APPLICATION"><span class="TRADEMARK">Motif</span>&reg;</b> (on which thewidget set in <span class="TRADEMARK">Microsoft</span>&nbsp;<spanclass="TRADEMARK">Windows</span> was modeled, all bevelled edges and three shades ofgrey), <b class="APPLICATION">OpenLook</b>, and others.</p><p>Most newer X applications today will use a modern-looking widget set, either Qt, usedby <b class="APPLICATION">KDE</b>, or GTK+, used by the <b class="APPLICATION">GNOME</b>project. In this respect, there is some convergence in look-and-feel of the <spanclass="TRADEMARK">UNIX</span> desktop, which certainly makes things easier for the noviceuser.</p></div></div><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="x11.html" accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="x-install.html"accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">The X Window System</td><td width="34%" align="center" valign="top"><a href="x11.html" accesskey="U">Up</a></td><td width="33%" align="right" valign="top">Installing X11</td></tr></table></div><p align="center"><small>This, and other documents, can be downloaded from <ahref="ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/">ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/</a>.</small></p><p align="center"><small>For questions about FreeBSD, read the <ahref="http://www.FreeBSD.org/docs.html">documentation</a> before contacting &#60;<ahref="mailto:questions@FreeBSD.org">questions@FreeBSD.org</a>&#62;.<br />For questions about this documentation, e-mail &#60;<ahref="mailto:doc@FreeBSD.org">doc@FreeBSD.org</a>&#62;.</small></p></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -