unx46.htm
来自「Unix Unleashed, Third Edition is written」· HTM 代码 · 共 2,180 行 · 第 1/5 页
HTM
2,180 行
<LI>The number of display units is character sizes for xterms.
<BR>
<BR></LI></UL>
<P>A pixel is the smallest unit available on a screen. Usually screens are displayed in 1024<B>´</B>768 pixels, or 2048<B>´</B>2048 pixels, or something similar. The size of a pixel onscreen is very much hardware dependent. A 200<B>´</B>200
window appears as different sizes on monitors with different resolutions.
<BR></P>
<P>The geometry parameter is of the form
<BR></P>
<PRE>heightxwidth[{+-}xoff{-+}yoff]</PRE>
<P>The height and width is usually given in pixels. In the case of xterms it is given in lines for the height and characters per line for the width. It is common to have a 24<B>´</B>80 xterm.
<BR></P>
<P>The xoff and yoff are offsets from the start of left and top edges of the screen, respectively. These represent the location of the window on the root window. The curly braces represent either the - or the + character, but not both.
<BR></P>
<TABLE BORDER>
<TR>
<TD>
<P>+xoff</P>
<TD>
<P>A positive offset from the left edge of the screen to the left edge of the window-xoff. A negative offset from the right edge of the screen to the right edge of the window.</P>
<TR>
<TD>
<P>+yoff</P>
<TD>
<P>A positive offset from the top edge of the screen to the top edge of the window-yoff. A negative offset from the bottom edge of the screen to the bottom edge of the window.</P></TABLE>
<P>Figure 46.10 shows a visual representation of the geometry. For example,
<BR></P>
<P>
<BR><B><A HREF="46unx10.gif">Figure 46.10. Window geometry.</A></B>
<BR></P>
<PRE>xterm -geometry -50+50 &</PRE>
<P>places the xterm on the top-right corner, 50 pixels from the right edge of the screen and 50 pixels from the top of the screen.
<BR></P>
<P>The following parameters specify the edges of the screen:
<BR></P>
<TABLE BORDER>
<TR>
<TD>
<P>-0-0</P>
<TD>
<P>Lower-right corner</P>
<TR>
<TD>
<P>-0+0</P>
<TD>
<P>Upper-right corner</P>
<TR>
<TD>
<P>+0-0</P>
<TD>
<P>Lower-left corner</P>
<TR>
<TD>
<P>+0+0</P>
<TD>
<P>Upper-left corner</P></TABLE>
<H3 ALIGN="CENTER">
<CENTER><A ID="I24" NAME="I24">
<FONT SIZE=4><B>Using the Window Menu</B>
<BR></FONT></A></CENTER></H3>
<P>Using the Window menu requires you to focus on a window. Let's look at a typical Window menu. It may be different on your screen, but the basic functionality listed here should exist for all later versions of Motif. Take the cursor to the Window menu
button and press the left button. The following menu (or something close to it) should appear:
<BR></P>
<TABLE BORDER>
<TR>
<TD>
<PRE>
<BR>Restore
<BR></PRE>
<TD>
<PRE>
<BR>Alt+F5
<BR></PRE>
<TR>
<TD>
<PRE>
<BR>Move
<BR></PRE>
<TD>
<PRE>
<BR>Alt+F7
<BR></PRE>
<TR>
<TD>
<PRE>
<BR>Size
<BR></PRE>
<TD>
<PRE>
<BR>Alt+F8
<BR></PRE>
<TR>
<TD>
<PRE>
<BR>Minimize
<BR></PRE>
<TD>
<PRE>
<BR>Alt+F9
<BR></PRE>
<TR>
<TD>
<PRE>
<BR>Maximize
<BR></PRE>
<TD>
<PRE>
<BR>Alt+F10
<BR></PRE>
<TR>
<TD>
<PRE>
<BR>Lower
<BR></PRE>
<TD>
<PRE>
<BR>Alt+F3
<BR></PRE>
<TR>
<TD>
<PRE>
<BR>Close
<BR></PRE>
<TD>
<PRE>
<BR>Alt+F4</PRE></TABLE>
<H3 ALIGN="CENTER">
<CENTER><A ID="I25" NAME="I25">
<FONT SIZE=4><B>Using the Keyboard and the Meta Key in X</B>
<BR></FONT></A></CENTER></H3>
<P>It's important to bring up this point about the keyboard and its special keys under X. Keyboards come in different flavors, and the most important key for using keystrokes in X can be radically different from one keyboard to another. On the PC-based
keyboards it is usually the Alt key, on Macintoshes it is the fan-shaped key, on Suns it's Left, Right, Alternate; on other keyboards it's completely different.
<BR></P>
<P>In short, when this chapter refers to the Meta key, it means your special key for your special keyboard. For a PC-based keyboard, this would be the Alt key. So do not look for a key called Meta on your keyboard. Where the chapter says Meta, use Alt,
fan, or whatever your keyboard uses.
<BR></P>
<P>Now you can invoke any item on this Window menu one of two ways:
<BR></P>
<UL>
<LI>Use the pointer. This is how you would click on the window menu and press Button1. Now do this:
<BR>
<BR>Move the cursor to the item you want and release Button1, or
<BR>
<BR>Press the Meta key and the character that is underlined in the menu. For moving a window you would press Meta+M. Note that this does not work on some Motif systems.
<BR>
<BR></LI></UL>
<HR ALIGN=CENTER>
<NOTE>
<IMG SRC="note.gif" WIDTH = 35 HEIGHT = 35><B>NOTE:</B> This may not always work. In Metro's version of Motif 1.2, the Meta+F7 key combination enables you to move a window, but the Meta+m key does not work at all. You may have a completely different
experience with your keyboard.
<BR></NOTE>
<HR ALIGN=CENTER>
<UL>
<LI>While the window has focus, press the Meta+function key combination. Then use the arrow keys on your keyboard to simulate the movement of the cursor, or just use the pointer.
<BR>
<BR></LI></UL>
<P>Note that some of these functions may not be available for a menu shown for an icon. You will not be able to size or minimize an icon. You will, however, be allowed to move, maximize, or close it.
<BR></P>
<H3 ALIGN="CENTER">
<CENTER><A ID="I26" NAME="I26">
<FONT SIZE=4><B>Using the </B><B><I>root</I></B><B> Menu</B>
<BR></FONT></A></CENTER></H3>
<P>Click Button3 while the cursor is in the root window. You will see a menu pop up on top of all the windows. This is known as the root menu. Keep in mind that this menu is very customizable and may look radically different on your machine. You will learn
all about creating your own menu later in this chapter in the section "Customizing mwm."
<BR></P>
<P>A typical root menu would list the following items:
<BR></P>
<PRE>"Root Menu"
New Window
Shuffle Up
Shuffle Down
Refresh
Utils >
Restart
Exit</PRE>
<P>While holding Button1 down, move the cursor down the list to the item you want to select. When you get to the menu item you want, release the button. If you do not want to select any items, move the cursor off the menu and release the button.
<BR></P>
<P>In the root menu list, the functionality could be as follows:
<BR></P>
<UL>
<LI>New Window starts a new xterm and sets focus to it.
<BR>
<BR></LI>
<LI>Refresh redraws the entire screen and all windows.
<BR>
<BR></LI>
<LI>Restart kills mwm and restarts it.
<BR>
<BR></LI>
<LI>Shuffle up and down shuffles the stacking order of the windows up or down. The window with focus is moved down to the bottom when shuffling down, and the next highest window is given the focus. The last window in the stack is brought to the top and
given the focus when shuffling up.
<BR>
<BR></LI>
<LI>The Utils item brings up another sub menu with more choices to select from. See the section "Customizing mwm" for details on how to set your menu items.
<BR>
<BR></LI>
<LI>Exit kills mwm and leaves you without a window manager. If this is the last command in your start-up script, your windowing session will terminate.
<BR>
<BR></LI></UL>
<HR ALIGN=CENTER>
<NOTE>
<IMG SRC="imp.gif" WIDTH = 68 HEIGHT = 35><B>TIP: </B>On occasion, you will come across a vendor that will not allow you to back up to the operating system. In this case, you can try the Ctrl+Alt+Backspace key combination to get back to the prompt.
<BR></NOTE>
<HR ALIGN=CENTER>
<H3 ALIGN="CENTER">
<CENTER><A ID="I27" NAME="I27">
<FONT SIZE=4><B>Working with Motif Clients</B>
<BR></FONT></A></CENTER></H3>
<P>Most programmers find the X Windows system libraries too basic to work with, so they use the next building block, called Toolkits. The most common interface toolkit is called the XtIntrinsics toolkit from MIT. This is called Xt. On top of Xt, you can
have other toolkits such as Motif or the OPEN LOOK Interface Toolkit (OLIT). When you are working with Motif, you are working with a Motif toolkit. In Motif you are working with Motif widgets.
<BR></P>
<P>Widgets help users program consistent user interfaces in Motif. By using widgets, users can quickly put together interfaces that have the same look and feel of all Motif applications.
<BR></P>
<P>Some widgets display information. Some widgets collect user input (mouse or keyboard) information. Some widgets react to user input by changing their appearance or by performing some programmed function. Some widgets are simply containers for other
widgets. All widgets can be customized in one form or another, whether it is appearance, font size or style, colors, or whatever other parameter is required.
<BR></P>
<P>All widgets of the same type have two data structures with information that describes their attributes: instance and class. The instance data structure contains information for a specific widget on the screen. The class information contains information
required for all widgets of the class.
<BR></P>
<P>Widgets are grouped into several classes. Each class depends on the type of functionality offered by the widget. Normally the internal functions of a widget are hidden from the applications programmer (encapsulation). A widget class shares a set of
functions and data structures for all widgets in that class. A new widget class can be derived from an existing widget class.
<BR></P>
<P>The newly derived class can inherit all the parent class' data structures and functions. A widget is created and destroyed during a Motif program execution.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?