¡¡¡¡xedit.vpaned.row1.Help.background:navy
ÊÇÒ»¸öÍêÕûµÄ¹æ¸ñµ«Êǽ«Ö»Ó°Ïìµ½ÃüÃûµ±ÖеÄÎï¼þÃû³ÆµÄÊôÐÔ¡££¨±¾ÀýÖУ¬
¾¡¹ÜÊÂʵÉÏÊÇ´óдµÄ£¬"Help"ÊÇÒ»¸ö³ÉÔ±Ãû³Æ£¬ËüµÄÀà±ðÊÇ"Command" ¡££©
³ý·ÇÄãÓÐһЩ·Ç³£ÌرðµÄÐèÇó£¬×îºÃ²»ÒªÓþäµãµ±·Ö¸ôºÅ£¬¾¡Á¿ÒÔÐǺŴú
Ì棬Èç´Ë¿É¼õÉÙ´íÎó·¢ÉúµÄ¿ÉÄÜ£¬¶øÇÒÔÚÖØдӦÓóÌʽʱ£¬±È½Ï²»»áÊܵ½½×²ã
½á¹¹¸Ä±äµÄÓ°Ïì¡£
ÉÏÊöµÄ¶ÔÓ¦½á¹¹½âÊÍÁËΪʲ÷áÄã¿ÉÒÔÊäÈëÆæ¹ÖµÄ¹æ¸ñ£¬»òÕßresource
ºÍÊôÐÔÉÐ䶨Ò壺Òâ¼´Ò»¸ö¹æ¸ñÖ»Óе±Ó¦ÓóÌʽ²éѯ×ÊÁÏ¿â²Å»á¸½Öø£¬ÉõÖÁ·¶
ΧµÄÒâÒåÒ²ÊDz»×ãµÀµÄ -- ¹æ¸ñ¶ÔÓ¦»ò²»¶ÔÓ¦µ½²éѯ¡£
15.3.4 µ±¶àÖÖResorce¹æ¸ñ¶ÔÓ¦µÄ¾ÓÏÈ(precedence) ¹æÔò
ÎÒÃÇÏÖÔÚÓÐÒ»¸ö·Ç³£µ¯ÐԵķ½·¨À´Ö¸¶¨Ó¦ÓóÌʽµÄresource£¬µ«ÕýÒòËüÌ«
Áýͳ£¬ÒÔÖµ±Ò»¸öÓ¦ÓóÌʽ²éѯresources ×ÊÁÏ¿âʱ³£³£ÓÐÊýÖÖ¹æ¸ñÓëÖ®¶ÔÓ¦£¬
ÈçºÎ½â¾öÄØ£¿
¼òµ¥µØ˵£¬Èç¹ûͬʱÓг¬¹ýÒ»¸ö¹æ¸ñ¶ÔÓ¦£¬Ôò×î¾ßÌåµÄ(specific)Ò»¸ö»á
±»Ê¹Óã¬Resource ManagerÓÐÒ»×éµÄ¾ÓÏȹæÔòÓÃÀ´¾ö¶¨ÊÇ·ñÒ»¸ö¹æ¸ñ½ÏÁíÒ»¸ö
¾ßÌå¡£
£®Ê¹ÓþäºÅΪ·Ö¸ôºÅ½ÏʹÓÃÐǺÅΪ¾ßÌ壬ÀýÈ磺*Command.Foreground ½Ï
*Command*Foreground Ϊ¾ßÌå¡£
£®³ÉÔ±Ãû³Æ½ÏÀà±ðÃû³Æ¾ßÌ壬ÀýÈ磺*foreground ½Ï*Foreground ¾ßÌå¡£
£®Ö¸¶¨Ò»¸öÔªËؽÏÊ¡ÂÔËü¾ßÌ壬ÀýÈ磺xmh*command*foreground½Ï
xmh*foreground¾ßÌå¡£
£®ÔªËØ¿¿½ü¹æ¸ñ×ó±ßµÄÐǺŽϿ¿½üÓұߵľßÌ壬ÀýÈ磺xmh*foreground½Ï
*command*foreground¾ßÌå¡£
ÕâЩ¹æÔòÏ൱ֱ½Ó£¬ËüÃǴ󲿷ݿÉÓÃÁíÒ»ÖÖ·½·¨À´ËµÃ÷£º¡±Èç¹ûÒ»¸ö¹æ¸ñ
¶ÔÓ¦µ½ÁíÒ»¸ö¹æ¸ñ¶øΪÆä×Ó¼¯ºÏÕߣ¬ÔòÇ°Õß½ÏááÕß¾ßÌå¡£¡±
15.3.5 ÔÚToolkit ³ÌʽÖÐÓ¦ÓóÌʽResource
ͨ³£Ò»¸öÓ¦ÓóÌʽʹÓÃResource ManagerÀ´¶¨Òå³Ìʽ½×²ãÖÐwidgetµÄÊôÐÔ
Ô¤ÉèÖµ£¬µ«ÓÐʱÐèÒªÓкÍwidget²»Ö±½ÓÏà¹ØµÄÉ趨ԤÉèÖµ£¨»ò´«Öµ£©µÄÄÜÁ¦¡£
ΪÁË´ïµ½Õâµã£¬Toolkit ÌṩÁËÒ»¸ö½Ð×öApplication ResourceµÄÉèÊ©£¬
ËüºÍ·ÇToolkit Ô¤ÉèµÄÍâ±íÔÔòÏàͬ -- Ó¦ÓóÌʽ¶¨ÒåÁËËü±¾ÉíÑ¡ÔñµÄÊôÐÔ¡£
Àà±ðÃû³ÆÒ²Ïàͬ£¬ËùÒÔÊÂʵÉÏÕâЩÊôÐÔºÍÒ»°ã³£¼ûµÄ½×²ãûÓÐʲ÷᲻ͬ¡£
xmanʹÓõ½Ò»µãÕâ¸öÉèÊ©£¬ËüÈÃÄãÄÜÔÚÇóÖúÊÓ´°(help window) Ö¸¶¨²»Í¬
µÄ±¾Îĵµ°¸£¬ÊÇ·ñÔÚÖ÷Ñ¡ÔñÊÓ´°ÖÐÖ¸¶¨Ò»¸öÄãÒªµÄÊÓ´°£¬»òµ±³ÌʽÆô¶¯Ê±Ö±½Ó
½øÈëÒ»¸öÖ¸ÄÏÒ³µÈ¡££¨²é¿´Ö¸ÄÏÒ³£¬ÔÚ£Ø DefaultÄÇÒ»½Ú£¬Ëü»áÃ÷È·µØÁгöËü
µÄ¡±Ó¦ÓóÌʽÌض¨µÄresources ¡±£©¡£
15.3.6 ResourceºÍnon-toolkit Ó¦ÓóÌʽ
²¢·ÇËùÓеijÌʽ¾ùʹÓÃToolkit £¬µ«Toolkit ¼¸ºõÕÆÎÕÁËËùÓжÔÒ»¸öÓ¦ÓÃ
³ÌʽµÄresource¹ÜÀí£¬ÌرðÊÇÓ¦ÓóÌʽµÄwidget½á¹¹¶¨ÒåÁËÎï¼þºÍ×ÓÎï¼þµÄ½×
²ã£¬²¢ÄÜÊʵ±µØ²éѯResource Manager¡£µ«ÊÇnon-Toolkit Ó¦ÓóÌʽҪÈçºÎʹ
ÓÃResource Manager£¿
´ð°¸ÊÇÓ¦ÓóÌʽֻÐèÃ÷È·µØ²éѯÿһ¸öËüÓÐÐËȤµÄÊôÐÔ¡£ÉÔÔçÎÒÃÇÔø˵¹ý
Resource Manager¶ÔresourceÎÞÏÞÖÆ£¬Òò´ËÓ¦ÓóÌʽÄÜʹÓÃÈκÎËüÏëÒªµÄÊôÐÔ
Ãû³Æ£¬Ö»Òª³ÌʽµÄÎļþ¸æËßʹÓÃÕßËüÃÇÔں䦣¬ËüÃǾÍÈçͬÆäËüµÄÓ¦ÓóÌʽһ
Ñù¡£
xcalc Ó¦ÓóÌʽÊÇÒ»¸ö²»Ê¹ÓÃToolkit µÄ³Ìʽ·¶Àý£¬ËüÒ²ÀûÓÃÉÏÊö·½Ê½ÕÆ
ÎÕresource¹æ¸ñ¡£
Óм¸µãÐèҪעÒ⣺
£®´ËÖÖÐÍ̬µÄÔ¤ÉèֵûÓÐÀà±ð¡£
£®³ÌʽÒÔÀàËÆÀà±ðÃû³Æ£¨Ò²¾ÍÊÇ˵£¬µÚÒ»¸ö×Öĸ´óд£©À´¶¨ÒåÊôÐÔ£¬ÀýÈç
xcalc ʹÓÃBackground, Foreground, BorderWidth µÈµÈ¡£
£®Èç¹û´óСд´íÎó£¬ÄãµÄ¹æ¸ñ²»»á¹¤×÷£¬ÀýÈ磺¹æ¸ñ
xcalc.foreground:green
»á±»xcalc ºöÂÔ¡£
£®¼´Ê¹Õâ¸ö³Ìʽ¶¨ÒåµÄÊôÐÔ²¢·Ç½×²ãµÄÒ»²¿·Ý£¬ÄãÈÔÄÜʹÓÃÐǺŵ±·Ö¸ôºÅ£¬
ÀýÈ磺
xcalc*Foregroundrange
15.4 Resources µÄÐÍ̬----ÈçºÎÖ¸¶¨Öµ
Ö±µ½ÏÖÔÚÎÒÃÇÈÔȻֻ¿´resource¹æ¸ñµÄ¡±×ó°ë±ß¡±£¬¶øºöÂÔÁËÖµ(value)
µÄ²¿·Ý£¬»òÖ»ÊÇÓÃÉ«²ÊÃû³Æ¡£ÏÖÔÚ£¬ÎÒÃÇÀ´¿´Ò»¿´¡±ÓÒ°ë±ß¡±£¨ÖµµÄ²¿·Ý£©¡£
¼òµ¥µØ˵£¬ÖµÖ»ÊÇÒ»¸ö´«µÝµ½Ó¦ÓóÌʽµÄ±¾ÎÄ×Ö´®£¬ºÍResource Manager
ÍêÈ«Ïà¹Ø£¬Ö®áᣬӦÓóÌʽÒÔ´ËÖµ×öËüËùÒª×öµÄÊ¡£µ±È»£¬ÔÚʵ¼ÊµÄ²Ù×÷ÉÏ£¬
Ó¦ÓóÌʽ±ØÐëÃ÷È·µØ×öijЩÊ£¬¶øToolkit µÄÈ·Ò²ÕÆÎÕÁË´ó¶àÊýÕâÒ»²¿·ÝµÄ¹¤
×÷£¬ËùÒÔÄã¿É»ñµÃÒ»ÖµؽéÃæ¡£
ËùÒÔµ±ÎÒÃÇÒÔÒ»¸öResourceÖµ´«µÝÎÒÃÇËùÐèʱ£¬Êµ¼ÊÉÏÎÒÃÇʹÓÃÉÙÊýµÄÐÍ
̬£¬ÄãÒÑ¿´¹ýËüÃǵĴ󲿷ݣ¬ÄãÔÚÈκεط½¾ù¿ÉÒÔresource¹æ¸ñÀ´Ê¹ÓÃËüÃÇ£º
Colours £¨É«²Ê£©£ºÎÒÃÇÒѹ㷺µÄʹÓùýËüÃÇ----ÎãÐè¶à×ö½âÊÍ¡£
Fonts £¨×ÖÐÍ£©£ºÔÚÒ»°ãµÄ·½·¨ÎÒÃÇÒÑÃèÊö¹ý£¬ÔÚresource¹æ¸ñ£¬ÄãÒ²
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] ÏÂÒ»Ò³
¿ÉʹÓÃͨÓÃ×ÖÔª»òÈ«Ãû¡£ÀýÈ磺
*Font: *-courier-medium-r-*-140-*
xterm*Font: 8*13
xterm*boldFont: 8*13
demo*font: *-courier-medium-r-*-240-*
demo*boldFont: *-courier-bold-r-*-240-*
É趨һ¸öÕûÌåÐÔµÄÔ¤Éè×ÖÐÍ£¬µ«Ê¹ÓÃÒ»¸öÕý³£µÄxterm Ö¸¶¨Ò»¸öÃ÷È·µÄÒ»¶Ô×Ö
ÐÍ£¬ºÍÒ»¶Ô±»demoÓ¦ÓóÌʽʹÓõĽϴóµÄ×ÖÐÍ¡££¨¿ÉÓÃxterm -name demo£©
Numeric quantities£ºÔÚ²»Í¬µÄÇéÐΣ¬ÀýÈ磺
xclock*update:30
xclock*update:60
BorderWidth:10
xlogo*Width:120
xterm*saveLines:200
Boolean values£ºÖ¸¶¨"yes" »ò"no"£¬Äã¿ÉÒÔʹÓÃ"yes" ¡¢"on"¡¢"true"
ºÍ"no"¡¢"off" ¡¢"false" £¬ÀýÈ磺
xterm*scrollBar:false
xman*bothShown:true
Cursor names£ºÖ¸¶¨ÔÚ/usr/include/X11/bitmapsÖаüº¬ÄãËùÒªµÄÓαêµÄ
µµ°¸Ãû³Æ£¬ÀýÈ磺
xterm*pointer Shape:cntr_ptr
×¢Ò⣺Èç¹û±»Ö¸¶¨µÄÓα겻°üº¬ "Èȵã" (hot spot)£¬Äã¿ÉÄܵõ½´íÎóѶ
Ï¢¡£
Geometry spec £ºÈ«²¿»ò²¿·Ý¡£
xcalc*Geometry: 180*240-0-0
xcolock*Geometry: -0+0
É趨һ¸ö¼ÆËãÆ÷µÄÔ¤Éè³ß´ç¼°ÆäÆôʼλÖÃÔÚÓÒϽǣ¬Ê±ÖÓµÄÆôʼλÖÃÔÚÓÒÉϽǡ£
¼üÅÌת»»(keyboard translations) £º°²ÅÅÌض¨µÄ×Ö´®¸øÒ»¸ö¼ü£¬»ò°²ÅÅ
ÌØÊ⣨·ÇÓ¡³ö£©¶¯×÷¸ø¼ü»ò°´Å¥£¬ÕâÏ൱µÄ¸´ÔÓ£¬µÚ£±£·Õ»áÈ«ÃæרÃÅÌÖÂÛËü¡£
Pixmaps £ºPixmaps ÊÇÏñλԪӳÏñÎÆÀí(texture) Ò»°ãµÄͼÑù£¬ÏñλԪӳ
Ïñ»òÓαêÒ»ÑùµÄÖ¸¶¨ËüÃÇ¡£µ±ÄãÔÚµ¥É«Ó©Ä»ÉϹ¤×÷ʱ·Ç³£·½±ã£¬Ò»µ©Îª²»Í¬Àà
±ðµÄwidgetÉ趨±³¾°£¬Äã±ãÄÜ¿´µ½Ó¦ÓóÌʽÔںδ¦Ê¹Óõ½ËüÃÇ¡£ÀýÈ磺ÒÔϵÄ
resource¹æ¸ñ£º
*Pixmap: mensetmanu;
List*backgroundPixmap: scales
Box*backgroundPixmap: cntr_ptr
Command*backgroundPixmap: sipb
µ¼ÖÂÄãµÄÓ¦ÓóÌʽ¿´ÆðÀ´ºÜÌÖÑá----ÄãµÃµ½ÔÓÂÒµÄÊÓ´°£¬Ã¿Ò»¸ö¿Õ¼äÒÔij
ÖÖͼÑùÌîÂú----µ«ËüÃǵÄÈ·ÔÚ×÷Óã¬ÓÐʱÕâÑù×ö¿ÉÄÜ»áÓÐÓã¬backgroundPixmap
ÊÇÀà±ðPixmapµÄÊôÐÔ¡£
15.5 ½áÂÛ
ÔÚÕ⸴ÔÓµÄÒ»ÕÂÖУ¬Äã¿´µ½ÁËʲ÷áÊÇ¡±resource¡±£¬ºÍÄãÈçºÎʹÓÃËüÃÇÖ¸
¶¨Ô¤ÉèÖµ»òÆäËüµÄÖµ¸øÓ¦ÓóÌʽ£¬ÎÒÃǹ´»æ³öToolkit ´óÖÂÂÖÀª£¬ºÍwidgetµÄ
½×²ã¹ÛÄ²¢ËµÃ÷ÈçºÎÀûÓÃwidget½á¹¹»òÓ¦ÓóÌʽµÄÆäËüÎï¼þÀ´É趨½Ï´ó·¶Î§
µÄÔ¤ÉèÖµ¡£´ÓÕâÀïÎÒÃǽéÉÜÀà±ðµÄ¸ÅÄËü¿ÉÒÔÈÃÄãÖ¸¶¨Îï¼þ¶øÎÞÐèÖªµÀËüÃÇ
¸ö±ðµÄÃû³Æ£¬½ÓÖø̸µ½Resource ManagerºÍËüÔÚ×ÊÁÏ¿âÖжÔÓ¦resource¹æ¸ñµÄ
¹æÔòÒÔ±ã³Ìʽ²éѯԤÉèÖµ£¬×îáᣬÎÒÃÇ´óÖÂ˵Ã÷ÈçºÎÖ¸¶¨ËüÃǵÄÖµ¡£
±¾ÕÂרעì¶resources ½á¹¹ÔË×÷µÄ¹æÔò£¬ÏÖÔÚÊǸæËßÄãÈçºÎÔÚϵͳÏÂʵ¼Ê
ʹÓõÄʱºòÁË¡£ÔÚÏÂÒ»Õ£¬ÎÒÃǸæËßÄãÈçºÎ¼°Ôںδ¦´¢´æÔ¤Éè¹æ¸ñ£¬Ò²¾ÍÊÇ˵
£¬ÈçºÎ¹ÜÀíÎÒÃÇÇ°ÊöµÄ¡±resource×ÊÁϿ⡱¡£ÔÚÕâÕÂÖ®áᣬÎÒÃǽâÊÍÈçºÎʹÓÃ
resourceÀ´¶¨ÖÆÄãµÄ¼üÅÌ¡£
=====
µÚ£±£¶Õ ʵ¼ÊµÄʹÓÃResource
Ç°Ò»Õ½âÊ꣯ resourcesµÄ¹æÔò----Ϊʲ÷áÐèÒªËüÃÇ£¬½á¹¹ÈçºÎ¹¤×÷ºÍ
resource¹æ¸ñµÄ¸ñʽ¡£±¾ÕÂÖмÌÐøÌÖÂÛresources £¬µ«½ÏÇ¿µ÷ʵÓÃÐÔ£ºÎÒÃǸæ
ËßÄãÈçºÎ¼°ºÎ´¦É趨resources Ô¤ÉèÖµ£¬À´Ó°ÏìÄãµÄϵͳµÄÒ»²¿·Ý»òÈ«²¿¡£ÔÚ
±¾Õ½áÊøÇ°£¬ÎÒÃǽ«Íê³ÉһЩ·¶Àý£¬µã³öÄã¿ÉÄܳ£¼ûµÄ´íÎ󣬲¢¸æËßÄãÈçºÎ¿Ë
·þËüÃÇ¡£
ÔÚÕâЩ·¶ÀýÖУ¬ÎÒÃǼÙÉèÄã×Ô¼ºµÄ¹¤×÷Õ¾½Ð×övenus £¬²¢ÇҴ󲿷Ýʱ¼äÄã
ÊÇʹÓÃËü¡£´Óvenus µÄÏÔʾÆ÷£¬Äã¿ÉÔÚÔ¶·½µÄ»úÆ÷saturnºÍmarsÉÏÖ´ÐÐclient
Ó¦ÓóÌʽÇÒºÍvenus ¹²Ïíµµ°¸ÏµÍ³£»neptune Ôò²»¿É£¬ÎÒÃÇÔøÔÚµÚ£´ÕÂÃèÊö¹ý¡£
µ±ÄãÔÚ±¾ÕÂÖÐʱ£¬¼ÇµÃresource½á¹¹ÊÇ£º´«µÝ×ÊѶ¸øÓ¦ÓóÌʽ£¬Í¨³£ÕâЩ
×ÊѶÊÇÓÃÀ´´«µÝһЩ±È½Ï¸ÐÐËȤµÄÔ¤ÉèÖµ£¨ÀýÈçÉ«²ÊºÍ×ÖÐÍ£©£¬µ«Ö»ÒªÓ¦ÓóÌ
ʽȡµÃе÷Äã¾ÍÄÜʹÓÃÕâÖÖÉèÊ©´«µÝÈκÎ×ÊѶ¡£ËùÒÔÎÒÃÇÒ»°ã×´¿öÏÂÇãÏò춰Ñ
¡±resource¹æ¸ñ¡±¡±Ô¤ÉèÖµ¡±(defaults)¡±resource¡±ÕâÈý¸öÃû´ÊÊÓΪͬһº¬
Òâ¡£
16.1 Ôںδ¦´¢´æresourceµÄÔ¤ÉèÖµ
ÔÚÉÏÒ»ÕÂÎÒÃÇÖ»¸æËßÄãÊäÈëresource¹æ¸ñµ½¡±Ò»¸ö×ÊÁϿ⡱£¬µ«Î´¸æËßÄã
ÈçºÎ×ö¡£ÊÂʵÉÏÓм¸¸ö²»Í¬µÄµØ·½¿ÉÒÔ´¢´æÔ¤ÉèÖµ£ºÕâЩ¡±µØ·½¡±Í¨³£ÊÇÒ»¸ö
Äã¿ÉÒÔÓÃÈκαà¼Æ÷Ð޸ĵļòµ¥µÄÎÄ×Öµµ°¸£¬µ«ÓÐÒ»¸öÌØÊâµÄλÖÃÐèÒªÌØÊâµÄ
ÉÏÒ»Ò³ [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] ÏÂÒ»Ò³
¹¤¾ßÀ´É趨Ëü£¬ÎÒÃÇÏȺܿìµÄ¸øÄãÒ»¸ö¸ÅÄÔÙÌÖÂÛϸ½Ú²¿·Ý¡£
Ê×ÏÈËüµÄ¼Ü¹¹·Ç³£µÄ¸´ÔÓ£º°üº¬ÃüÁîÁÐÑ¡Ïî×ܹ²ÓаËÖÖÉ趨resource·½·¨£¬
µ«ÓÐÁ½¸öÖصãÐèҪעÒ⣺
1 £®Äã×îºÃֻʹÓÃÆäÖеÄÒ»»ò¶þÖÖÉèÖã¬Ö»ÒªÄã×öÍêÆôʼÉ趨£¬Ä㽫ֻ
Ðë¸Ä±äÔ¤ÉèµÄÉ趨¡£
2 £®ÏµÍ³ÊDZ»Éè¼ÆÀ´ÕÆÎÕÐí¶à²»Í¬Ä£Ê½µÄ¹¤×÷£¬ºÍÂú×ãÄÇЩÔÚÐí¶àÏÔʾÆ÷
ÉϹ¤×÷»òÔÚһ̨ÏÔʾÆ÷ÉϹ¤×÷¶ø´æÈ¡Ô¶·½»úÆ÷µÄʹÓÃÕߵġ£
×ܽáÀ´Ëµ£¬ÕâЩÉèÖÃÊÇÌṩÀ´ÈÃϵͳ¾¡¿ÉÄܸ»ì¶µ¯ÐÔ£¬µ«ÈκÎʱ¿ÌÄ㽫ֻ
Ðë´æÈ¡ÆäÖеÄ×Ó¼¯ºÏ¶øÒÑ¡£
16.1.1 É趨ResourceµÄ°ËÖÖ·½·¨
×ܹ²ÓаËÖÖ·½·¨É趨resource£¬µ«ËüÃÇ¿É·ÖΪÏÂÃ漸Àࣺ
£®Ó¦ÓóÌʽרÊôµÄ(Application-specific)resource£ºresourceµÄ±íÁУ¬
ÏÞ¶¨µµ°¸Ö»Äܱ»Ìض¨µÄÓ¦ÓóÌʽ¶ÁÈ¡¡£
£®ServerרÊôµÄresource£ºÓ¦ÓÃÉ趨£¬²»¹ÜÓ¦ÓóÌʽÔÚÄÇÒ»ÖÖÖ÷»úÉÏÖ´ÐС£
£®Ö÷»úרÊôµÄÉ趨(Host-specific-setting) £º¶ÔÓ¦ÓóÌʽÔÚÖ÷»úÉÏÖ´ÐÐ
ÓйصÄÉ趨£¬ºÍÏÔʾÆ÷Î޹ء£
£®ÃüÁîÁÐÑ¡ÏÔÚÖ´ÐÐʱÆÚ×öÒ»´Î¹Ø±Õ(one-off) É趨¡£
Ó¦ÓóÌʽרÊôµÄresource -- ·½·¨1 ºÍ·½·¨2
Toolkit ³Ìʽ³õʼʱÔÚºÍÓ¦ÓóÌʽֱ½ÓÏà¹ØµÄÁ½¸öµµ°¸ÖÐÑ°ÕÒresource£¬
ÕâЩµµ°¸Ö»Äܱ»Ìض¨µÄÓ¦ÓóÌʽ¶ÁÈ¡£º
1 £®Ó¦ÓóÌʽ--Àà±ð(Application-class) resourceµµ°¸£ºÕâ¸öµµ°¸°üº¬
ÁË»úÆ÷Ò»°ãÐÔ(site-wide) ¶ÔÓ¦ÓóÌʽµÄÀà±ðÖ®Ô¤ÉèÖµ£¬Í¨³£ÎªÏµÍ³
¹ÜÀíÕßËùÉ趨¡£ËüµÄÃû³Æ¾ÍÊÇÓ¦ÓóÌʽÀà±ðµÄÃû³Æ£¬ÔÚ±ê×¼°²×°µÄϵ
ͳÖÐËüÊÇ´¢´æÔÚĿ¼/usr/lib/X11/app-defaults ÖУ¬ÀýÈçxterm µÄ
Ïà¹Øµµ°¸Îª£º
/usr/lib/X11/app-defaults/XTerm
ÔÚcore°æÖУ¬ÓÐÒ»¸öÏà¹Øì¶Xmh µÄ´ËÖÖµµ°¸£¬¹Û²ì´Ëµµ°¸¿ÉÒÔ¿´Ëùʹ
ÓÃÖ®É趨µÄÐÍ̬¡£
2 £®Äã×Ô¼ºÓµÓеÄÓ¦ÓóÌʽרÊôµÄresourceµµ°¸£ºÕâ¸öµµ°¸µÄÃû³ÆºÍÉÏÊö
Ïàͬ£¬µ«Ëü´æ·ÅÔÚ²»Í¬µÄµØ·½----ÓÉshell ±äÊý$XAPPLRESDIRËùÖ¸¶¨
µÄĿ¼£¬Èç¹û䶨Ò壬Ôò·ÅÔÚhomeĿ¼¡£ÀýÈç¶ÔXmh Àà±ðµÄ³Ìʽ£¬Ëü
µÄµµ°¸·ÅÔÚÏÂÁжþÕßÖ®Ò»£º
$XAPPLRESDIR/Xmh
$HOME/Xmh
Äã¿ÉÒÔʹÓôËÖÖµµ°¸£¬´¦Àí·½·¨1 ÖÐÄ㲻ϲ»¶µÄ site-wideµµ°¸Ê¹ÆäÎÞ
Ч¡£
ServerרÊôµÄResource -- ·½·¨3 ºÍ·½·¨4
ÕâÊǶÔÄãÄ¿Ç°¹¤×÷µÄServer£¨ÏÔʾÆ÷£©×öÓйصÄÉ趨¡£¼üÅ̵ÄÉ趨ͨ³£ÊÇ
serverרÊôµÄ£¨ÒòΪ²»Í¬µÄÏÔʾÆ÷Óв»Í¬µÄ¼üÅÌ£©¡£ÁíÒ»¸öserverרÊôµÄÌØáç
ΪÏÔʾÆ÷ÊDzÊÉ«»òµ¥É«¡£
ResourceºÍÕâЩÓйصÄÏîÄ¿»á±»ËùÓÐÓëÕâ¸öÖն˻úÏà¹ØµÄÓ¦ÓóÌʽӦÓõ½£¬
²¢ÇÒ²»ÂÛÓ¦ÓóÌʽÔÚºÎÖ÷»úÉÏÖ´ÐС££¨ÀýÈ磬Èç¹ûÄãʹÓõÄÏÔʾÆ÷Ϊµ¥É«£¬Ôò
²»¹ÜÄãµÄÓ¦ÓóÌʽÔںδ¦Ö´ÐУ¬Ä㻹ÊDz»»áÒªËüʹÓòÊÉ«¡££©
´¢´æserverרÊôÉ趨µÄ·½·¨ÊÇ£º
3 £®serverµÄRESOURCE_MANAGERÐÔÖÊ(property)£º£¨Äã¿ÉÔÚ£±£²ÕÂÖÐXProp
µÄÊä³ö¿´µ½£©£¬Ê¹ÓÃÏÂÊöµÄxrdb³Ìʽ£¬Äã¿ÉÒÔÔÚserverµÄ¸ùÊÓ´°µÄ
RESOURCE_MANAGERÐÔÖÊÖд¢´æresourceÉ趨¡£ËüµÄÓŵãÈçÏ£º
(a) Äã²»Ðè±à¼Èκεµ°¸¼´¿ÉÉ趨ԤÉèÖµ¡££¨µ±ÄãΪÁËÁ˽âϵͳ¶øʵ
ÑéϵͳʱÌرðÓÐÓã©
(b) resource±»serverÕÆÎÕ£¬ËùÒÔ²»ÂÛÓ¦ÓóÌʽÔÚÄÇÒ»²¿Ö÷»úÉÏÖ´ÐУ¬
¾ùÄܱ»ËùÓеÄÓ¦ÓóÌʽӦÓá£ÔÚÎÒÃǵķ¶ÀýÖУ¬ÔÚneptune µÄ
Çé¿öÏÂÌرðÓÐÓã¬ÉõÖÁÔÚ²»ºÍÎÒÃǵÄÏÔʾ»úÆ÷venus ¹²Ïíµµ°¸Ïµ
ͳʱ£¬ËüÈÔÈ»×Ô¶¯µØÑ¡³öΪÁËʹÓôËÏÔʾÆ÷Ëù±ØÐèµÄresourceÉ趨¡£
4 £®ÄãµÄ$HOME/.Xdefaultsµµ°¸£º£¨Ö»ÓÐÔÚ¸ùÊÓ´°Ã»ÓÐRESOURCE_MANAGER
ÐÔÖʶ¨ÒåµÄÇé¿öÏÂʹÓã©¡£Èç¹ûÄã¶ÔxrdbÉв»ÊìϤ£¬Äã±ã¿ÉÒԴ˵µÈ¡
´ú£¬µ«Äã±ØÐëÔÚÿһ²¿ÄãÖ´ÐÐclientÓ¦ÓóÌʽµÄ»úÆ÷ÉϾùÉ趨һ¸ö¡£
Ö÷»úרÊôÉ趨 -- ·½·¨5 ºÍ·½·¨6
Ö÷»úרÊôÔ¤ÉèÖµºÍserverרÊôÏà·´£¬²»¹ÜÓ¦ÓóÌʽËùʹÓûúÆ÷µÄÖն˻úΪ
ºÎ£¬Ö»ÒªÓ¦ÓóÌʽÔÚ´ËÖ÷»úÉÏÖ´ÐУ¬¾ùʹÓÃÖ÷»úרÊôÔ¤ÉèÖµ£¬Äã¿ÉÒÔÓÃËüÃÇÀ´£º
£®ÈÃÓ¦ÓóÌʽÔÚ²»Í¬µÄ»úÆ÷É϶Բ»Í¬µÄµµ°¸ÏµÍ³×÷¼ÆË㣬ÀýÈ磺±»Ò»¸öÓ¦
ÓóÌʽ¶ÁÈ¡µÄ×ÊÁϵµ°¸¿ÉÄÜÔÚ²»Í¬µÄÖ÷»úÉϱ£³Ö²»Í¬µÄλÖá£
£®Çø·ÖÏÔʾÔÚͬһ¸öÓ©Ä»Éϲ»Í¬µÄÖ÷»úµÄÊÓ´°£¨ÕâЩÊÓ´°¿ÉÄÜÓÉͬһ¸öÓ¦
ÓóÌʽִÐУ©£¬ÀýÈ磺Äã¿ÉÒÔÒªËùÓÐÔÚmars»úÆ÷ÉÏÖ´ÐеÄxterm µÄÊÓ´°
ΪºìÉ«µÄ±ß¿ò£¬¶øÔÚsaturnÉÏÖ´ÐеÄÊÓ´°Îª»Æ±ß¡£
£®µ÷¸ßÒ»¸öÏàͬµÄÓ¦ÓóÌʽÔÚ²»Í¬µÄclient»úÆ÷ÉÏ°æ±¾µÄ²îÒ죬ÀýÈ磺
xterm ÔÚvenus ÊDZê×¼µÄMIT °æ£¬µ«ÔÚneptune »úÆ÷ÉÏÊÇÓɵÚÈý¼¯ÍÅÐÞ
¸Ä¹ýÒÔÊÊÓ¦»úÆ÷½á¹¹µÄ²úÆ·£¬ÕâÁ½°æµÄxterm ¿ÉÄܲ¢²»ÍêÈ«ÏàÈÝ¡£
Ö÷»úרÊôResource´¢´æÔÚ£º
5 £®ÓÉ$XENVIRONMENT À´µÄµµ°¸Ãû³Æ£ºÈç¹ûshell ±äÊý$ENVIRONMENTÓб»
¶¨Ò壬Ëü»á±»½âÊÍΪһ¸öº¬ÓÐresourceÉ趨µÄµµ°¸Ö®ÍêÕûµÄ·¾¶Ãû³Æ¡£
ÉÏÒ»Ò³ [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] ÏÂÒ»Ò³
6 £®ÄãµÄ$HOME/.Xdefaults-thishost µµ°¸£º£¨µ±$XENVIRONMENT δ±»¶¨
ÒåʱʹÓã©¡£×¢ÒâËüºÍÎÒÃÇÏÈÇ°µÄµµ°¸ÓÐËù²»Í¬£¬Ëü±ØÐ븽¼ÓÉÏÖ÷»ú
Ãû³Æ£¬ÀýÈ磬Èç¹ûÄãÔÚneptune Ö´ÐÐÓ¦ÓóÌʽ¶øÔÚvenus ÏÔʾ£¨¼ÙÉè
RESOURCE MANAGERÐÔÖÊ䶨Ò壩£¬ÔòserverרÊô resource ¶ÁÈ¡×Ô£º
.Xdefaults
¶øÖ÷»úרÊôresourceÔòÊÇ£º
.Xdefaults-neptune
Á½Õß¾ùÔÚneptune µÄ¼ÒĿ¼(home Directory)ÖС£
×¢Ò⣺ÔÚ²»Í¬µÄС½ÚÖУ¬ÎÒÃÇÔø˵¹ýÀàËÆ¡±serverרÊôresource¶ÁÈ¡×Ô...¡±
Õâ¿ÉÄÜÔì³ÉÎóµ¼£º¡±Èç¹ûÄãʵ¼ÊÐèÒª£¬Äã¿ÉÒÔ·ÅÖÃÈκÎÐÍ̬µÄresourceÉ趨µ½
Èκεĵµ°¸»ò×ÊÁÏ¿â¡£¡±ÎÒÃÇÕæÕýµÄÒâ˼ÊÇÄãÓ¦¸Ã·ÅÖûúÆ÷ÌØÐÔ»ò²»ÂÛÉõ÷áµÄ
resourceµ½Èκεط½£¬Èç¹ûÄãÕâÑù×ö£¬Ä㽫»ñµÃÄãÐèÒªµÄ¶¯×÷¡£
ÃüÁîÁÐÑ¡Ïî -- ·½·¨7 ºÍ·½·¨8
×îáᣬÄã¿ÉÒÔ½åÖøÃüÁîÁÐÑ¡ÏîÉ趨ӦÓóÌʽµÄÖµ¡£Í¨³£µ±ÄãÉ趨ԤÉèֵʱ
£¬ÎªµÄÊÇÄã²»ÐèҪʹÓÃÑ¡ÏîΪÄãµÄ³Ìʽ×÷£ØÏà¹ØµÄÉ趨¡£µ«Äãʵ¼ÊÉÏ¿ÉÒÔÓÃËü
ÃÇÀ´£º
£®Ò»´Î¹Ø±Õ(one-off) £¬ÀýÈ磺ÄãÔÝʱÐÔµØÔÚÓ©Ä»ÉÏÐèÒªÒ»¸ö¼«Ð¡µÄxedit¡£
£®ÎªÁËÇø±ðÔÚÏàͬӦÓóÌʽÖи÷×ԵijÉÔ±£¬ÄãÒÑ¿´¹ýÒ»¸öÕâÑùµÄÀý×Ó£¬µ±
ÎÒÃÇʹÓÃÃüÁî
xterm -name demo
À´É趨ӦÓóÌʽµÄ³ÉÔ±Ãû³Æ¸ødemo£¬½«Ôì³ÉÒÔÓ¦ÓóÌʽÃû³ÆΪdemoµÄ
resourceÈ¡´úxterm µÄresource¡£
ÃüÁîÁÐÑ¡Ïî·ÖΪÏÂÁÐÁ½ÖÖ£º
7 £®Ó¦ÓóÌʽרÊôÑ¡ÏÀýÈçxclockµÄ-chimeµÄxpr »ò-scale¡£
8 £®Toolkit ±ê׼ѡÏËùÓÐÓõ½Toolkit µÄÓ¦ÓóÌʽ¾ù½ÓÊÜһЩ±ê×¼µÄ
ÃüÁîÁÐÑ¡ÏÎÒÃÇ¿´¹ýÆäÖеĴ󲿷ݣ¬°üÀ¨-fg, -bg, -display,
-geometry µÈµÈ£¬±ê׼ѡÏîµÄÇåµ¥ÔÚ¡±£Ø Toolkit Intrinsics ¡±ÊÖ
²áµÄ2.3 ½ÚÖС£
ÔÚÆäÖÐÓÐÒ»¸öÑ¡Ïî-xrm£¬ÖØÒªµÄ×ãÒÔÓÃÒ»¸öС½ÚÀ´ÃèÊö¡£
Toolkit ±ê׼ѡÏî-xrm
´ó¶àÊýÒ»°ãµÄresource¾ùÄܱ»ÃüÁîÁÐÑ¡ÏîÃ÷È·µØÉ趨£¬ÀýÈçÄã¿ÉÒÔÓÃ
-bg colourÉ趨ÊÓ´°±³¾°ÑÕÉ«¡£µ«ÎÞÂÛÈçºÎ£¬ÓÐһЩresource²¢Ã»ÓзûºÏµÄÑ¡
ÏΪÁË¿Ë·þÕâµã£¬Toolkit Ìṩһ¸ö "²¶×½ÒÅ©" (catch all) µÄÑ¡Ïî-xrm
£¨£Ø Resource Manager Ëõд£©¡£
-xrmÒÔÒ»¸öÒýÊýµ±×öresource¹æ¸ñ£¬¾ÍÈçͬÄãÔÚÔ¤ÉèÖµµµ°¸ÖÐÊäÈëµÄÏàͬ£¬
ÀýÈ磺Äã¿ÉÒÔÊäÈ룺
xclock -xrm "*update:30"
ºÍ
xclock -update 30
ÊÇÏàµÈµÄ¡£
ÔÚͬһÃüÁîÁÐÄã¿ÉÒÔʹÓÃÊý´Î-xrm£¬µ«Ã¿Ò»´ÎÖ»ÄÜ°üº¬Ò»¸öresource¹æ¸ñ£¬
ÀýÈ磺
xclock -xrm "*update:30" -xrm "*chimen"
-xrmµÄºÃ´¦ÔÚì¶Äã¿ÉÒÔÓÃËüÀ´É趨ÈκÎresource¹©Ó¦ÓóÌʽʹÓã¬ÓÈÆäÊÇ
ÄÇЩºÍÃüÁîÁÐÑ¡Ïî²»·ûºÏµÄresource¡£ÆäÖÐһЩ·Ç³£ÓÐÓõÄÏñ£º
iconX, iconY£ºÊÓ´°±íáçͼ×óÉϽÇx,y ×ù±êµÄλÖá£
iconPixmap£º±»ÓÃÀ´µ±×÷ÊÓ´°±íáçͼµÄλԪӳÏñµÄÃû³Æ£¬Äã¿ÉÒÔÓÃËü
À´Ö¸¶¨ÈκεÄλԪӳÏñµ±×÷Ó¦ÓóÌʽ±íáçͼ¡££¨Î»ÔªÓ³Ïñ
ΪÒÑÓлòÀûÓÃbitmap³Ìʽ½¨Á¢¡££©ÀýÈ磺ÃüÁî
xedit -iconic -xrm "*IconPixmap:cntr_ptr"\
-xrm "*iconX:500"\
-xrm "*iconY:400"
µÄÒâÒåΪ½«xedit É趨ÒÔ±íáçͼ¿ªÊ¼Æôʼ£¬±íáçͼµÄ×óÉϽÇ
×ù±êΪ(500,400) £¨ÔÚ´ó¶àÊýµÄÏÔʾÆ÷»áÔÚÓ©Ä»ÖÐÑ룩£¬Ê¹
ÓÃÃûΪcntr_ptrµÄλԪӳÏñÀ´µ±×÷±íáçͼ¡£
backgroundPixmap£ºÉ趨ÓÃÒ»¸öλԪӳÏñµ±×÷±³¾°¡£
borderPixmap£ºÉ趨ÒÔÒ»¸öλԪӳÏñµ±×÷ÊÓ´°µÄ±ß£¬ÀýÈ磺
xclock -bw 20 -xrm "*backgroundPixmap: scales"\
-xrm "*borderPixmap: cntr_ptr"
Ö´ÐÐxclock£¬ÓÃÒ»¸ö¿í´ï20¸öÏñËصı߿ò£¬ÊÓ´°µÄ±³¾°ÎªÓãÁÛ
(fish-scales) ͼ°¸£¬±ß¿òÔòÓÃcntr_ptrµÄλԪӳÏñ¡£
ËùÓеÄÕâЩresourceµ±È»Ò²¿ÉÓÃÀà±ðÖ¸¶¨¡££¨ÈçIconX £¬BorderPixmapµÈµÈ¡££©
×¢Ò⣺Çë¼Çס£¬-xrmÖ»ÓÐÔÚ³ÌʽÓÐÓõ½Toolkit ²Å¿ÉÓ¦Óá£
16.1.2 É趨Resource²»Í¬·½·¨µÄÕªÒª
ÏÖÔÚÎÒÃǽ«ÈçºÎ¶ÔÒ»¸öÖ¸¶¨Ó¦ÓóÌʽresourceÉ趨µÄ°ËÖÖ·½·¨×÷Ò»ÕªÒª£º
Ó¦ÓóÌʽרÊôresource£ºËüÃDZ»Á½¸öµµ°¸ÕÆÎÕ£¬ÇÒ½öÄܱ»Toolkit ʹÓã¬
ÆäÖÐÒ»¸öµµ°¸Í¨³£ÓÉϵͳ¹ÜÀíÕßÉ趨£¬ÁíÒ»¸öÓÉÄã×Ô¼ºÉ趨¡£
serverרÊôµÄresource£º²»ÊÇ´æÔÚ¸ùÊÓ´°µÄRESOURCE_MANAGERÐÔÖÊÖУ¬±ã
ÊÇÔÚÄãµÄ$HOME/.Xdefaultsµµ°¸ÖС£
Ö÷»úרÊôresource£ºÈç¹ûshell ±äÊý$XENVIRONMENT Óж¨ÒåµÄ»°£¬´æÔÚÆä
ÉÏÒ»Ò³ [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] ÏÂÒ»Ò³
Ëù¶¨ÒåµÄµµ°¸ÖУ¬·ñÔòÔÚÄãµÄ$HOME/.Xdefaults-host µµ°¸¡£
Ò»´Î¹Ø±ÕÉ趨£ºÓÃÓ¦ÓóÌʽµÄ±¾ÉíÃüÁîÁÐÑ¡ÏîÀ´É趨£¬ºÍÓÃToolkit ±ê×¼
ÃüÁîÁÐÑ¡Ï°üº¬¡±²¶×½ÒÅ©¡±-xrm.
ËüÃÇÒÔÏÂÁÐ˳Ðò´¦Àí£º
if £¨³ÌʽʹÓÃToolkit £©
¶ÁÈ¡ /usr/lib/X11/app-defaults/classµµ°¸ (1)
¶ÁÈ¡ÄãµÄ $HOME/classµµ°¸ (2)
if £¨RESOURCE_MANAGERÐÔÖʱ»¶¨Ò壩
´¦ÀíÄÚº¬µÄÖ¸¶¨ (3)
else
¶ÁÈ¡ÄãµÄ$HOME/.Xdefaultsµµ°¸ (4)
if £¨shell ±äÊýXENVIRONMENT±»¶¨Ò壩
¶ÁÈ¡Ëù¶¨ÒåÃû³ÆµÄµµ°¸ (5)
else
¶ÁÈ¡ÄãµÄ$HOME/.Xdefaults-host µµ°¸ (6)
if £¨³ÌʽʹÓÃToolkit £©
´¦Àí±ê×¼µÄresourceÑ¡Ï°üº¬-xrm (7)
´¦ÀíÓ¦ÓóÌʽ±¾ÉíµÄÑ¡Ïî (8)
ÏÖÔÚÎÒÃǽ«¸üÏêϸµÄ¿´Ò»¸ö½Ï²»ÊìϤµÄ·½·¨ -- ÓÃÀ´´¢´æserver±¾Éí
resourceµÄ·½·¨¡£
16.2 ÔÚServerÉÏ´¢´æÔ¤ÉèÖµ -- xrdb
´ó²¿·ÝÔ¤ÉèÖµµÄ½á¹¹¾ùºÍµµ°¸Óйأ¬µ±Ó¦ÓóÌʽÆôʼʱ£¬²»Í¬µÄµµ°¸±»¶Á
È¡ÇÒÆäÄÚÈݱ»´¦Àí£¬ÕâÖÖ·½Ê½µÄȱµãΪÄãÏ£ÍûËùÓеÄclientÔÚÒ»¸öÌض¨µÄ
serverÉÏʹÓÃͬһ×éµÄÔ¤ÉèÖµ£¬µ«clientËùÖ´ÐеĻúÆ÷ÉÏÈç¹ûûÓÐÒ»¸ö¹²Í¬µÄ
µµ°¸ÏµÍ³£¬Äã¸ÃÔõ÷á°ì£¿
´ð°¸ÊÇÔÚserver±¾Éí´¢´æÔ¤ÉèÖµ¡££ØµÄÐÔÖÊÉèÊ©ÊÇÒ»¸ö¾ßÓÐÒ»°ãÐÔÄ¿µÄµÄ
½á¹¹¡££¨¼Çס£¬Ò»¸ö¡±ÐÔÖÊ(property)¡±ÊÇһС¶ÎÒÑÖª¸ñʽ×ÊÁϵÄÃû³Æ£¬±»´¢
´æÔÚserver£©£¬Ö¸¶¨ÓÉserver¸ùÊÓ´°µÄRESOURCE_MANAGERÐÔÖÊÔØÈ룬ÇÒµ±Ó¦ÓÃ
³ÌʽÆôʼʱϵͳ»á×¢Òâ´ËÊ¡£µ±ÊÓ´°ÏµÍ³Æôʼʱ£¬RESOURCE_MANAGERÐÔÖÊ䶨
Ò壺Èç¹ûÄãҪʹÓÃÕâ¸öÉèÊ©£¬Äã±ØÐëÃ÷È·µØÉ趨Ëü¡£
²¢Ã»ÓÐÒ»¸öÒ»°ãÐԵŤ¾ßÀ´²Ù×÷Ò»¸öÐÔÖÊ£¬ËùÒÔ£ØÌṩÁËÒ»¸öÌØÊâµÄ³Ìʽ
À´´¦ÀíresourceÐÔÖÊ£¬Ëü¾ÍÊÇxrdb£¨the X Resource DataBase ¹«ÓóÌʽ£©¡£
16.2.1 xrdbÄÜΪÄã×öʲ÷á
ΪÁË·½±ãÆð¼û£¬±¾ÕÂÊ£âŵIJ¿·Ý£¬ÎÒÃÇÖ»°ÑRESOURCE_MANAGERÐÔÖʺÍËüµÄ
ÄÚÈݵ±³É¡±×ÊÁϿ⡱¡£
xrdbµÄ¹¦Äܷdz£¼òµ¥£¬ËüÈÃÄãÄÜ£º
£®É趨һ¸öеÄ×ÊÁÏ¿â¡£
£®¿´Ä¿Ç°ÓÐÄÇЩresourceÔÚ×ÊÁÏ¿âÖС£
£®ÔÚÏÖ´æµÄ×ÊÁÏ¿â¼ÓÈëÒ»¸öеÄresource¡£
£®ÍêÈ«È¥³ý×ÊÁÏ¿â¡£
ÕâЩÊÇ»ù±¾²Ù×÷£¬ÇÒºÜÈÝÒ×Íê³É¡£µ±È»Ò²ÓÐһЩ¸ü½øÒ»²½µÄ¹¦ÄÜ¿ÉÒԺܾ«
È·µØÈÃÄã¿ØÖÆresource£¬µ«ÎÒÃÇÏÈÀ´ÌÖÂÛ»ù±¾²Ù×÷¡£
16.2.2 ʹÓÃxrdbµÄ»ù±¾¹¦ÄÜ
xrdbµÄ²Ù×÷ÀàËÆ´ó¶àÊýUnixµÄ³Ìʽ£ºËü´ÓÒ»¸öµµ°¸»ò±ê×¼ÊäÈë¶ÁÈ¡ÊäÈë×Ê
ÁÏ£¬²¢ÇÒÄã¿ÉÒÔÓÃÃüÁîÁÐÑ¡ÏîÀ´¿ØÖÆËüµÄ²Ù×÷ģʽ£¬ËüËù¶ÁÈ¡µÄÊäÈëÊÇÎÒÃÇÔø¾¿´
¹ýµÄһϵÁÐresourceÉ趨£¬²»¹ý±È½ÏÌرðµÄÊÇËü°ÑÕâЩÉ趨ÔØÈë×ÊÁϿ⣬ÈÃÎÒÃÇ¿´
Ò»¿´ËüÖ÷ÒªµÄ¹¦ÄÜ£º
É趨һ¸öеÄ×ÊÁϿ⣺ÊäÈëÏÂÃæÃüÁîÁ½ÕßÖ®Ò»£º
xrdb filename
xrdb < filename
ÓÃÒÔ½«Ò»¸öµµ°¸ÖеÄÉ趨ÔØÈëµ½Ò»¸ö×ÊÁÏ¿âÖУ¬Èç¹ûÖ»¼üÈëxrdb£¬±íʾÄ㽫ÓÉ
±ê×¼ÊäÈ루ͨ³£Îª¼üÅÌ£©Ö±½ÓÊäÈëÉ趨£¬ÉÔááÎÒÃǽ«ËµÃ÷xrdbËù½ÓÊܵĵµ°¸¸ñ
ʽ£¬µ«ÏÖÔÚÏÈ°ÑÊäÈëresourceÉ趨µ±×÷ºÍ.Xdefaultsµµ°¸»ò-xrmÒýÊýÏàͬµÄ·½
·¨£¬ÀýÈ磬Äã¿ÉÒÔÓÃÏÂÁеķ½Ê½¶¨ÒåxclockÉ趨£º
venus% xrdb
xclocks*Background: pink
xclock*update: 30
xclock*backgroundPixmap: cntr_ptr
<end-of-file>
ͨ³£ÄãÓÃÒ»¸öµµ°¸µ±×÷xrdbµÄÊäÈ룬Ҳ¾ÍÊÇ˵£¬xrdb´ÓÒ»¸öµµ°¸ÔØÈëÔ¤Éè
Öµ×÷ΪÄãµÄÊÓ´°ÏµÍ³³õʼ»¯µÄÒ»²¿·Ý¡£Èç¹ûÄãºÜÓоÑ飬ֱ½ÓÊäÈëËüµÄÉ趨Ҳ
ÐíÈÝÒ×Щ¡£
²é¿´ÏÖ´æ×ÊÁÏ¿âÖеÄÄÚÈÝ£¬ÊäÈëÃüÁ
xrdb -query
Ôòxrdb½«ÒÔÃ÷°×±¾Îĸñʽ(plain text format) Ó¡³ö×ÊÁÏ¿âµÄÄÚÈÝ£¨-query¿É
ÒÔËõдΪ -q £©¡£
£¨Äã¿ÉÄܼǵÃÒ²¿ÉÒÔÔÚ¸ùÊÓ´°ÓÃxprop À´¿´×ÊÁÏ¿âµÄÄÚÈÝ£¬µ«xprop µÄÊä
³ö¸ñʽ²»Ì«ÁéÇÉ£¬Ëü¸øÄãÆäËüÒ»´ó¶ÑÄã²»ÐèÒªµÄ×ÊѶ¡££©
Èç¹ûÐèÒª£¬Äã¿ÉÒÔץȡxrdbµÄÊä³öµ½Ò»¸öµµ°¸£¬±à¼Ëü£¬¸ü¸ÄÉ趨áá¿ÉÔÙ
ÓÃËüµ±×÷xrdbµÄÊäÈë¡££¨ÏÂÒ»ÏÄܸæËßÄãÒ»¸ö¸üºÃµÄ·½·¨£©
×¢Ò⣺²é¿´×ÊÁϿ⣬Äã±ØÐëʹÓÃÑ¡Ïî-query¡£Èç¹ûÄãºöÂÔÕâ¸öÑ¡Ïî¶øÖ»Êä
Èëxrdb£¬½«Ôì³É»áÇå³ý×ÊÁϿ⣬ÇÒxrdbÔڵȴýÄã×Ô±ê×¼ÊäÈë¼üÈëÄã
еÄÉ趨¡£
ÔÚÏÖ´æ×ÊÁÏ¿â¼ÓÈëеÄÉ趨£º¼ÓÈëеÄÉ趨µ½×ÊÁÏ¿âÇÒ²»ÒªÆÆ»µÔÓеÄÉè
¶¨£¬Ê¹ÓÃÃüÁ
xrdb -merge filename
£¨-merge¿ÉËõдΪ-m£¬Èç¹ûÄãÊ¡ÂÔµµ°¸Ãû³Æ£¬xrdb»á×Ô±ê×¼ÊäÈë¶ÁÈ¡¡££©
xrdb×ÔÖ¸¶¨µÄµµ°¸ÖжÁÈ¡resourceÉ趨£¬²¢¼ÓÈëÏÖ´æµÄ×ÊÁÏ¿âÖУ»¶Ôì¶×ÊÁÏ¿â
ÖÐÒÑ´æÔÚµÄresource£¬Èç¹ûÓÐеÄÉ趨£¬¾ÉÖµ»áΪÐÂֵȡ´ú£¬·ñÔòÔò²»»á±ä¶¯¡£
ÍêÈ«ÒÆÈ¥×ÊÁϿ⣺ÈçͬÏÈÇ°ËùÊö£¬µ±ÏµÍ³½áÊøʱ×ÊÁÏ¿â»á×Ô¶¯Ïûʧ£¬µ«Èç
¹ûÄãÔÚϵͳÈÔÔÚÖ´ÐÐʱÒÆÈ¥×ÊÁϿ⣬ʹÓÃÃüÁ
ÉÏÒ»Ò³ [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] ÏÂÒ»Ò³
xrdb -remove
±¾½Ú½éÉÜxrdb»ù±¾µÄ¹¦ÄÜ£¬ÏÂÒ»½ÚÎÒÃǽéÉܵ±ÄãÊìϤϵͳʱ£¬Äã¿ÉÄÜÐèÒª
µÄ¸ü½øÒ»²½µÄ¹¦ÄÜ¡£
16.2.3 xrdbµÄµµ°¸¸ñʽ
ÄãÒÑÖªµÀ´ó¶àÊýµÄ¸ñʽϸ½Ú -- Äã¿ÉÒÔÓñê×¼µÄresource¹æ¸ñµÄÐÎʽ
characteristic: value
ÉÏÊöµÄ¸ñʽÄãÒÑ¿´¹ý¶à´Î£¬µ«xrdbÓÐÁ½¸ö¶îÍâµÄ¹æÔò£º
1 £®×¢½â(comments)£ºÃ¿Ò»ÐеĿªÍ·Èç¹ûÊǾªÌ¾ºÅ£¨!£©»á±»ºöÂÔ£¬ËùÒÔ
Äã¿ÉÒԴ˵±×÷×¢½â¡£
2 £®xrdbÔ¤É轫ËüµÄÊäÈëÁд«µ½C Ç°´¦ÀíÆ÷¡£
ÈÃÎÒÃǽøÒ»²½¿´Ò»¿´Ç°´¦ÀíÆ÷µÄ¹ý³Ì¡£
xrdbÇ°´¦ÀíËüµÄÊäÈëÁÐ
ÈÃÎÒÃÇ¿´Ò»¿´Ò»¸öÄã¿ÉÄÜÅöµ½µÄµäÐÍÎÊÌâ¡£¼ÙÉèÔÚÒ»°ãµÄ³¡¾°£¬ÄãʹÓÃÏÂ
ÁÐÏÔʾÆ÷£º
venus ²ÊÉ«Ó©Ä»£¬Õý³£½âÎö¶È
saturn µ¥É«Ó©Ä»£¬Õý³£½âÎö¶È
mars ²ÊÉ«Ó©Ä»£¬¸ß½âÎö¶È
ÒÔÉÏÈýÕß¹²ÏíÒ»¸ö¹²Í¬Íø·µµ°¸ÏµÍ³£¬µ±ÄãÔÚÒ»¸öÏÔʾÆ÷ÉÏÆô¶¯£Ø£¬ÄãÐè
Òª¶¨ÒåÔ¤ÉèÖµÀ´·´Ó¦ÏÔʾÆ÷µÄÌØáç¡£ÀýÈ磺Ôڸ߽âÎö¶ÈÓ©Ä»Äã¿ÉÄÜÐèÒª½Ï´óµÄ
Ô¤Éè×ÖÐÍ£¬»òÊÇÄã²»ÐèÒªÔÚµ¥É«ÏµÍ³É϶¨Òå²ÊÉ«Ô¤ÉèÖµ¡£
ÈçºÎ×öÄØ£¿ÈÃÎÒÃÇ¿´Ò»¿´£¬Èç¹ûÄãÄÜʹÓÃ.Xdefaults-host µµ°¸£ºÔÚ
.Xdefaults-venusÎÒÃÇ°üº¬Á˲ÊÉ«Ö¸¶¨£¬¶øÔÚ.Xdefaults-saturn ÎÒÃÇÖ»·ÅÈë
µ¥É«ÐÍ̬µÄ²ÎÊý¡£ÐеÃͨÂ𣿵±È»£¬µ«ÊÇÊÇÓÐÏ޶ȵģºËüÖ»ÄÜÕÆÎÕÓ¦ÓóÌʽÔÚ
ºÍserverÏàͬµÄ»úÆ÷ÉÏÖ´ÐУ¬Èç¹ûÓ¦ÓóÌʽÔÚÆäËüµÄ»úÆ÷ÉÏÖ´ÐлáµÃµ½ËüÃÇÖ÷
»úÉϵÄÔ¤Éèµµ°¸¡£ËùÒÔÈç¹ûÄãʹÓÃvenus ÇÒÔÚsaturnÆôʼԶ·½µÄclient£¬½«»á
Óõ½.Xdefault-saturn¶ø´íʧËùÓеIJÊÉ«Ö¸¶¨¡£
ÄãÄܹ»Ö»Ê¹ÓÃ.Xdefault µµ°¸À´Çø·Ö»úÆ÷Â𣿲»ÄÜ£¬ÒòΪÈý̨Ö÷»ú¹²ÏíÏà
ͬµÄµµ°¸ÏµÍ³£¬ËùÒÔ$HOME/.Xdefaults»á±»venus »ñµÃÒ²»á±»ÆäËüµÄ»úÆ÷»ñµÃ¡£
´ð°¸ÊÇÔÚresource´¦Àí³ÌÐòµÄijЩµØ·½£¬ÓÐÒ»¸ö½á¹¹¿ÉÒÔ·Ö±æ³öËùʹÓÃ
serverµÄijЩÌØáç¡£xrdb¿ÉÒÔÓÃÏ൱¼òµ¥µÄ°ì·¨×öµ½Õâµã£¬ËüÏȶ¨ÒåһЩ˵Ã÷
serverÌØáçµÄC Ç°´¦ÀíÆ÷·ûºÅ£¬¶øáὫËüËùÓеÄÊäÈë´«µÝµ½Ç°´¦ÀíÆ÷£¬×îáὫ
´¦Àí¹ýµÄ×ÊÁÏÔØÈë×ÊÁÏ¿â¡£Ö¸ÄÏÒ³ÁгöËùÓеÄxrdb¶¨ÒåµÄÇ°´¦ÀíÆ÷µÄ·ûºÅ£¬µ«
ÔÚ´Ë´¦ÎÒÃÇÐèÒªÓõ½µÄÊÇ£º
X_RESOLUTION=n:nÊÇÿ¹«³ß³¤Ó©Ä»ÓжàÉÙÏñËØ¡££¨¸ù¾ÝÎÒÃǵÄserver£¬ÎÒ
ÃÇÕý³£½âÎö¶ÈµÄөĻΪÿ¡õ90¸öÏñËØ£¬Ï൱ì¶Ã¿¹«³ß3454¸öÏñËØ¡££©
COLOR £ºÖ»ÓÐөĻ֧Ԯ²ÊÉ«²Å±»¶¨Òå¡£
WIDTH,HEIGHT£ºÓ©Ä»µÄ¿í¶ÈºÍ¸ß¶È£¬µ¥Î»ÎªÏñËØ¡£
ͼ16-1ÏÔʾÎÒÃÇÈçºÎÔÚxrdbµÄÊäÈëµµ°¸Ê¹ÓÃÕâЩ¡££¨ÎÒÃÇÃüÃûΪ
$HOME/.Xresources £¬ÉÔááÎÒÃÇÈÔ½«ÔÙ¶ÈÓõ½¡££©Ëü¿ÉÒÔÕýÈ·µØ×öµ½ÎÒÃÇËùÏë
ÒªµÄ -- ËüÕýÈ·ÕÆÎÕÁËËùÓÐÎÒÃǵÄÏÔʾÆ÷£¬²»ÂÛÊDzÊÉ«»ò¸ß½âÎö¶È»òÁ½Õ߶¼ÓС£
һЩҪµãÖµµÃ×¢Ò⣺
©°¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª©´
©¦ P197 FIG 16.1 ©¦
©¦ ©¦
©¦ ͼ16-1 ÀûÓÃÇ°´¦ÀíÆ÷ÃüÁîµÄResourceµµ°¸ ©¦
©¸¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª©¼
£®Äã¿ÉÒÔʹÓÃËùÓÐÇ°´¦ÀíÆ÷µÄ¹¦ÄÜ¡£ÀýÈ磬ÎÒÃÇʹÓÃËüµÄ±íʾÕÆÎÕ
(expression-handling) ÄÜÁ¦£º
#if X_RESOLUTION > 3600
£®Äã¿ÉÒÔÔÚµµ°¸ÖÐÈκεط½Ê¹ÓÃÇ°´¦ÀíÆ÷·ûºÅ£¬²¢²»Ö»ÊÇÇ°ÃæÓÐ# ºÅµÄÁУ¬
ÀýÈ磬µ±
xload*Width: WIDTH
ÔÚvenus ÉÏxrdbÖ´Ðе½Ê±£¬Ëü½«»á¶ÁÈ¡³É£º
xload:Width: 1152
ËùÒÔÓÉÔ¤ÉèÖµ¿ÉÖª£¬xload ÊÓ´°¿í¶È½«ºÍÓ©Ä»¿í¶ÈÏàͬ£¬¸ßΪ80¸öÏñËØ£¬
ÇÒÔÚÓ©Ä»µÄÕýÉÏ·½¡£
×¢Ò⣺´ó¶àÊýUnixÇ°´¦ÀíÆ÷¶¨ÒåÁËһЩºÍËüÃÇ»úÆ÷½á¹¹Óë×÷ҵϵͳÏà¹ØµÄ
·ûºÅ£¬ÕâЩ¿ÉÄÜ»á¸ÉÈŵ½Ä㣬ÌرðÊÇUnixͨ³£¶¨ÒåµÄ·ûºÅ£¬ÏÖÔÚ
xrdb¶¨ÒåHOSTΪÏÔʾÆ÷Ãû³ÆÖÐÖ÷»úÃû³ÆµÄ²¿·Ý£¬ËùÒÔÄã¿ÉÄÜÈÏΪÄã
¿ÉÒÔÏñÕâÑùʹÓÃÒ»¸öresource¹æ¸ñ£º
demo*title: X demo using display HOST
±È·½ÔÚvenus ÉÏ£¬Ô¤ÆÚËüÏ൱춣º
demo*title: X demo using display venus
ÊÂʵÉÏ£¬ÔÚÎÒÃǵĻúÆ÷ÉÏ»áµÃµ½
demo*title: X demo using display 1
ÔÒòΪÏÔʾÆ÷Ãû³ÆÊÇunix:0.0£¬ËùÒÔÖ÷»úÃû³Æ²¿·ÝΪunix£¬µ«Ç°´¦
ÀíÆ÷ÒѶ¨ÒåÁËunix£¬ËùÒÔÕû¸ö½âÊ͵Ä˳ÐòΪ£º
HOST -> unix -> 1
Äã¿ÉÒÔÓÃxrdbµÄ-uÑ¡ÏîÀ´½â³ý·ûºÅµÄ¶¨Ò壬ÓÃÒÔ¿Ë·þÕâµã£¬Ò²¾ÍÊÇ
xrdb -Unix < filename
µ«¼´Ê¹Èç´Ë£¬Ö÷»úÃû³ÆÈÔΪunix£¬³ý·ÇÄãÃ÷È·µØÖ¸¶¨ÏÔʾÆ÷£º
xrdb -display venus:0 < filename
ÁíÒ»¸ö»á²úÉú¸ÉÈŵķ¶Àý£¬ÈçºÎÄãÊäÈë¹æ¸ñ
xedit*Font: *-sun-screen-*
ʹÓÃxrdb£¬ÏÖÔÚÓÃÒ»¸öxrdb -query £¬Äã¿ÉÒÔ¿´µ½ÔÚ×ÊÁÏ¿âÖÐʵ¼Ê
µØÉ趨£º
xedit*Font: *-1-screen-*
ÉÏÒ»Ò³ [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] ÏÂÒ»Ò³
ÔÚÎÒÃÇsun µÄ»úÆ÷ÉÏ£¬Ç°´¦ÀíÆ÷¶¨Òå³ÉÁíÒ»¸ö·ûºÅ¡£Èç¹ûÄãʹÓúÍÄãµÄ»ú
Æ÷Ïà¹ØµÄÃû³Æ£¬Äã¿ÉÄÜÒ²»áµÃµ½ÏàͬµÄЧӦ¡££¨Èç¹ûÄã¾ö¶¨²»ÐèҪǰ´¦ÀíÆ÷µÄ
¹¦ÄÜ£¬Äã¿ÉÒÔÓÃxrdbµÄ-nocppÑ¡ÏîÍ£Ö¹ËüµÄ¹¦ÄÜ¡££©
16.2.4 ÈçºÎ½«×ÊÁÏ¿âÉ趨ºÍÄãµÄxrdbÊäÈëµµÁ¬½ÓÔÚÒ»Æð
½åÖøÏñÇ°ÊöÔÚÒ»¸öº¬ÓдóÁ¿Ç°´¦ÀíÆ÷ÃüÁîµÄµµ°¸Ö´ÐÐxrdb£¬Äã³õʼ»¯ÁË×Ê
ÁϿ⣬ÔÚÉÔááµÄÆڼ䣬½»Ì¸Ê½µÄʹÓÃxrdb£¬Ä㽫¶Ô×ÊÁÏ¿â×ö´óÁ¿µÄ¸ü¶¯£¬ÏÖÔÚ
ÄãÐèÒª¼Ç¼ÕâЩÉ趨£¬ÇÒ½«Ö®ÓëÔÀ´µÄÊäÈëµµÁ¬½Ó£¬ÒÔ±¸½«À´Ö®Óá£
Èç¹ûÄãֻʹÓÃxrdb -query £¬ÄãÖ»ÄÜ»ñµÃÄ¿Ç°µÄÉ趨£ºËùÓÐÔÚÊäÈëµµÖеÄ
Ìõ¼þÖ¸ÁîÁÐÈôºÍÏÖÔÚµÄserver²»·ûÔò²»»á±»°üº¬¡£ÀýÈçÔÚsaturnÉÏÖ´ÐÐÇ°ÊöµÄ
µµ°¸£¬ÔòËùÓÐÉ«²ÊºÍ¸ß½âÎö¶ÈµÄÉ趨£¬¾ù±»ºöÂÔ£¨µ±È»ÒÔ #¿ªÍ·µÄÒ²²»ÀýÍ⣩£¬
ΪÁË¿Ë·þÕâµã£¬xrdbÌṩ-edit Ñ¡ÏÀýÈçÃüÁ
xrdb -edit myresf
Á¬½ÓÄ¿Ç°ÔÚ×ÊÁÏ¿âÖеÄÖµµ½µµ°¸myresfÄÚ´æÔÚµÄÄÚÈÝ£¬Ëü½åÖø±È¶ÔresourceÖ¸
¶¨ÌØáçÖµµÄ²¿·Ý×öµ½Õâµã£ºÈç¹ûÔÚµµ°¸ÖÐijһÐкÍ×ÊÁÏ¿âÖÐijһÏîÌØáçÏàͬ£¬
Ôòµµ°¸ÖÐÖµµÄ²¿·Ý»á±»ÔÚ×ÊÁÏ¿âÖеÄֵȡ´ú£¬Óô˷½·¨£¬ËùÓеÄÒÔ #¿ªÍ·µÄÁÐ
ºÍÌõ¼þÉ趨¾ù»á±£ÁôÔÚµµ°¸ÖС£
×¢Ò⣺ǰ´¦ÀíÆ÷ÍêÈ«²»¿ÉÒÔʹÓÃ-edit Ñ¡ÏÄǻᵼÖÂÎÊÌ⣬ÎÒÃÇ¿´Ò»
ϵ±ÎÒÃÇʹÓÃvenus £¬ÇÒÒÔÇ°Êöµµ°¸³õʼ»¯×ÊÁÏ¿âʱ£¬»á·¢Éúʲ÷á
Çé¿ö£¬¼ÙÉèÎÒÃÇ×öÁ˸ü¶¯£º
venus% xrdb -merge
XTerm*font: *-courier-medium-r-*-140-*
<end-of-file>
È»ááÓÃÃüÁ
xrdb -edit myresf
½«É趨¸ü¸ÄµÄ²¿·Ý·Å»Øµµ°¸£¬ÎÒÃÇ¿´µ½Á½¼þÊ£º
1 £®Ç°´¦ÀíÆ÷·ûºÅÔÚ¹æ¸ñÖÐÖµµÄ²¿·Ý»á±»×ÖÃæ(literal)ֵȡ´ú£¬
ÀýÈ磺
xload*Width: 1152 »á±»
xload*Width: WIDTH È¡´ú
2 £®ÔÚ¹æ¸ñÖÐÖ»ÒªÌØÐÔ·ûºÏ£¬Öµ¾ù»á±»È¡´ú£¬ÉõÖÁÄÇЩÔÚÌõ¼þ¶ÎÖÐ
Ä¿Ç°ÉÐδӦÓõ½µÄÒ²²»ÀýÍâ¡£ÀýÈ磬ÔÚÇ°Êöµµ°¸£¬É趨
XTerm*fontµÄÄÇÁ½ÐУ¨Ò»ÐÐÔڸ߽âÎö¶ÈÄǶΣ¬Ò»ÐÐÔÚÕý³£ÏÔʾ
Æ÷ÄǶΣ©¶¼»á±»¸ü¸Ä£¬¼´Ê¹ÎÒÃÇÖ»ÐèÒª¸Ä±äÕý³£ÏÔʾÆ÷Ò²²»Àý
Íâ¡£
16.3 һЩ³£¼ûµÄ´íÎóºÍÈçºÎÐÞÕýËüÃÇ
ÌرðÊǵ±Äã¶ÔϵͳÊÇÐÂÊÖµÄʱºò£¬resource¿´ÆðÀ´Ï൱µÄ¸´ÔÓ¡£µ±ÓÐЩ״
¿ö²»ÄÜÕý³£Ö´ÐУ¬¶øϵͳÎÞ·¨°ïÖúÄã²é¾õÊÇʲ÷á´íÎ󣬻òÄãÔںδ¦·¸ÁË´íÎó£¬
ÕâÀïÁгöһЩ³£¼û´íÎóµÄÃ÷ϸ£¬²¢Ìá³öÈçºÎÐÞÕýËüÃÇ¡£
£®Èç¹ûÄãδÉ趨һ¸öÓ¦ÓóÌʽµÄÃû³ÆºÍÀà±ð£¬È·¶¨ÔÚÄãµÄresource¹æ¸ñÖ®
Ç°¼ÓÒ»¸öÐǺţ¬£¨Èç¹ûÄãÊ¡ÂÔÕâ¸öÐǺţ¬½«Ã»ÓÐÈκζ«Î÷»á¶ÔÓ¦Õâ¸ö¹æ
¸ñ£©Õâ¸ö´íÎóÔÚÄãʹÓÃ-xrmʱÌر𳣼û£¬ÀýÈ磺
xclock -xrm "update:3" £¨´íÎó£©
xclock -xrm "*update:3" £¨ÕýÈ·£©
£®²¢·ÇËùÓеÄÓ¦ÓóÌʽ¾ùʹÓÃToolkit £¬·ÇToolkit µÄ³Ìʽ²»Ê¹ÓÃÀà±ð£¬
ÇÒËüÃǵÄÊôÐÔÃû³ÆÒ²¿ÉÄܲ»Í¬¡£ÀýÈ磬¹æ¸ñ
*geometry: 300*400+500+600
¶Ôxclock£¬xlogo ÓÐЧ£¬µ«¶Ôxcalc ÎÞЧ£¬ÒòËü²»Ê¹ÓÃToolkit £¬xcalc
ʹÓÃÊôÐÔÃû³ÆGeometry£¨¿ªÍ·Îª´óдµÄG £©£¬ÒòΪÔÚÕâÖÖÇé¿ö£¬Toolkit
Àà±ðÃû³ÆºÍxcalc µÄÊôÐÔÃû³ÆÏàͬ£¬ËùÒÔµ¥¶ÀÒ»¸ö¹æ¸ñ
*Geometry: 300*400+500+600
¿ÉÒÔ¶ÔËùÓÐÕâÀàµÄÓ¦ÓóÌʽÓÐЧ¡£
£®Äã¿ÉÄÜÔÚ¹æ¸ñÖÐÓÃÁË´íÎóµÄÊôÐÔ»òWidgetµÄÃû³Æ£¬ÌرðÊÇÈÝÒ×°ÑÀà±ðÃû
³ÆºÍ³ÉÔ±Ãû³Æ¸ã»ì£¬ÀýÈ磺ÒÔÏÂÁ½Õß¾ù´í£º
xclock*Update: 10
xclock*interval: 10
ÆäËü³£¼ûµÄ´íÎóÈ磺
xterm*Text*background:blue
Ëü²»ÄÜÖ´ÐеÄÔÒòΪxterm ²¢Î´Ê¹ÓÃText widget £¬xterm Õý³£µÄÊÓ´°
ºÍTektronix µÄÊÓ´°·Ö±ðʹÓÃwidgetÀà±ð VT100ºÍTek ¡£×îáᣬµ±Äã
ÖªµÀÒ»¸öwidgetÊÇʲ÷áÀà±ð£¬Äã¿ÉÄܶԳÉÔ±Ãû³Æ¼ÙÉè´íÎ󣬲»ÊÇwidget
±¾Éí±ãÊÇÆäÖÐÖ®Ò»µÄÊôÐÔ¡£ÊÔÖø¸ü»»Àà±ðÃû³ÆÀ´ÐÞÕýÕâ¸öÎÊÌâ¡£
£®¼´Ê¹ÄãÒÑÉ趨ʵ¼ÊµÄwidgetºÍÊôÐÔÃû³Æ»òÀà±ð£¬Ó¦ÓóÌʽ¿ÉÄÜÒÔ²»ÊÇÄã
Ô¤Æڵķ½Ê½Ê¹ÓÃËüÃÇ¡£ÀýÈ磺Äã¿ÉÄÜÉ趨ÈçÏ£º
xterm*Width: 40
xterm*Height: 10
ÒâͼÓñÈƽ³£½ÏСµÄÊÓ´°Æô¶¯xterm £¬µ«Ëü²»ÄÜÖ´ÐУ¬xterm Ö»ÄÜÔÚ
Tektronix windowÓ¦ÓÃÕâЩֵ£¬ÎÞ·¨ÔÚÕý³£µÄÊÓ´°¡£
£®Äã¿ÉÄÜËùÓеÄÉ趨ÍêÈ«ÕýÈ·£¬µ«ÈÔȻʲ÷áҲû·¢Éú£¬ÀýÈ磺
xmh -xrm "*inc.Label: Include"
ÊÇÒ»¸öÕýÈ·µÄ·½Ê½£¬Ö´ÐÐxmh ²¢Ö¸¶¨label Ϊinc ºÐµÄ±ØÐë±»"Include"¡£
µ«ÔÚ±ê׼ϵͳµÄ·¢Ðа棬ÊÇûÓÐÈκζ¯×÷·¢ÉúµÄ£¬ÔÒòÊÇxmh ÓÐÒ»¸öÓ¦
ÓóÌʽÉ趨ԤÉèÖµµµ°¸/usr/lib/X11/app-defaults/Xmh £¬ÆäÖÐÓÐÒ»ÐУº
xmh*inc.label:Incorporate New Mail
Õâ¸ö¹æ¸ñ½ÏÎÒÃǵÄÉ趨ÓнϸßÓÅÏÈ¡£
£®½«¹æ¸ñ
*Width: 200
ÉÏÒ»Ò³ [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] ÏÂÒ»Ò³
µ¥¶À°üº¬ÔÚ×ÊÁϿ⽫µ¼Ö´ó¶àÊýµÄToolkit ³ÌʽÆôʼʧ°Ü£¬ÇÒÓÐÒ»¸ö
ѶϢ˵ËüµÄ"shell widget has zero height or width" ¡£Èç¹ûÄãÉ趨
heightºÍwidth ¶þÕßÖ®Ò»£¬Äã±ØÐëÒ²É趨ÁíÍâÒ»¸ö¡£
£®Èç¹ûÄãÓñà¼Æ÷½¨Á¢Ò»¸öresourceµµ°¸£¬Äã¿ÉÄÜÊ¡ÂÔÁË×îááÒ»¸önew line
Õ⽫µ¼Öµ±ÄãÊÔͼÓÃxrdbÔØÈëËüʱÕû¸öµµ°¸¾ù±»ºöÂÔ¡£ÎªÁ˱ÜÃâÈç´Ë£¬
µ±ÔØÈëresourceʱ£¬ÓÃÒ»¸öÃüÁîÁÐÏñ£º
xrdb resfile; xrdb -query
Èç¹ûxrdbÎÞ·¨ÁÐÓ¡³öresfile ÖеÄÄÚÈÝ£¬¾ÍÊÇÓÐÎÊÌâÁË¡£
£®Äã¿ÉÄÜÍüÁËÓÃ-xrmÑ¡ÏîµÄÒýÊýÀ´»ñµÃresource¹æ¸ñ£¬ÓÐʱÓÐÈË»á°Ñ
resource¹æ¸ñ·ÅÈëÒ»¸öµµ°¸£¬¶øÒÔµµ°¸Ãû³ÆΪ-xrmµÄÒýÊý£¬Ô¤ÆÚËü×Ô´Ë
µµ°¸ÖжÁÈ¡resources¡£
£®×îáᣬһ¸ö·Ç³£ÈËÐԵĴíÎ󣬵±Äã·¢ÉúÎÊÌ⣬Äãͨ³£»áÑ»·¶¯×÷£º±à¼
resourceµµ°¸... ´¢´æËü... ÔØÈëresourceµ½×ÊÁÏ¿â... Ö´ÐÐÓ¦ÓóÌʽ
ºÍ¿´Ò»¿´·¢Éúʲ÷á×´¿ö¡£¡±ÆäÖÐÔØÈëresourceµ½×ÊÁϿ⡱³£³£»á±»ºöÂÔ
ÒÔÖÂÄã¸üΪÀ§»ó¡£
16.4 ½áÂÛ
±¾ÕÂÖУ¬ÄãÒÑ¿´¹ýÁËËùÓÐÄãÄÜÉ趨resourceµÄµØ·½£¬ÎªºÎÓÐÕâ÷á¶àÖֵķ½
·¨£¬ÈçºÎ¾ö¶¨É趨·ÅÖÃÔںδ¦¡£Äã¿´µ½ÈçºÎʹÓÃxrdb³ÌʽÔÚserverʵ¼ÊµØ´¢´æ
Ô¤ÉèÖµ£¬ËüÃÇÔں䦱»serverËùÓеÄclient´æÈ¡£¬ÉõÖÁËüÃÇ¿ÉÒÔÔÚÔ¶·½µÄ»úÆ÷
ÉÏÖ´ÐС£×îáᣬÓÐһЩ¹Ø춳£¼û´íÎóµÄʵ¼ÊÌáʾ£¬¸æËßÄãʲ÷áÐèҪעÒâ¡£
ÄãÏÖÔÚ´¦ì¶Êµ¼ÊʹÓÃresources £¬ºÍ¼ô²ÃÄãµÄϵͳÊʺÏÄãµÄ¿Ú棬resource
½á¹¹¹¦Äܷdz£Ç¿´óÇÒÓÐÎÞÏ޵ĵ¯ÐÔ£¬ËùÒÔËü¿ÉÈÃÄ㶨ÖÆÈκÎÄãÐèÒªµÄÊ¡£¸Õ¿ª
ʼ²»·ÁÊÔһЩÏñ×ÖÐÍ»òÉ«²ÊÖ®Àà¼òµ¥µÄÉ趨£¬µ±ÄãÊì춻ù±¾µÄ½á¹¹Ê±£¬ÔÙתµ½
¸ü¸ßË®×¼µÄÀý×Ó¡£
ÏÂÒ»Õ½«¸æËßÄãÈçºÎʹÓÃÌرðÐÎʽµÄresource¹æ¸ñ -- Translations£¨×ª
Ò룩£¬À´¼ô²ÃÄãµÄ¼üÅÌÒÔÊÊì¶ÌرðµÄÓ¦ÓóÌʽ¡£
=====
µÚ£±£·Õ ¶¨ÖÆÄãµÄ¼üÅ̺ͻ¬Êó -- תÒë
µçÄԵļüÅÌͨ³£º¬ÓÐһЩ "ÌØÊ⹦ÄÜ" (special function)¼ü£¬ÔÚ´ËÓÐÒ»
Щ·½·¨À´ "Öƶ¨"(program)ÕâЩÌØÊ⹦Äܼü£¬Ê¹ËüÃÇÄÜÍê³ÉÌض¨µÄ¹¦ÄÜÒÔÊʺÏ
Ä㹤×÷µÄ·½Ê½¡£ÀýÈ磬Äã¿ÉÒÔ¶¨ÒåһЩ¼üÀ´ÊäÈëÄÇЩÄã³£ÓõÄÃüÁ»òÖ»Ðè°´
Ò»¸ö¼ü±ãÄܹ»ÊäÈëһЩ³ÌʽµÄƬ¶Î¡£
ÔÚ£ØÖУ¬ÄãÄÜÖƶ¨µÄ²»Ö»Êǹ¦Äܼü¶øÒÑ£¬ÆäËüÒ»°ãµÄ¼üºÍ»¬ÊóµÄ°´Å¥Ò²¶¼
¿ÉÖƶ¨¡£¶Ôÿһ¸öÓ¦ÓóÌʽ£¬Äã¾ù¿ÉÖ¸¶¨ÌرðµÄ¹¦Äܸø¼üÅ̺ͻ¬Êó°´Å¥£¬»òÁ½
ÕßÖ®×éºÏ¡£ (ÀýÈçÔÚ xeditÖÐÄã¿ÉÒÔ½áºÏSHIFT ¼üºÍ»¬ÊóµÄÓÒ°´Å¥À´ÈÃÄãÏòÇ°
Òƶ¯Ò»¸öµ¥×Ö)¡£ ËùÓÐʹÓÃ£Ø ToolkitµÄ³Ìʽ¾ùÔÊÐíʹÓÃÕßÀûÓÃÒ»¸ö±»³Æ֮Ϊ
¼üÅÌתÒë (translations) µÄÉèÊ©À´Ö´ÐдËÖÖ¶¨Ò壬ÇÒ´ËÖÖ¶¨Òå½åÖøÕý¹æµÄ
resources ½á¹¹´«µÝ¸øÓ¦ÓóÌʽ¡£ (ÄÇЩ²»Ê¹ÓÃ£Ø ToolkitµÄÓ¦ÓóÌʽ£¬Í¬Ñù
µØÒ²¿ÉÒÔÓÃÏàͬµÄÉèÊ©À´Öƶ¨, µ«ËüÃÇÐè¸ö±ðµÄ¶¨ÒåËùÒÔ²»Äܹ㷺µØÓ¦Ó㬴Ó
ÏÖÔÚÆð£¬ÎÒÃǼÙÉèÿµ±ÌÖÂÛÓйØתÒëµÄÖÖÖÖ£¬¾ùΪ¶ÔÄÇЩʹÓÃ£Ø ToolkitµÄÓ¦
ÓóÌʽ¶øÑÔ¡£)
¾ÍÈçͬËùÓÐµÄ resourcesÒ»Ñù£¬×ªÒëÊǵ±Ó¦ÓóÌʽִÐÐʱ²Å±»´¦Öá£ÀýÈç
Äã¿ÉÒÔÓµÓÐÊý¸ö¾ß±¸²»Í¬×ªÒëÉ趨µÄ xedit£¬ÔÚͬʱһÆðÖ´ÐС£( Äã¿ÉÒÔÈÃÒ»
¸öxedit Êʺϱ༱¾ÎÄ£¬ÁíÒ»¸öÊʺϱ༳ÌʽÂ룬¶øÁíÒ»¸öÊʺϱà¼ÎÄÊé)¡£
±¾ÕÂÌÖÂÛתÒë -- °ü¹ÎËüÃǵĶ¨Òå¸ñʽ£¬ÈçºÎ½«ËüÃÇÉ趨µ½Ó¦ÓóÌʽ£¬ºÍ
ËüÃÇËùº¸Ç¹¦Äܵķ¶Î§¡£ÎÒÃÇÊ×ÏÈÒÔʵÀýÀ´½éÉÜ£¬Ö𽥵ص¼ÒýÄã¿´µ½²»Í¬µÄ½Ç
¶È¡£¶øáá±È½ÏÕýʽºÍÏêϸµØÌÖÂÛתÒë¡£×îáᣬÎÒÃÇÁгöµ±ÄãʹÓÃתÒëʱ³£»áÅö
µ½µÄ´íÎ󣬲¢¸øÄãһЩÈçºÎ¿Ë·þÕâЩÎÊÌâµÄÌáʾ¡£
17.1 ʵ¼ÊʹÓÃתÒë
Toolkit תÒë½á¹¹×î¼òµ¥µÄÓÃ;±ãÊÇÈÃÄãÖƶ¨Äã¼üÅ̵ļü¡£ÀýÈ磬µ±Äãʹ
ÓÃxterm Ϊһ¸öÖ´ÐÐÒ»°ãshell ÃüÁîµÄÊÓ´°Ê±£¬Äã¿ÉÄÜÏ£Íû¶¨ÒåһЩÌØÊ⹦ÄÜ
¼üÀ´ÊäÈëÄã³£ÓõÄÃüÁÇÒÏ£ÍûÖ¸¶¨µÄ¹ØϵÈçÏ£º
µ±ÎÒ°´ÏÂÕâ¸ö¼üʱ... ÎÒÏ£ÍûÕâ¸ö×Ö´®±»ÊäÈë
F1 rm core *.tmp <newline>
ÀûÓÃToolkit ´ïµ½´ËÄ¿µÄ·½·¨Îª£ºÖ¸¶¨Ò»¸öÖµ¸øʹÓÃתÒëµÄwidgetÖеÄresources
¡£´ËÖµÉ趨ӦÓóÌʽÖÐËù±ØÐèµÄ¶¨ÖÆ (customisation)£¬ÇÒ±»Toolkit µÄ Trans-
lation Manager (תÒë¹ÜÀíÆ÷) Ëù´¦Àí¡£´Ë resourcesÊôì¶Àà±ðTranslation,
ÇÒÆä³ÉÔ±Ãû³Æ¼¸ºõÒ»¶¨ÊÇtranslations¡£
ÔÚÏÂÒ»½ÚÎÒÃǽ«¿´µ½É趨µ½resources ÖеÄÖµµÄ¸ñʽ¡£
17.1.1 ÈçºÎ¶ÔÒ»¸öÓ¦ÓóÌʽָ¶¨×ªÒë
¶ÔÇ°Êöxterm µÄÀý×Ó£¬ÎÒÃǶ¨Òå (ÔÚ¼´½«±»Ó¦ÓóÌʽ¶ÁÈëµÄresource×ÊÁÏ
¿âÖлòһЩresourceµµ°¸ÖÐ) Ò»¸ö¹æ¸ñÀàËÆ£º
xterm*VT100*Translations: (contd.)
<key>F1: string("rm core *.tmp") ×¢Ò⣺²»ÍêÕû£¡£¡
ÆäÒâΪÔÚÈκÎÀà±ð VT100µÄ xterm widget ÖУ¬µ±¼ü F1 ±»°´ÏÂʱ£¬²åÈë
×Ö´® "rm core *.tmp")¡£
²»ÐÒµÄÊÇ£¬²¢Ã»ÓÐÕâ÷á¼òµ¥£¬×ªÒë¹ÜÀíÆ÷»á°ÑÉÏÃæµÄ¹æ¸ñ½âÊÍΪ "È¥µôËù
ÓÐÏÖ´æµÄתÒ룬ÇÒ¼ÓÈë... " £¬ËùÒÔËùÓÐÕý³£µÄÏñ " A¼üÊDzåÈëÒ»¸ö A" ÕâÖÖ
ϵ½á (binding)¶¼»áÏûʧ¡£ÎªÁË¿Ë·þÕâµã£¬Äã±ØÐèʹÓÃһЩ±»³ÆΪ directive
(Ö¸Òý)µÄÓï·¨²åÈëÔÚ resource ֵ֮ǰ£º
ÉÏÒ»Ò³ [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] ÏÂÒ»Ò³
xterm*VT100*Translations: #override(contd.)
<key>F1: string("rm core *.tmp")
ͨ³£Äã»áÏ£Íû±£³Ö´ó²¿·ÝÏÖ´æµÄϵ½á£¬¶øÖ»ÊÇ°ÑÄãÃ÷È·Ö¸¶¨µÄÖµ¸²¸ÇÉÏÈ¥
£¬ËùÒÔÄãÒ»°ã¶¼ÊÇÔÚÄãµÄתÒë±íÖУ¬Ö¸¶¨ #override¡£
ÏÖÔÚÕâ¸ö¹æ¸ñ¿ÉÒÔ¿ªÊ¼¹¤×÷ÁË£¬½åÖøÆôʼһ¸ö xtermÇҰѴ˹æ¸ñ (ÔÚÁ½¸ö
µ¥ÒýºÅ (')ÖмäµÄ²¿·Ý) µ±³ÉÑ¡Ïî -xrm µÄÒýÊýÀ´²âÊÔËü£º
xterm -xrm 'xterm*VT100*Translations: ... µÈµÈ'
°´ÏÂÌØÊ⹦Äܼü F1,Ä㽫¿´µ½Ö¸¶¨µÄ×Ö´®³É¹¦µÄ²åÈ룬µ«²¢Î´°üº¬ÐÂÁÐ×ÖÔª
(newline) £¬Äã¿ÉÒÔÓÃÒ»µãÓï·¨µÄ¼¼ÇÉÀ´¿Ë·þËü£¬Ïñ£º
xterm*VT100*Translations: #override(contd.)
<key>F1: string("rm core *.tmp")string(0xd)
Õâ½âÊÍÁËÒÔÏÂÁ½µã£º
1. string()µÄ×÷ÓúÍËüµÄÒýÊýÏà¹Ø¡£Äã¿ÉÒÔÖ±½ÓÊäÈë±¾ÎÄ (ÀýÈç string(lpq))
£¬µ«Èç¹û±¾ÎÄ°üº¬¿Õ°×»ò·Ç×Öĸ×ÖÔª£¬Ôò±ØÐèÔÚ±¾ÎÄÇ°áá¼ÓÉÏË«ÒýºÅ¡£
Èç¹ûÒýÊýÊÇÒÔ "0X" ¿ªÍ·£¬Ôò½«Æäáá½âÊÍΪʮÁù½ø룬²¢²åÈëÏà¶ÔµÄ
ASCII ×ÖÔª¡£(ÀýÈ磬0xdÊÇRETURN)
2. ÔÚÄãÖ¸¶¨´Ë¹¦ÄÜʱ¿É½áºÏÒ»¸öÒÔÉϵÄ×÷Óã¬ÔÚÉÏÀý£¬ÎÒÃÇÓõ½ string()
×÷ÓÃÁ½´Î£¬Èç¹ûÎÒÃÇÖªµÀÆäËüµÄ×÷Óã¬ÎÒÃÇÒ²Ò»Ñù¿ÉÒÔϵ½áÆðÀ´¡£
¶¨ÒåÐí¶àµÄתÒëÔÚÒ»Æð
Äã¿ÉÒÔ¸ù¾ÝÐèÇóÔÚÒ»¸ö±íÖж¨ÒåÐí¶àµÄתÒë¡£¼ÙÉ裬ÎÒÃÇÔÚÇ°ÃæµÄתÒëÖÐÔö¼Ó
ϵ½á£º
µ±ÎÒ°´ÏÂÕâ¸ö¼üʱ... ÎÒÏ£ÍûÕâ¸ö×Ö´®±»ÊäÈë
F2 lpq-Plpa3 <newline>
¶Ô´ËµÄתÒëΪ£º
<Key>F2: string("lpq-Plpa3")string(0xd)
ËùÒÔ¿ÉÒÔ½«±¾ÁмÓÈëÇ°ÃæµÄ±íÖС£µ«ÊÇתÒë¹ÜÀíÆ÷µÄ¸ñʽ¹æÔò¸æËßÎÒÃDZØÐ轫
Á½¸öתÒëÒÔ "\n" ·Ö¿ªÇÒ¶ÀÁ¢³ÉΪһÁУº
xterm*VT100*Translations: #override(contd.)
<key>F1: string("rm core *.tmp")sting(0xd) \n(cond.)
<Key>F2: string("lpq-Plpa3")string(0xd)
ÒÔÉϵÄÐÎʽ½«Ôì³É¹ÜÀíÉϵÄÀ§ÄÑ£¬Äã¿ÉÒÔ½åÖø°üº¬ "Òþ²ØµÄÐÂÁÐ×ÖÔª" À´Ê¹Ëü
¾ß¿É¶ÁÐÔһЩ£º (ÐÂÁÐ×ÖÔªÒÔµ¹Ð±Ïß ""´¦Àí)
xterm*VT100*Translations: #override\n\
<key>F1: string("rm core *.tmp")sting(0xd)\n\
<Key>F2: string("lpq-Plpa3")string(0xd)
Äã¿ÉÒÔ·ÅÖÃÈÎÒâ¶à¸öÄãËùÐèµÄ "Òþ²ØµÄÐÂÁÐ×ÖÔª" , ÇÒ¼¸ºõÔÚÈκεط½¾ù¿É£¬
ËüÃÇÖ»ÊDZ»ºöÂÔ¶øÒÑ¡£ (Ö»ÒªºÍתÒë¹ÜÀíÆ÷Ïà¹Ø£¬ÉõÖÁÄãÿ¸ôÒ»¸öµ¥×Ö±ãʹÓÃ
Ò»¸öҲû¹Øϵ¡£µ«Ç§Íò²»ÒªÔÚÒ»¸ö¹æ¸ñµÄ resource ÌØá粿·ÝʹÓÃËüÃÇ£¬ËüÃÇ
ÎÞ·¨±»resource manager½âÊÍ£¬Ò²Ã»ÓÐÏàͬµÄЧ¹û¡£) Èç¹ûÄã¸Ð¾õÓÐЩ»ìÏý£¬
²»Óõ£ÐÄ¡£¼òµ¥µØ˵£¬resource½á¹¹ÐèÒªµÄÊÇÒªÔÚÒ»ÁÐÖеÄÒ»¸öresource¹æ¸ñ
µÄ "Öµ" µÄ²¿·Ý£¬¶øתÒë¹ÜÀíÆ÷ÒÔ·Ö¿ªµÄÁÐÀ´·Ö¿ª (Ò²¾ÍÊÇÒÔ\nÖÕ½á)£¬¶øʹÓÃ
Õ߸պÃÒÔÿһ¸öʵ¼Ê·Ö¿ªµÄÁдú±íÒ»¸öÒâÒåÒÔÔö¼Ó¿É¶ÁÐÔ£¬ËùÒÔ¹æÔòºÜ¼òµ¥£º
ÔÚ³ýÁË×îááÒ»ÁеÄÿһ¸öתÒëÁоù¼ÓÉÏÒ»¸ö "\n"¡£
17.1.2 תÒë¿Éϵ½áÐí¶àÐÍʽµÄ×÷ÓÃ
ÉÏÊöµÄ xterm·¶Àý£¬Õ¹Ê¾ÁËÈçºÎÄܹ»µ±Äã°´ÏÂÒ»¸ö¼üʱ£¬²åÈëÈÎÒâµÄ×Ö´®¡£µ«
תÒë½á¹¹µÄ¹¦ÄܱÈÕâ¸ü¶à -- Ëü¿ÉÒÔϵ½áÈκÎwidgetËùÌṩµÄ×÷Óõ½°´¼ü£¬ÈÃ
ÎÒÃÇÏêϸһµãµØ¿´Ò»ÏÂÕâЩ×÷Óá£
Ç°ÊöµÄÀý×Ó£¬ÎÒÃÇÔÚ xtermµÄ VT100 widgetÍê³ÉÁ˼üF1ºÍF2ÔÚ string()
ÉϵĶÔÓ¦¡£ÎÒÃǽ«ÈÔÒÔ xtermΪÀý£¬ËµÃ÷¸ü¶àµÄ×÷Óá£
²éÔÄxterm µÄÖ¸ÄÏÒ³£¬ÔÚ±êÌâKEY TRANSLATIONS ºÍ KEY/BUTTON BINDINGS
Ä㽫·¢ÏÖÁÐÓÐÊý¸ö×÷Óá£ÎÒÃǽ«¶¨ÒåÒ»¸öתÒë¶ÔÓ¦¼üF3µ½insert-selection()
×÷ÓÃÖ®ÉÏ£¬ËùÒÔÎÒÃÇ¿ÉÒÔÓüüÅÌÀ´È¡´ú»¬Ê󣬽«ÏÈÇ° "¼ô"ϵı¾ÎÄ "Ìù"³ö¡£
Ö¸ÄÏÒ³¸æËßÎÒÃÇ´Ë×÷ÓÃÐèÒªÒ»¸öÒýÊý£¬´ÓÁгöµÄÔ¤Éèϵ½á£¬ÎÒÃÇ¿ÉÒÔ¿´³öÔ¤Éè
µÄ "¼ôÌù" ½á¹¹ÎªÊ¹Óà CUT_BUFFER0, ËùÒÔÎÒÃǽ«CUT_BUFFER0µ±×÷ÒýÊý¡£ÎÒÃÇ
µÄresource¹æ¸ñÊÇ£º
xterm*VT100*Translations: #override\n\
<key>F3: insert-selection(CUT_BUFFER0)
µ½Ä¿Ç°ÎªÖ¹£¬ÕâÖ»ÊÇÒ»µãССµÄ±ãÀû¡£È»¶ø£¬¼Ù¶¨ËµÄ㻨ÁËÐí¶àʱ¼äÔÚ±¾ÎÄÎÄ
¼þÉϹ¤×÷£¬ÄãÓà tbl¸ñʽ»¯£¬ÄãÓà nroffÔÚÓ©Ä»ÉÏÔ¤ÊÓ (preview)ËüÃÇ£¬ÓÃ
troff ÅŰ棬ÇÒ½«Êä³öË͵½ÄãµÄÒ»¸öÓùýÂËÆ÷ (filter) Ϊtr2printerµÄÓ¡±í
»úÉÏ¡£É趨תÒëΪ£º
xterm*VT100*Translations: #override\n\
<key>F3: string("ed") insert-selection(CUT_BUFFER0)\
ÉÏÒ»Ò³ [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] ÏÂÒ»Ò³