📄 457-459.html
字号:
<HTML>
<HEAD>
<TITLE>Special Edition Using Linux, Fourth Edition:Using X Windows</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!--ISBN=0789717468//-->
<!--TITLE=Special Edition Using Linux, Fourth Edition//-->
<!--AUTHOR=Jack Tackett//-->
<!--AUTHOR=Jr.//-->
<!--AUTHOR=Steve Burnett//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Que//-->
<!--CHAPTER=22//-->
<!--PAGES=457-459//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="454-457.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="459-460.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H4 ALIGN="LEFT"><A NAME="Heading21"></A><FONT COLOR="#000077"><I>xgrab</I>
</FONT></H4>
<P><TT>xgrab</TT> is an interactive front end for <TT>xgrabsc</TT>, an X Windows image grabber. <TT>xgrab</TT> was written by Bruce Schuchardt (<B>bruce@slc.com</B>) and many other people, who retain a loose copyright on the program. <TT>xgrab</TT> lets you grab arbitrary rectangular images from an <TT>xserver</TT> and writes them to files or commands (such as <TT>lpr</TT>) in a variety of formats.</P>
<P>Read the man page for <TT>xgrabsc</TT> for a description of the options presented by <TT>xgrab</TT>. After selecting options from the various categories presented, click OK to have <TT>xgrab</TT> run <TT>xgrabsc</TT> to let you grab an image from the screen. After you click OK, <TT>xgrab</TT>’s window disappears, and <TT>xgrabsc</TT> gains control until the grabbing process is finished. Afterward, the <TT>xgrab</TT> window reappears.</P>
<P><TT>xgrab</TT> responds to the standard application options, such as <TT>-_display</TT>. See the man page for X Windows for a complete list. You can also override the default <TT>xgrab</TT> settings in your .Xdefaults file. See the “Examples” section for instructions.</P>
<P><FONT SIZE="+1"><B>Resources</B></FONT></P>
<P>The <TT>xgrab</TT> resource file, XGrab.ad, contains a complete specification of the resources of all the widgets used in the <TT>xgrab</TT> window. <I>Widgets</I> are resource specifications for such items as buttons and menus. Global resources, such as default font and color, are at the bottom of the file.</P>
<P><FONT SIZE="+1"><B>Examples</B></FONT></P>
<P>The <TT>ToCommand</TT> output option may be used to pipe <TT>xgrabsc</TT> output to programs. The most common commands are <TT>lpr</TT> for PostScript output and <TT>xwud</TT> for X Windows Dump output. Programs that don’t accept piped input shouldn’t be used with <TT>ToCommand</TT>.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>TIP: </B>You can also get fancy and pipe the output through more than one command, such as <TT>tee screen.dmp| xwud</TT>, to store the grabbed image and get a preview window.<HR></FONT>
</BLOCKQUOTE>
<P>Default settings for <TT>xgrab</TT> can be made in your .Xdefaults file. For the Athena toolkit version of <TT>xgrab</TT>, toggle buttons can be set or unset through their <TT>.state</TT> attribute, and text-field strings can be set through their <TT>*string</TT> attribute. For the Motif toolkit version, which has diamond-shaped buttons for radio buttons, toggle buttons can be set or unset through their <TT>.set</TT> attribute and text-field strings can be set through their <TT>*value</TT> attribute. For example, to set the default paper size for PostScript output, put these lines in .Xdefaults (use <TT>xrdb</TT> to load them into the server):</P>
<!-- CODE SNIP //-->
<PRE>
XGrab*.pageWidthText*string: 8.5
XGrab*.pageHeightText*string: 11.0
</PRE>
<!-- END CODE SNIP //-->
<P>or
</P>
<!-- CODE SNIP //-->
<PRE>
XGrab*.pageWidthText*value: 8.5
XGrab*.pageHeightText*value: 10.0
</PRE>
<!-- END CODE SNIP //-->
<P>To set the default output type to <TT>XWD</TT>, put these lines in .Xdefaults:</P>
<!-- CODE SNIP //-->
<PRE>
XGrab*.ps.state: 0
XGrab*.xwd.state: 1
</PRE>
<!-- END CODE SNIP //-->
<H4 ALIGN="LEFT"><A NAME="Heading22"></A><FONT COLOR="#000077"><I>xlock</I>
</FONT></H4>
<P>Patrick J. Naughton (<B>naughton@eng.sun.com</B>) wrote <TT>xlock</TT> and released it to the world. The <TT>xlock</TT> program locks the local X Windows display until the user enters their password at the keyboard. While <TT>xlock</TT> is running, all new server connections are refused, the screen saver is disabled, the mouse cursor is turned off, and the screen is blanked and a changing pattern is put on-screen. If a key or a mouse button is pressed, the user is prompted for the password of the user who started <TT>xlock</TT>.</P>
<P>If the correct password is entered, the screen is unlocked and the X server is restored. When you’re typing the password, <Ctrl-Shift-u> and <Ctrl-Shift-h> are active as kill and erase commands, respectively. To return to the locked screen, click the small icon version of the changing pattern.</P>
<H3><A NAME="Heading23"></A><FONT COLOR="#000077">Having Fun with DOOM for Linux</FONT></H3>
<P>The best is always saved for last. Why run XFree86 under Linux? Because ID Software, Inc. has made a version of their shareware game DOOM available. While superseded by other first-person shooter games (such as Id Software’s Quake), DOOM is an enthralling shoot-’em-up adventure game still played the world over. Using realistic 3-D graphics, you’re a space marine going into an unholy, terror-filled space colony located on one of the moons of Mars. You must find your way through the labs and various sites, looking for your lost comrades. All you find instead are hideous monsters and other space marines who have turned against you.
</P>
<P>The X Windows version supplied on the accompanying Slackware CD-ROM in the /contrib directory is a complete shareware version. (The Red Hat distribution automatically installs the game during installation.) Although this version runs on 386 computers, it was built to run on high-end 486 systems. If you run DOOM on a 386 with a small amount of physical RAM, be prepared to be disappointed; the game will be too slow to be enjoyable. You need lots of horsepower to play DOOM under Linux.</P>
<H4 ALIGN="LEFT"><A NAME="Heading24"></A><FONT COLOR="#000077">Installing DOOM</FONT></H4>
<P>DOOM is installed by default with the Red Hat distribution and can be started by selecting xdoom from the Start, Programs, Games menu.
</P>
<P>Under Slackware, DOOM is stored in a series of archived files under the ///slackware/y2 directory. If you chose to install the games package while installing Linux, DOOM should already be installed. If not, you can use <TT>pkgtool</TT> to install it now, or you can perform the following steps:</P>
<DL>
<DD><B>1.</B> Copy the archived files under the ///slackware/y2 directory to an area on your hard drive.
<DD><B>2.</B> Change the directory to the base directory you want to use. The archives will extract the files to the usr/games/doom directory, so you may as well copy all the files in the doom directory on the accompanying Slackware CD-ROM to /usr with the following commands:
<!-- CODE SNIP //-->
<PRE>
cd /usr
cp /cdrom/contrib/linuxdoom/*.
</PRE>
<!-- END CODE SNIP //-->
<DD><B>3.</B> Decompress each file in the directory with this command:
<!-- CODE SNIP //-->
<PRE>
zip -d <I>filename</I>
</PRE>
<!-- END CODE SNIP //-->
<BR>where <I>filename</I> is the name of each file in the directory. This command creates two tar files.
<DD><B>4.</B> Unarchive each file with the <TT>tar</TT> command to create the necessary directories and files:
<!-- CODE SNIP //-->
<PRE>
tar -xfv archive-file
</PRE>
<!-- END CODE SNIP //-->
</DL>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR>• <B>See</B> “Using <TT>tar</TT>,” <B>p. 229</B><HR></FONT>
</BLOCKQUOTE>
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="454-457.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="459-460.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -