µÚ£´Õ¡¡ÊõÓïºÍ·ûºÅ
±¾Êé´ó²¿·ÖʹÓõÄÊõÓïÊÇÔÚµÚÒ»´ÎÅöµ½Ê±ÔÙ×÷½âÊÍ£¬µ«ÓÐЩÊõÓïÎÒÃÇÈÏ
ΪӦ¸ÃÏÈÔÚ±¾ÕÂ×÷Ò»¸ö½éÉÜ£¬´ËÍâÔÚ±¾ÕÂÖÐÎÒÃǽéÉÜÁËһЩ±¾ÊéʹÓ÷ûºÅµÄ
Ï°¹ß£¬ÒÔ¼°±¾ÊéÖÐËùÓСõÀýËùʹÓõĻúÆ÷³¡¾° (scenario)£®
4.1 ÊõÓï
ÔÚ£ØÖУ¬Ò»¸öÊÓ´° (WINDOW) ÊÇÖ¸Ó©Ä»ÉϵÄÒ»¿é³¤·½ÐÎÇøÓò£¬ËüµÄ±ßƽ
ÐÐì¶Ó©Ä»µÄ±ß£¬´ó¶àÊýµÄÊÓ´°ÒÔÒ»ÖÖÑÕÉ«×÷Ϊ±³¾°É« (background),¶øÒÔÁí
Ò»ÖÖÑÕÉ«×÷Ϊǰ¾°É« (foreground),ÀýÈçÒ»¸öµäÐ͵ÄÎÄ×ÖÊÓ´°£¬±³¾°É«Îª°×
É«£¬Ç°¾°É« (Ò²¾ÍÊÇÎÄ×Ö±¾Éí) ÔòΪºÚÉ«£®ÊÓ´°¿ÉÒÔÓÐÒ»¸ö±ß¿ò (border),
ͨ³£±ß¿òµÄÑÕÉ«ºÍ±³¾°É«²»Í¬. ÓÐЩÊÓ´°ÔÚÊÓ´°ÉÏ·½¿ÉÄÜÓÐÒ»¸ö±êÌâ°ô
(title bar) »ò¿ØÖÆ°ô (control bar), ÔÚijЩÇé¿öÏÂÓÃÒÔÏÔʾÓйØÕâ¸öÊÓ
´°µÄ×ÊѶ, Äã¿ÉÒÔ¶Ô¿ØÖÆ°ô×÷ijЩ¹Ì¶¨µÄ¶¯×÷À´¹ÜÀíÊÓ´°. ϵͳ»áÏÔʾһ¸ö
Ö¸±ê (pointer,ÓÐʱҲ³ÆΪÓαê (cursor))ÔÚÓ©Ä»ÉÏ, µ±ÄãÒƶ¯»¬Êó, Õû¸ö
өĻֻÓÐÒ»¸öÖ¸±êÔÚ¶ÔÓ¦Òƶ¯. Ïà¶ÔµÄ, Ó©Ä»ÉÏÐí¶àÎÄ×ÖÊÓ´°ÓµÓÐ×Ô¼º×¨Êô
µÄÎÄ×ÖÓαê, ÕâЩÓαêͨ³£Ö¸Ê¾ÄãÊäÈëÎÄ×ÖµÄλÖÃ. ÒÔÉϵÄÊõÓï¿ÉÓÉͼ 4-1
À´½âÊÍ.
©°--------------------------------------------©´
©¦ p. 42 ͼ 4-1 £¨£¿£¿£¿£© ©¦
©¦ ©¦
©¦ ©¦
©¦ ©¦
©¦ ͼ 4 - 1 ÊÓ´°µÄÔªËØ ©¦
©¸--------------------------------------------©¼
geometry -- λÖúʹóС
£ØÓõ½Ò»Ð©¼¸ºÎѧµÄÊõÓïÀ´ËµÃ÷Ò»¸öÊÓ´°µÄλÖúʹóС, ´ó²¿·ÝµÄ£Ø³Ì
ʽ½ÓÊÜÒ»¸öº¬ÓÐgeometryµÄÃüÁîÁÐ (command line) À´Æô¶¯ (stratup)ËüÃÇ
, Õâ¸öÃüÁîÁÐ˵Ã÷ÁËÕâ¸ö³ÌʽµÄÊÓ´°Óжà´ó, ÒÔ¼°ÔÚÓ©Ä»µÄÄÄÒ»¸öλÖÃÏÔʾ
. ͨ³£geometryµÄ¸ñʽÈçÏÂ:
¿í¶È x ¸ß¶È + XÆ«ÒÆÁ¿ + YÆ«ÒÆÁ¿
¿í¶ÈºÍ¸ß¶ÈµÄµ¥Î»ÎªÏñËØ (pixel,Ó©Ä»ÉϵÄÒ»µã) »ò×ÖÔª (character)
, ÊÓÓ¦ÓõÄ×´¿ö¶ø¶¨, ³ÌʽµÄ˵Ã÷ͨ³£»á¸æËßÄãÓÃʲ÷ᵥλ. ÉÏÊöµÄʽ×ÓÊÇ
˵Ã÷½¨Á¢Ò»¸ö´óСΪ¿í x ¸ß µÄÊÓ´°, ÊÓ´°µÄλÖÃΪ×ó±ß¿ò¾àÓ©Ä»×ó±ß½ç X
Æ«ÒÆÁ¿¸öÏñËØ, Éϱ߿ò¾àÓ©Ä»Éϱ߽ç YÆ«ÒÆÁ¿¸öÏñËØ. ÀýÈç¼ÙÉèÒ»¸ö³ÌʽÒÔ
×ÖԪΪÊÓ´°´óСµ¥Î», Ôò¸ñʽ
80 x 24 + 600 + 400
µÄÒâÒåΪ: ½¨Á¢Ò»¸ö 80 ×ÖÔª¿í 24 ×ÖÔª¸ßµÄÊÓ´°, ²¢ÇÒÊÓ´°µÄ×ó±ß¿ò¾àÓ©
Ä»×ó±ß½ç 600¸öÏñËØ, Éϱ߿ò¾àÓ©Ä»Éϱ߽ç 400¸öÏñËØ.
Èç¹ûÐèÒªµÄ»°, Ò²¿ÉÒÔÖ»Ö¸¶¨´óС»òÖ»Ö¸¶¨Î»ÖÃ, ³Ìʽ¶Ôδָ¶¨µÄ²¿·Ý
»áʹÓÃÔ¤ÉèÖµ (default value), »ò¸øÄãһЩÌáʾ, ÊÓʵ¼ÊÔÚϵͳÖÐÖ´ÐеÄ
×´¿ö¶ø¶¨.
»¬ÊóºÍÖ¸±êµÄÊõÓï:
ÓÐһЩÊäÈë×°ÖûáÔÚÖ´ÐУØʱÔÚÏÔʾÆ÷ÉÏÖ¸³öÓ©Ä»ÉÏÄãÓÐÐËȤµÄÏîÄ¿»ò
ÇøÓò,ͨ³£ÎªÒ»¸öÓÐÊý¸ö°´Å¥ (button) µÄ»¬Êó (Ò»°ãΪÈý¸ö°´Å¥,·Ö±ð³ÆΪ
×ó°´Å¥, Öа´Å¥, ÓÒ°´Å¥).µ±ÄãÒƶ¯»¬Êó, ϵͳ»á¶ÔÓ¦µØÒƶ¯Ó©Ä»ÉϵÄÖ¸±ê.
½ÓÏÂÀ´, ÎÒÃǶԻ¬ÊóÉϵÄÈýÖÖ²Ù×÷ÊõÓï×÷Ò»ÑϽ÷µÄ¶¨Òå:
Åö´¥°´Å¥ (clicking a button): °´Ï»¬ÊóµÄ°´Å¥Ëæ¼´ËÉ¿ª, °´Å¥±»°´
ϵÄʱ¼ä, ½öÓÐһ˲¼ä¶øÒÑ.
°´×¡°´Å¥ (pressing a button): ½«»¬ÊóµÄ°´Å¥°´ÏÂ, ÇÒÒ»Ö±±£³Ö°´×¡
°´Å¥µÄ״̬.
ËÉ¿ª°´Å¥ (releasing a button): ½«ÏÈÇ°°´×¡µÄ°´Å¥ËÉ¿ª.
ͨ³£Åö´¥°´Å¥±»ÓÃÀ´Ö¸¶¨Ó©Ä»ÉϵÄÒ»¸öÎï¼þ, °´×¡°´Å¥ÔÙËÉ¿ª°´Å¥ (Ò»°ãÔÚ
ÕâÆÚ¼ä»áÒƶ¯»¬Êó) ÍùÍùÓÃÀ´Òƶ¯»òÃè»æÒ»¿éÇøÓò.
ÍÏק (dragging) Ò»¸öÎï¼þ: ÀûÓÃÖ¸±êÖ¸¶¨Ò»¸öÎï¼þ, °´×¡°´Å¥, ±£³Ö
°´×¡×´Ì¬Òƶ¯Ö¸±êÖ±µ½Ä³´¦ÔÙËÉ¿ª°´Å¥¡£×öÕâÖÖ²Ù×÷ʱ, ϵͳͨ³£ÓÐһЩ
·½Ê½À´±íʾÎï¼þ±»Òƶ¯, ÀýÈçÔÚÍÏקһ¸öÎï¼þµÄÆÚ¼ä, ϵͳ»á½«Îï¼þÖÜ
Χ¼ÓÉÏÒ»¸öϸÏߵķ½¿ò.
ÎÒÃdz£³£ÀûÓÃÍÏק·½Ê½À´¸Ä±äÒ»¸öÎï¼þµÄ´óС, ͨ³£ÏµÍ³ÏÔʾ·½¿ò, ¸ù
¾ÝÄãµÄÍÏק¶¯×÷¸Ä±ä´óС, ´ËÖÖ·½·¨½Ð×÷ÏðƤ½î·¨ (rubber-banding). (Òò
Ϊ·½¿òºÃÏñÓÃÏðƤ½î×öµÄÒ»Ñù.)
ÔÚ±¾ÊéµÄͼÐαíʾ·¨ÖÐ, ÎÒÃÇÓÃÒ»¸öϼýÍ·±íʾ°´Å¥±»Ñ¹×¡, ÐéÏß±íʾ
»¬Êó (Ö¸±ê) µÄÒƶ¯, ÉϼýÍ·±íʾËÉ¿ª°´Å¥, ¼ûͼ 4 - 2
©°--------------------------------------©´
©¦ 43 Ò³ , ͼ 4 - 2 ©¦
©¦ ©¦
©¦ ©¦
©¦ ©¦
©¦Í¼ 4 - 2 »¬ÊóÍÏקµÄͼÐαíʾ·¨ ©¦
©¸--------------------------------------©¼
¼üÅ̵ÄÊõÓï:
±ê×¼µÄÖն˻ú¼ü: SHIFT, DELETE, BACKSPACE, ESC »ò ESCAPE, RETURN,
CAPSLOCK.
Óαê¿ØÖƼü: ²ÉÓÐÉÏÏÂ×óÓÒ¼ýÍ·µÄ¼ü, Èç UP, DOWN, LEFT, RIGHT.
ÌØÊâ¼ü: ѹסCTRL»òCONTROL ¼ü, ÔÙ°´ÆäËüµÄ¼ü (ÀýÈç A¼ü),ÓÃCTRL-A
±íʾ, ÓÐЩÖն˻úÓÐMETA¼ü, ҲͬÑùµÄÓÃMETA-A±íʾ.
4.2 ·ûºÅ
Á¬ÐøÊýÁÐ
ÔÚһЩÇé¿öÏÂ, ÄãÊäÈëµÄÃüÁîÁлòϵͳÊä³öµÄÎÄ×Ö, ÒòΪ̫³¤¶øÎÞ·¨ÔÚ
ͬһÁжø±ØÐè·ÖΪÊýÁÐ, Èç¹ûËüÊÇshell ÃüÁî, »òÊÇÒ»¶Î CÓïÑÔ³ÌʽÂë, ÎÒ
ÃÇÔÚµÚÒ»ÁеÄ×îáá¼ÓÉÏÒ»¸öµ¹Ð±Ïß(backslash"\")áá, ÔÚÏÂÒ»ÁмÌÐø, ÀýÈç:
mkfontdir/usr/lib/X11/fonts/misc\
/usr/lib/X11/fonts/15dpi\
/usr/lib/X11/fonts/100dpi
È»¶ø¼«ÉÙÊýµÄÇé¿öÏÂ, ÎÒÃÇÓ÷ûºÅ "(contd.)" ±íʾ±¾ÁÐÒòÅÅ°æÏÞÖƵÄÔµ¹Ê
ÔÚÏÂÁмÌÐø,Èç:
PID TT STAT TIME COMMAD
1901 c0 S 0:01 x :0
1902 c0 S 0:01 xterm -geometry +1+1 (contd.)
-n login -display unix:0 -c
1903 p1 S 0:00 -sh (csh)
µ±£Ø×°Éèʱ, ÐèÒª¶¨Ò»Ð©Ä¿Â¼Ê÷ (directory tree). ÎÒÃÇ°ÑĿ¼Ê÷µÄ
¶¥¶Ë¶¨Îª$TOP, ÔÚÎÒÃǵÄϵͳÖÐ, $TOP¶ÔÓ¦µÄĿ¼Ϊ /usr/local/src/X11
£¬ÏàͬµØ£¬¼ÒĿ¼ (home directory) ²Î¿¼×Ô $HOME¡£
4.3 ±¾Êé¡õÀýµÄ³¡¾°
±¾ÊéʹÓôóÁ¿µÄ¡õÀýÀ´ËµÃ÷£¬ÕâЩ¡õÀýÊǼÙÉèÎÒÃÇÔÚÒ»¸öÓµÓÐÏÂÁлúÆ÷
µÄÍø·Ï¹¤×÷£º
venus ²ÊÉ«Ó©Ä»£¬ÆÕͨ½âÎö¶È
saturn¡¡¡¡µ¥É«Ó©Ä»£¬ÆÕͨ½âÎö¶È£¬µµ°¸¹¤×÷Õ¾(file server)
mars¡¡¡¡¡¡²ÊÉ«Ó©Ä»£¬¸ß½âÎö¶È
neptune ·ÇͼÐÎÓ©Ä»£¬ÓµÓдŵú´¢´æ×°Ö㬵çÄÔ¹¤×÷Õ¾(computer server)
ÎÒÃÇËùÓµÓеŤ×÷Õ¾ÊÇ venus£¬´ó²¿·ÖµÄʱ¼äÎÒÃÇʹÓÃËü£¬µ±ÎÒÃÇÐèÒª¸ü¸ß
µÄ½âÎö¶È»òÔÚµ¥É«Ó©Ä»¼ì²éijЩÇé¿öʱ£¬ÎÒÃÇ»áʹÓà mars »ò saturn,µ±È»
£¬ÎÒÃÇ»áÔÚÎÒÃÇ×Ô¼ºµÄ¹¤×÷Õ¾£¬ÒÔÔ¶¶Ë(remote)µÄ·½Ê½Ê¹ÓÃËùÓеĻúÆ÷£®
saturnÊÇ venusºÍ mars µÄµµ°¸¹¤×÷Õ¾, ÈýÕßÖ®¼ä¹²ÏíÏàͬµÄµµ°¸ÏµÍ³
£¬( ÀýÈ磬ËüÃÇ´æÈ¡µµ°¸ $HOME/.login ʱ£¬Êµ¼ÊÉÏÊÇͬһ¸öµµ°¸) £®neptune
ÓµÓÐËü×Ô¼ºµÄµµ°¸ÏµÍ³£¬²»ºÍÆäËûµÄ¹¤×÷Õ¾¹²Ïí£®
4.4 ±¾ÊéʹÓõŤ×÷Õ¾¼Ü¹¹
ÔÚ±¾ÊéÖУ¬ËùÌÖÂÛµÄһЩ¡õÀý¡¢³ÌʽÃû³Æ¡¢³ÌʽÂëµÄƬ¶Î¿ÉÄܺÍÄãϵͳ
µÄÓÐЩ²îÒ죬ÄÇÊÇÒòΪϵͳ²»Í¬µÄ¹Øϵ£¬±¾Êé¼ÙÉèʹÓõÄϵͳΪ£º
£®Ó²Ì壺SUN 3/50 ¹¤×÷Õ¾£¬Èý¸ö°´Å¥µÄ»¬Êó£¬Ó©Ä»´óСΪ 1152x900¸ö
ÏñËØ£¬µ¥É«Ó©Ä»¡£
£®×÷ҵϵͳ£ºSunOS 3.4, ÒÔ BSD 4.2 Unix Ϊ»ù´¡¡£
£®ÊÓ´°ÈíÌ壺£ØµÄ MIT±ê×¼°æ£¬µÚ11°æµÚ3 ´Î·¢ÐС£