📄 ch24.htm
字号:
back of the book.
<H3 ALIGN="CENTER"><A NAME="Heading8<FONT COLOR="#000077">Getting Started with
OpenWindows</FONT></H3>
<P>First, confirm that you have installed the XView system on your Linux system.
You need the <TT>xv</TT> disk set, which consists of two disks: <TT>xv1</TT> and
<TT>xv2</TT>. The files in this disk set are detailed in the following list:
<TABLE BORDER="0">
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>xv32_a.tgz</TT></TD>
<TD ALIGN="LEFT">Static libraries for developing XView 3.2 applications.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>xv32_so.tgz</TT></TD>
<TD ALIGN="LEFT">Shared libraries for XView 3.2.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>xv32exmp.tgz</TT></TD>
<TD ALIGN="LEFT">Sample programs for XView 3.2.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>xvinc32.tgz</TT></TD>
<TD ALIGN="LEFT">Include files for XView 3.2 programming.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>xvmenus.tgz</TT></TD>
<TD ALIGN="LEFT">Menus and help files for the OPEN LOOK window manager.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>xvol32.tgz</TT></TD>
<TD ALIGN="LEFT">XView 3.2 configuration files, programs, and documentation.</TD>
</TR>
</TABLE>
Install these packages for your XView system using the setup program as shown in
Chapter 3, "Installing Linux." If you have already done this installation,
you should have at least some files in <TT>/usr/openwin/bin</TT>.
<CENTER>
<H4><A NAME="Heading9<FONT COLOR="#000077">Starting OpenWindows</FONT></H4>
</CENTER>
<P>You need one of two files to get started with OpenWindows: either <TT>.xinitrc</TT>
or <TT>.xsessionrc</TT>.</P>
<P>The first time you run OpenWindows, a <TT>.xinitrc</TT> file is created in your
login directory (<TT>$HOME</TT>). If it already exists, you might have to edit it
somewhat. It's best to move all old X11 files you have to another directory, and
then merge the old and new files.
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading10<FONT COLOR="#000077"><B>TIP: </B></FONT>If you use <TT>xdm</TT>,
you should use <TT>.xsessionrc</TT> instead of <TT>.xinitrc</TT>, because <TT>xdm</TT>
doesn't look at your <TT>.xinitrc</TT> file.
<HR>
</DL>
<P>Refer to Chapter 23 for a detailed discussion on <TT>.xinitrc</TT> and installing
X on your Linux system.</P>
<P>Take the following steps to convert this <TT>.xinitrc</TT> file into one for using
OpenWindows:
<DL>
<DD><B>1.</B> Change the reference to your window manager to either <TT>olwm</TT>
or <TT>olvwm</TT>, depending on which window manager you want to use.<BR>
<B><BR>
2.</B> Ensure that the <TT>/usr/openwin/bin</TT> directory is in your path.<BR>
<B><BR>
3.</B> Set the environment variable <TT>OPENWINHOME</TT> to the directory where the
files for your <TT>openwin</TT> system will reside. This variable is usually set
to <TT>/usr/openwin</TT> when you log in.<BR>
<B><BR>
4.</B> Copy the <TT>.xinitrc</TT> file into <TT>.xsessionrc</TT> file if you are
going to use <TT>xdm</TT>.
</DL>
<P>There are other optional files you can create in your <TT>$HOME </TT>directory,
depending on which version of <TT>olwm</TT> or <TT>olvwm</TT> you use:
<UL>
<LI><TT>.openwin-init</TT>
<P>This file is used to initialize your desktop when you start OpenWindows with <TT>olwm</TT>
or <TT>olvwm</TT>. A sample <TT>.openwin-init</TT> file is shown in Listing 24.1.
This sample file shows how two <TT>xterm</TT>s and one clock application are started
every time you start a session. OpenWindows looks at a file called <TT>.openwin-init</TT>
in your home directory. If <TT>.openwin-init</TT> is not found in the home directory,
OpenWindows looks in the <TT>$OPENWINHOME/lib</TT> directory. The <TT>.openwin-init</TT>
file contains a list of applications to start by default.
</UL>
<CENTER>
<H3><A NAME="Heading11<FONT COLOR="#000077">Listing 24.1. A sample .openwin-init
file.</FONT></H3>
</CENTER>
<PRE><FONT COLOR="#0066FF">
#!/bin/sh
#
# Created by `xtoolplaces' on Fri Dec 9 23:10:23 1994
#
/usr/bin/X11/xterm -sb -sl 500 -j -ls -fn 7x14 -geom 82x24+45+52 &
clock -Wp 4 5 -Ws 172 52 -WP 224 533 +Wi &
</FONT></PRE>
<PRE><FONT COLOR="#0066FF">
xterm -e /bin/bash -geom 80x24+103+89 &
</FONT></PRE>
<UL>
<LI><TT>.openwin-menu*</TT>
<P>Look in <TT>$OPENWINHOME/lib</TT> (normally <TT>/usr/openwin/lib</TT>) for this
and other similarly named (<TT>openwin-menu-s</TT>, <TT>openwin-menu-d</TT>, and
so on) files without the leading period (<TT>.</TT>). We will discuss these files
in the "Environment Variables" section later in this chapter.
<LI><TT>.Xdefaults</TT>
<P>The <TT>.Xdefaults</TT> file applies to OpenWindows as well. You can put X Window
resource specifications in here. In particular, it is a good idea to include at least
</UL>
<PRE><FONT COLOR="#0066FF"> OpenWindows.FocusLenience: true
*Input: TRUE
</FONT></PRE>
<P>These enable non-ICCCM-compliant programs to receive input even if they forget
to ask for it.
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading13<FONT COLOR="#000077"><B>TIP: </B></FONT><TT>props</TT>,
the program that runs when you select Properties from the default root menu under
<TT>olwm</TT> or <TT>olvwm</TT>, writes your choices into <TT>.Xdefaults</TT>. Don't
put comments in <TT>.Xdefaults</TT>, because <TT>props</TT> deletes them.
<HR>
</DL>
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading14<FONT COLOR="#000077"><B>NOTE:</B> </FONT>Note that the mouse
speed for OpenWindows is best set in your <TT>.xinitrc</TT> with <TT>xset m</TT>.
See the man page for <TT>xset</TT> (<TT>man xset</TT> and <TT>xset -help</TT>) for
more information. Do not use the <TT>.startup.ps</TT> file for setting the mouse
speed as suggested by some texts. This is because the <TT>.startup.ps</TT> method
can cause more problems if not used correctly.
<HR>
</DL>
<P>Start your program up with the <TT>startx</TT> support. See Figure 24.1 for what
you should see when you start OpenWindows.
<H6></H6>
<P><A NAME="Heading15<A HREF="../art/24/24lnx01.jpg"><FONT COLOR="#000077">FIGURE
24.1.</FONT></A><FONT COLOR="#000077"> </FONT><I>The <TT>Xterm</TT> in OpenWindows.</I></P>
<P>
<CENTER>
<H4><A NAME="Heading16<FONT COLOR="#000077">SELECT and MENU</FONT></H4>
</CENTER>
<P>In OpenWindows (and Sun Workstations, for that matter), the left and right buttons
on a mouse are referred to as SELECT and MENU, respectively. Clicking the SELECT
button in a window selects a window. Clicking the MENU button in a window displays
any menu for that application.
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading17<FONT COLOR="#000077"><B>TIP:</B> </FONT>If you have a three-button
mouse, the middle button is called the ADJUST button. You can simulate an ADJUST
button on a two-button mouse by clicking both buttons together.
<HR>
</DL>
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading18<FONT COLOR="#000077"><B>TIP:</B> </FONT>The Shift-Button1
combination is also ADJUST, and Ctrl-Button1 is also MENU. These two combinations
are useful if you have a one-button mouse.
<HR>
</DL>
<CENTER>
<H3><A NAME="Heading19<FONT COLOR="#000077">Working Within OpenWindows and
olwm</FONT></H3>
</CENTER>
<P>Let's examine the borders on an <TT>Xterm</TT> in OpenWindows in greater detail.
(See Figure 24.2.) These borders are drawn by <TT>olwm</TT> and have special functionality.<BR>
<BR>
<A NAME="Heading20<A HREF="../art/24/24lnx02.jpg"><FONT COLOR="#000077">FIGURE
24.2.</FONT></A><FONT COLOR="#000077"> </FONT><I>OpenWindows borders. </I><BR>
<BR>
The resize handles (buttons) are the indentations on each window. You can resize
a window by pressing and holding SELECT over any of the resize corners and then dragging
the mouse to the new location.</P>
<P>Releasing the mouse button sets the new size of the window. If you hold down the
Ctrl key while you are dragging, the resize operation is constrained to resize vertically
or horizontally, depending on which direction you move first.</P>
<P>The Window button is the small box with a downward-pointing triangle near the
left end of the title bar. Clicking MENU over the Window button brings up the Window
menu. Clicking SELECT over the left mouse button on the Window button executes the
Window menu's default action. This usually closes the window into an icon. You can
change the window menu's default action by holding down the Ctrl key while manipulating
the Window menu.</P>
<P>An icon represents a closed window. You can still do most of the same operations
as with an open window. Moving and selecting icons with SELECT and ADJUST is exactly
the same as for open windows. A similar version of the Window menu is available on
an icon by pressing MENU. Double-clicking SELECT opens the icon. Icons cannot be
resized.</P>
<P>You can select a group of windows and icons by using the left or middle mouse
buttons over the workspace (the area of the screen outside of all windows and icons,
commonly known as the "root window"). Pressing either SELECT or ADJUST
and dragging the mouse defines a rubber band rectangle.</P>
<P>When you release the mouse button, you will be operating on the set of windows
and icons enclosed by this rectangle. If you created the rectangle using SELECT,
the windows and icons within will be selected, and all other objects will be deselected.
If you used ADJUST, the objects within will have their selected state toggled, and
any other windows and icons already selected will remain selected.
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading21<FONT COLOR="#000077"><B>TIP:</B> </FONT>Some OPEN LOOK pop-up
windows have a pushpin instead of a Window button. The pin is either in or out, and
you can click SELECT on the pin to change it to the other state. If the pin is out,
pressing a command button inside the window executes the command and then dismisses
(takes down) the window. If the pin is in, the window is "pinned" to the
workspace, and it remains on the screen even after you have pressed a command button
in the window. This enables you to press several command buttons in the same window.
Pulling the pin out (by clicking SELECT over it) dismisses the window immediately.
<HR>
</DL>
<CENTER>
<H3><A NAME="Heading22<FONT COLOR="#000077">Menus</FONT></H3>
</CENTER>
<P>XView supports menus of the form shown in Figure 24.3. This is a sample menu containing
options for you to choose. These menus are called pop-up menus.</P>
<P>Pop-up menus are operated using the MENU mouse button. There are two methods of
operating with an OPEN LOOK menu: the click-move-click method and the press-drag-release
method. You choose either method by clicking the MENU button (pressing and releasing
it quickly) or by pressing it down and holding it.</P>
<P>If you click the MENU button, a menu pops up and will stay up indefinitely. To
continue operating the menu, click the MENU button over a menu item. To dismiss the
menu, click the MENU button on an area of the screen outside the menu. To operate
menus in press-drag-release mode, press the MENU button and hold it down while you
move the mouse. The menu remains on the screen as long as you hold down the MENU
button. To execute an action, move the pointer over a menu item and release the mouse
button. To dismiss the menu, move the pointer outside the menu and release the MENU
button. Some menu items have a submenu. This is indicated by a right-pointing triangle
at the right edge of the item. To activate a submenu, click on the item (in click-move-click
mode) or move the pointer to the item and then move toward the right edge of the
menu (in press-drag-release mode).</P>
<P>Some menus have pushpins. If a menu has a pushpin, it will initially be in the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -