LECTURE 4 ¥¤¥Ù¥ó¥È½èÍý

¡û ¤Ï¤¸¤á¤Ë

X ¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à¤Ë¸Â¤é¤º¡¢°ìÈÌŪ¤Ë GUI ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï³°Éô¤«¤é¤Î²¿¤é¤«¤ÎƯ¤­¤«¤±(¥¤¥Ù¥ó¥È)¤ò¼õ¤±¤Æ¡¢¤½¤ì¤Ë±þ¤¸¤¿½èÍý¤ò¹Ô¤¦¤³¤È¤ÇÆ°ºî¤·¤Þ¤¹¡£¤è¤Ã¤Æ¡¢¼«Ê¬¤¬¤É¤Î¤è¤¦¤Ê¥¤¥Ù¥ó¥È¤òɬÍפʤΤ«¡¢¤É¤¦¤¹¤ì¤ÐɬÍפʥ¤¥Ù¥ó¥È¤ò¼õ¤±¼è¤ë¤³¤È¤¬¤Ç¤­¤ë¤Î¤«¡¢¤Ë¤Ä¤¤¤ÆÃΤëɬÍפ¬¤¢¤ê¤Þ¤¹¡£

¤³¤³¤Ç¤Ï X ¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à¤Ë¤ª¤±¤ë¥¤¥Ù¥ó¥È½èÍý¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤¤¤­¤Þ¤¹¡£

¡û ¥¤¥Ù¥ó¥È¤È¤Ï

X ¤Ë¤ª¤±¤ë¥¤¥Ù¥ó¥È¤È¤Ï¡¢X ¥µ¡¼¥Ð¤«¤é¥¯¥é¥¤¥¢¥ó¥È¤ËÁ÷¤é¤ì¤ë¾ðÊó¤Î¤³¤È¤Ç¤¹¡£¥¤¥Ù¥ó¥È¤Ï¡¢È¯À¸¤·¤¿½çÈÖ¤Ë X ¥µ¡¼¥Ð¤«¤é¥¯¥é¥¤¥¢¥ó¥È¤ËÈóƱ´ü¤Ç¤½¤ì¤¾¤ì¤Î¥¦¥£¥ó¥É¥¦¤´¤È¤ËÁ÷¤é¤ì¤Þ¤¹¡£GUI ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï°ìÈÌŪ¤Ë¥¤¥Ù¥ó¥È¶îÆ°·¿¥×¥í¥°¥é¥à¤Ç¤¢¤ê¡¢¤³¤ì¤é¤Î¥¤¥Ù¥ó¥È¤Ë±þ¤¸¤Æ½èÍý¤ò¹Ô¤¦¤È¤¤¤¦·Á¤Ç¥³¡¼¥É¤ò½ñ¤¤¤Æ¤¤¤­¤Þ¤¹¡£

LECTURE 1 ¤Ç¤â¾¯¤·ÀâÌÀ¤·¤¿¤è¤¦¤Ë¡¢¼«Ê¬¤¬ÄÌÃΤ·¤ÆÍߤ·¤¤¥¤¥Ù¥ó¥È¤Î¼ïÎà¤ò¤¢¤é¤«¤¸¤á X ¥µ¡¼¥Ð¤Ë¶µ¤¨¤Æ¤ª¤¯¤³¤È¤Ë¤è¤ê¡¢É¬Íפʥ¤¥Ù¥ó¥È¤¬È¯À¸¤·¤¿»þ¤Ë X ¥µ¡¼¥Ð¤¬¤½¤ì¤òÄÌÃΤ·¤Æ¤¯¤ì¤Þ¤¹¡£ÄÌÃΤ·¤ÆÍߤ·¤¤¥¤¥Ù¥ó¥È¤ò X ¥µ¡¼¥Ð¤Ë¶µ¤¨¤Ê¤¤¾ì¹ç¤Ë¤Ï¥¤¥Ù¥ó¥È¤ÏÁ÷¤é¤ì¤Æ¤­¤Þ¤»¤ó¤¬¡¢Ãæ¤Ë¤Ï̵¾ò·ï¤ËÄÌÃΤµ¤ì¤ë¥¤¥Ù¥ó¥È¤â¸ºß¤·¤Þ¤¹¡£

¡û ¥¤¥Ù¥ó¥È¤ÎÁªÂò

Á°½Ò¤·¤¿¤è¤¦¤Ë¡¢¼ÂºÝ¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤ÏɬÍפʥ¤¥Ù¥ó¥È¤À¤±¤òÄÌÃΤ·¤Æ¤¯¤ì¤ë¤è¤¦¤Ë X ¥µ¡¼¥Ð¤Ë°ÍÍꤷ¤Þ¤¹¡£¤½¤Î¤¿¤á¤Ë¤Ï XSelectInput() ¤ò»È¤¤¤Þ¤¹¡£

XSelectInput( Display* display, Window w, long event_mask );

event_mask : ɬÍפʥ¤¥Ù¥ó¥È¤ò¥¤¥Ù¥ó¥È¥Þ¥¹¥¯¤Ç»ØÄꤹ¤ë¡£

event_mask ¤Ë¤Ï¡¢win ¤Ç»ØÄꤷ¤¿¥¦¥£¥ó¥É¥¦¤Ë¤ª¤¤¤ÆÄÌÃΤ¬É¬Íפʥ¤¥Ù¥ó¥È¤ò»ØÄꤷ¤Þ¤¹¡£¥¤¥Ù¥ó¥È¤Î»ØÄê¤Ë¤Ï¥¤¥Ù¥ó¥È¥Þ¥¹¥¯¤ò»È¤¤¤Þ¤¹¡£Ê£¿ô¤Î¥¤¥Ù¥ó¥È¤òÁªÂò¤¹¤ë¾ì¹ç¤Ï¡¢¥¤¥Ù¥ó¥È¥Þ¥¹¥¯¤ÎÏÀÍýϤò»ØÄꤷ¤Þ¤¹¡£¥¤¥Ù¥ó¥È»ØÄê¤Ï¥¦¥£¥ó¥É¥¦¤´¤È¤Ë¹Ô¤ï¤Ê¤¯¤Æ¤Ï¤¤¤±¤Ê¤¤¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£

Îɤ¯»È¤¦¡¢¤â¤·¤¯¤ÏËͤ¬»È¤¤Êý¤òÃΤäƤ¤¤ë¥¤¥Ù¥ó¥È¤Ë¤Ä¤¤¤Æ¡¢¥¤¥Ù¥ó¥È̾¡¢¥¤¥Ù¥ó¥È¤ÎÆâÍÆ¡¢¥¤¥Ù¥ó¥È¥Þ¥¹¥¯¤ÎÂбþ¤ò²¼É½¤Ë¤Þ¤È¤á¤Æ¤ª¤­¤Þ¤¹¡£Á´¤Æ¤Î¥¤¥Ù¥ó¥È¤Ë¤Ä¤¤¤Æ½ñ¤«¤ì¤Æ¤¢¤ë¤ï¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¤Î¤Ç¡¢Ãí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£

¥¤¥Ù¥ó¥È¥Þ¥¹¥¯ ¥¤¥Ù¥ó¥È¤ÎÆâÍÆ ¥¤¥Ù¥ó¥È¤Î¼ïÎà
FocusChangeMask ¥­¡¼¥Ü¡¼¥É¥Õ¥©¡¼¥«¥¹¾õÂÖ¤¬ÊѤï¤Ã¤¿ FocusIn, FocusOut
KeyPressMask ¥­¡¼¤¬²¡¤µ¤ì¤¿ KeyPress
KeyReleaseMask ¥­¡¼¤òÎ¥¤·¤¿ KeyRelease
ButtonPressMask ¥Þ¥¦¥¹¥Ü¥¿¥ó¤ò²¡¤·¤¿ ButtonPress
ButtonReleaseMask ¥Þ¥¦¥¹¥Ü¥¿¥ó¤òÎ¥¤·¤¿ ButtonRelease
EnterWindowMask ¥Þ¥¦¥¹¥«¡¼¥½¥ë¤¬¥¦¥£¥ó¥É¥¦¤ËÆþ¤Ã¤¿ EnterNotify
LeaveWindowMask ¥Þ¥¦¥¹¥«¡¼¥½¥ë¤¬¥¦¥£¥ó¥É¥¦¤«¤é½Ð¤¿ LeaveNotify
PointerMotionMask ¥Þ¥¦¥¹¥«¡¼¥½¥ë¤¬°ÜÆ°¤·¤¿ MotionNotify
Button1MotionMask ¥Ü¥¿¥ó1¤ò²¡¤·¤¿¤Þ¤Þ¥Þ¥¦¥¹¥«¡¼¥½¥ë¤¬°ÜÆ°¤·¤¿ Ʊ¾å
Button2MotionMask ¥Ü¥¿¥ó2¤ò²¡¤·¤¿¤Þ¤Þ¥Þ¥¦¥¹¥«¡¼¥½¥ë¤¬°ÜÆ°¤·¤¿ Ʊ¾å
Button3MotionMask ¥Ü¥¿¥ó3¤ò²¡¤·¤¿¤Þ¤Þ¥Þ¥¦¥¹¥«¡¼¥½¥ë¤¬°ÜÆ°¤·¤¿ Ʊ¾å
Button4MotionMask ¥Ü¥¿¥ó3¤ò²¡¤·¤¿¤Þ¤Þ¥Þ¥¦¥¹¥«¡¼¥½¥ë¤¬°ÜÆ°¤·¤¿ Ʊ¾å
Button5MotionMask ¥Ü¥¿¥ó3¤ò²¡¤·¤¿¤Þ¤Þ¥Þ¥¦¥¹¥«¡¼¥½¥ë¤¬°ÜÆ°¤·¤¿ Ʊ¾å
ButtonMotionMask ¥Ü¥¿¥ó¤ò²¡¤·¤¿¤Þ¤Þ¥Þ¥¦¥¹¥«¡¼¥½¥ë¤¬°ÜÆ°¤·¤¿ Ʊ¾å
PointerMotionHintMask ¥Þ¥¦¥¹¤Î¾¤ÎMotionMask¤È°ì½ï¤ËÍѤ¤¤Æ¡¢¥¤¥Ù¥ó¥È¤ò°µ½Ì¤¹¤ë Ʊ¾å
ExposureMask GraphicsExpose¡¢NoExpoes¤ò½ü¤¯Á´¤Æ¤ÎExpose¥¤¥Ù¥ó¥È Expose
StructureNotifyMask ¥¦¥£¥ó¥É¥¦¤ÎÂ礭¤µ¡¢°ÌÃÖ¡¢¥Ü¡¼¥À¤ÎÉý¡¢¥¹¥¿¥Ã¥¯½ç½ø¤ÎÊѹ¹ DestroyNotify, UnmapNotify, MapNotify, ReparentNotify, ConfigureNotify, GravityNotify, CirculateNotify
SubstructureNotifyMask »Ò¥¦¥£¥ó¥É¥¦¤ÎÂ礭¤µ¡¢°ÌÃÖ¡¢¥Ü¡¼¥À¤ÎÉý¡¢¥¹¥¿¥Ã¥¯½ç½ø¤ÎÊѹ¹ CreateNotify, ¸å¤ÏStructureNotifyMask¤ÈƱ¤¸
¤Ê¤· MappingNotify ¥¤¥Ù¥ó¥È¤Ï¥­¡¼¥Ü¡¼¥É/¥Ü¥¿¥ó¤Î¥Þ¥Ã¥Ô¥ó¥°¤¬ÊѤï¤Ã¤¿¤³¤È¤òɽ¤¹¡£ ClientMessage ¥¤¥Ù¥ó¥È¤Ï¤¢¤ë¥¯¥é¥¤¥¢¥ó¥È¤«¤é XSendEvent() ¤ò»ÈÍѤ·¤ÆľÀÜ Á÷¤é¤ì¤ÆÍ褿¤ê¡¢¥¦¥£¥ó¥É¥¦¥Þ¥Í¡¼¥¸¥ã¥×¥í¥È¥³¥ë¤òÀßÄꤷ¤¿¾ì¹ç¤ËÁ÷¤é¤ì¤ÆÍè ¤¿¤ê¤¹¤ë MappingNotify, ClientMessage

¡û ¥¤¥Ù¥ó¥È¤ÎÆɤ߹þ¤ß

ɬÍפʥ¤¥Ù¥ó¥È¤òÁªÂò¤·¤Æ¥¦¥£¥ó¥É¥¦¤ò¥Þ¥Ã¥×¤·¤¿Ä¾¸å¤«¤é¡¢ÁªÂò¤·¤¿¥¤¥Ù¥ó¥È¤¬¿ï»þ X ¥µ¡¼¥Ð¤«¤éÁ÷¤é¤ì¤ÆÍè¤Þ¤¹¡£¥¯¥é¥¤¥¢¥ó¥È¤Ï¥¤¥Ù¥ó¥È¤òÆɤ߹þ¤ó¤ÇŬÀڤʽèÍý¤ò¹Ô¤¤¤Þ¤¹¡£

¥¤¥Ù¥ó¥È¤òÆɤ߹þ¤à¤Ë¤Ï¡¢XNextEvent()¤ò»È¤¤¤Þ¤¹¡£

XNextEvent( Display* display, XEvent* event_return );
event_return : Æɤ߹þ¤ó¤À¥¤¥Ù¥ó¥È¾ðÊó¤ò³ÊǼ¤¹¤ë¤¿¤á¤Î¥¤¥Ù¥ó¥È¹½Â¤ÂΤò»ØÄê

X ¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à¤Ç¤Ï¡¢X ¥µ¡¼¥Ð¤«¤éÍè¤ë¥¤¥Ù¥ó¥È¤Î¥­¥å¡¼¥¤¥ó¥°¡¢¤ª¤è¤Ó¥¯¥é¥¤¥¢¥ó¥È¤«¤é¤Î¥ê¥¯¥¨¥¹¥È¤Î¥Ð¥Ã¥Õ¥¡¥ê¥ó¥°¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£XNextEvent() ¤Ï¡¢¥¤¥Ù¥ó¥È¥­¥å¡¼¤«¤é¥¤¥Ù¥ó¥È¤ò¼è¤ê¤À¤·¤¿¸å¤Ë¥ê¥¯¥¨¥¹¥È¥Ð¥Ã¥Õ¥¡¤ÎÆâÍƤò X ¥µ¡¼¥Ð¤ËÁ÷¤ê¤Þ¤¹¡£¥¤¥Ù¥ó¥È¥­¥å¡¼¤Ë¥¤¥Ù¥ó¥È¤¬Ìµ¤¤¾ì¹ç¤Ï¡¢XX ¥µ¡¼¥Ð¤Ë¥¤¥Ù¥ó¥È¤òÆɤߤˤ¤¤Ã¤Æ¡¢¤¿¤Þ¤Ã¤Æ¤¤¤ë¥¤¥Ù¥ó¥È¤òÁ´¤Æ¥¤¥Ù¥ó¥È¥­¥å¡¼¤Ë¥»¥Ã¥È¤·¤Þ¤¹¡£¥¤¥Ù¥ó¥È¤¬ X ¥µ¡¼¥Ð¤Ë̵¤¤¾ì¹ç¤Ë¤Ï¡¢¥¤¥Ù¥ó¥È¤¬Á÷¤é¤ì¤ÆÍè¤ë¤Þ¤Ç¥Ö¥í¥Ã¥¯¤·¤Þ¤¹¡£

¥ê¥¯¥¨¥¹¥È¥Ð¥Ã¥Õ¥¡¤Î¥Õ¥é¥Ã¥·¥å¤Ï¡¢XNextEvent() °Ê³°¤Ë¤â¤¤¤¯¤Ä¤«¤Î X ¥é¥¤¥Ö¥é¥ê´Ø¿ô( XCreateSimpleWindow() ¤Ê¤É)¤ò¼Â¹Ô¤·¤¿¤È¤­¤Ë¤â¹Ô¤ï¤ì¤Þ¤¹¡£¤·¤«¤·¾ì¹ç¤Ë¤è¤Ã¤Æ¤Ï¥ê¥¯¥¨¥¹¥È¥Ð¥Ã¥Õ¥¡¤ò¤¹¤°¤Ë¥Õ¥é¥Ã¥·¥å¤·¤¿¤¤»þ¤â¤¢¤ê¤Þ¤¹¡£¶¯À©Åª¤Ë¥ê¥¯¥¨¥¹¥È¥Ð¥Ã¥Õ¥¡¤ò¥Õ¥é¥Ã¥·¥å¤¹¤ë¤Ë¤Ï XFlush() ¤ò»È¤¤¤Þ¤¹¡£¤Þ¤¿¡¢Æ±Íͤδؿô¤Ë XSync() ¤¬¤¢¤ê¤Þ¤¹¡£

XFlush( Display* display );
XSync( Display* display, Bool discard );
discard : True ¤Î¾ì¹ç¡¢¤½¤Î»þÅÀ¤Ç¤¿¤Þ¤Ã¤Æ¤¤¤ë¥¤¥Ù¥ó¥È¥­¥å¡¼¤ÎÆâÍƤòÇË´þ¤¹¤ë¡£

XSync() ¤Ï¥ê¥¯¥¨¥¹¥È¥Ð¥Ã¥Õ¥¡¤Î¥Õ¥é¥Ã¥·¥å¸å X ¥µ¡¼¥Ð¤¬¤½¤Î¥ê¥¯¥¨¥¹¥È¤òÁ´¤Æ½èÍý¤¹¤ë¤Þ¤ÇÂԤäƤ¤¤ëÅÀ¤¬ XFlush() ¤È°Û¤Ê¤ê¤Þ¤¹¡£

¡û ¥¤¥Ù¥ó¥È¤¬Ìµ¤¤¾ì¹ç¤Î½èÍý

Á°½Ò¤ÎÄ̤ꡢXNextEvent() ¤Ï¥¤¥Ù¥ó¥È¥­¥å¡¼¤Ë¥¤¥Ù¥ó¥È¤¬Ìµ¤¤¤È X ¥µ¡¼¥Ð¤Ë¥¤¥Ù¥ó¥È¤òÆɤߤˤ¤¤­¤Þ¤¹¡£¤³¤Î¤È¤­ X ¥µ¡¼¥Ð¤Ë¤â¥¤¥Ù¥ó¥È¤¬¤Ê¤¤¾ì¹ç¡¢¥¤¥Ù¥ó¥È¤¬È¯À¸¤¹¤ë¤Þ¤Ç¥Ö¥í¥Ã¥­¥ó¥°¤·¤Þ¤¹¡£¤Ä¤Þ¤ê¡¢ XNextEvent() ¤ò¼Â¹Ô¤¹¤ë¤È¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï¥¤¥Ù¥ó¥È¤¬È¯À¸¤¹¤ë¤Þ¤Ç½èÍý¤¬»ß¤Þ¤Ã¤Æ¤·¤Þ¤¤¤Þ¤¹¡£¤·¤«¤·¥¤¥Ù¥ó¥È¤¬Ìµ¤¤¾ì¹ç¤Ë¤ÏÊ̤νèÍý¤ò¹Ô¤¤¤¿¤¤¤³¤È¤¬¤è¤¯¤¢¤ê¤Þ¤¹( ¥»¥ó¥µÆþÎϤδƻë¤Ê¤É¡¢¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¤Ç¹Ô¤¤¤¿¤¤¤è¤¦¤Ê½èÍý)¡£

¤³¤Î¤è¤¦¤Ê½èÍý¤Ï¡¢¥¤¥Ù¥ó¥È¤òÆɤߤˤ¤¤¯Á°¤Ë¤Þ¤º¥¤¥Ù¥ó¥È¥­¥å¡¼¤Ë¤¿¤Þ¤Ã¤Æ¤¤¤ë¥¤¥Ù¥ó¥È¤Î¿ô¤òÄ´¤Ù¤Æ¡¢¥¤¥Ù¥ó¥È¤¬¤¢¤ë¤³¤È¤¬Ê¬¤«¤Ã¤¿»þÅÀ¤Ç XNextEvent() ¤ò¼Â¹Ô¤¹¤ë¤³¤È¤Ç¼Â¸½¤Ç¤­¤Þ¤¹¡£¥¤¥Ù¥ó¥È¥­¥å¡¼¤Ë¤¿¤Þ¤Ã¤Æ¤¤¤ë¥¤¥Ù¥ó¥È¤Î¿ô¤òÄ´¤Ù¤ë¤Ë¤Ï¡¢ XPending() ¤ò»È¤¤¤Þ¤¹¡£

int XPending( Display* display );

XPending() ¤Ï¡¢¥¤¥Ù¥ó¥È¥­¥å¡¼¤«¤é¼è¤ê¤À¤µ¤ì¤Æ¤¤¤Ê¤¤¥¤¥Ù¥ó¥È¤Î¿ô¤òÊÖ¤·¤Þ¤¹¡£¤³¤ì¤ò»È¤Ã¤Æ¥¤¥Ù¥ó¥È¥ë¡¼¥×¤ò°Ê²¼¤Î¤è¤¦¤Ë½ñ¤¯¤È¡¢¥¤¥Ù¥ó¥È¤¬Ìµ¤¤¾ì¹ç¤ËÊ̤νèÍý¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤·¤«¤·¤³¤³¤Ç¤Ï¤¢¤Þ¤ê»þ´Ö¤¬¤«¤«¤ë½èÍý¤Ï¹Ô¤ï¤Ê¤¤¤è¤¦¤Ë¤·¤Þ¤¹¡£¤Ç¤Ê¤±¤ì¤Ð¡¢¼¡¤Î¥¤¥Ù¥ó¥È¤¬È¯À¸¤·¤Æ¤â¤½¤ì¤ò½èÍý¤Ë¹Ô¤¯¤Î¤Ë»þ´Ö¤¬¤«¤«¤ë¤¿¤á¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤¬¸Ç¤Þ¤Ã¤¿¤è¤¦¤Ë¸«¤¨¤Æ¤·¤Þ¤¤¤Þ¤¹¡£

/* ¥¤¥Ù¥ó¥È¥ë¡¼¥× */
while( 1 ) {
  while ( XPending( dpy ) ) {
    XNextEvent( dpy, &event );
    /* Ä̾ï¤Î¥¤¥Ù¥ó¥È½èÍý */
  }

  /* ¥¤¥Ù¥ó¥È¤¬Ìµ¤¤¾ì¹ç¤Î½èÍý */
}

¡û ¥¤¥Ù¥ó¥È¹½Â¤ÂÎ

¥­¡¼²¡²¼¥¤¥Ù¥ó¥È¡¢¥Þ¥¦¥¹´ØÏ¢¤Î¥¤¥Ù¥ó¥È¤Ê¤É¡¢¥¤¥Ù¥ó¥È¤Ë¤Ï¿ô¼ïÎढ¤ê¤Þ¤¹¡£¤½¤·¤Æ¤½¤ì¤¾¤ì¤Î¥¤¥Ù¥ó¥È¤´¤È¤Ë¥¤¥Ù¥ó¥È¾ðÊó¤ò³ÊǼ¤¹¤ë¤¿¤á¤Î¹½Â¤ÂΤ¬ÍÑ°Õ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£³Æ¥¤¥Ù¥ó¥È¹½Â¤ÂÎ¤Ï <X11/Xlib.h> ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¤³¤Î¤è¤¦¤Ë¥¤¥Ù¥ó¥È¤´¤È¤Ë¹½Â¤ÂΤ¬°Û¤Ê¤ë¤È¡¢É¬Íפʥ¤¥Ù¥ó¥Èʬ¤Î¹½Â¤ÂÎÊÑ¿ô¤ò¥×¥í¥°¥é¥àÃæ¤ËÍÑ°Õ¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤È»×¤Ã¤Æ¤·¤Þ¤¤¤Þ¤¹¤¬¡¢Á´¤Æ¤Î¥¤¥Ù¥ó¥È¤ò°ì³ç¤·¤Æ°·¤¦¤¿¤á¤Ë XEvent ·¿¹½Â¤ÂΤ¬ÍÑ°Õ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£

typedef union _XEvent {
  int type; /* ¥¤¥Ù¥ó¥È¤Î¼ïÎà */

  /* °Ê¹ß¡¢Á´¤Æ¤Î¥¤¥Ù¥ó¥È¹½Â¤ÂΤòɽ¤¹ÊÑ¿ôÀë¸À¤¬Â³¤¯ */
} XEvent;

Á´¤Æ¤Î¥¤¥Ù¥ó¥È¹½Â¤ÂΤκǽé¤Î¥á¥ó¥Ð¤¬¥¤¥Ù¥ó¥È¤Î¼ïÎà( int type; )¤È¤Ê¤Ã¤Æ¤¤¤ë¤Î¤Ç¡¢¾å¤Î¤è¤¦¤Ë union ÄêµÁ¤¹¤ë¤³¤È¤Ç¡¢ XEvent ·¿ÊÑ¿ô¤Ë¥¤¥Ù¥ó¥È¾ðÊó¤òÆɤߤ³¤ó¤À¸å¤Ë type ¥á¥ó¥Ð¤òÄ´¤Ù¤ì¤Ð¡¢¼ÂºÝ¤ËÁ÷¤é¤ì¤ÆÍ褿¥¤¥Ù¥ó¥È¤Î¼ïÎबʬ¤«¤ê¤Þ¤¹¡£¤½¤Î¸å¤ÏɬÍפ˱þ¤¸¤Æ¥¤¥Ù¥ó¥ÈÊÑ¿ô¤ò¥­¥ã¥¹¥È¤·¤Æ»È¤¨¤ÐÎɤ¤¤È¤¤¤¦¤ï¤±¤Ç¤¹¡£

xev ¤È¤¤¤¦¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò¼Â¹Ô¤¹¤ë¤È¡¢É½¼¨¤µ¤ì¤¿¥¦¥£¥ó¥É¥¦¤ËÂФ·¤ÆȯÀ¸¤·¤¿¥¤¥Ù¥ó¥È¤ò¼õ¤±¼è¤ê¡¢Âбþ¤¹¤ë¥¤¥Ù¥ó¥È¹½Â¤ÂΤÎÆâÍƤò½ÐÎϤ¹¤ëÍͻҤò¸«¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£

¡û MappingNotify ¥¤¥Ù¥ó¥È

MappingNotify ¥¤¥Ù¥ó¥È¤ÏÄÌÃΤòµñÈݤǤ­¤Ê¤¤¥¤¥Ù¥ó¥È¤Î°ì¤Ä¤Ç¤¹¡£¤³¤Î¥¤¥Ù¥ó¥È¤Ï¡¢¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¡¼¥Ü¡¼¥É¥Þ¥Ã¥Ô¥ó¥°¤ä¥Ý¥¤¥ó¥¿¥Þ¥Ã¥Ô¥ó¥°¤¬Êѹ¹¤µ¤ì¤¿¾ì¹ç¤ËÄÌÃΤµ¤ì¤ë¥¤¥Ù¥ó¥È¤Ç¤¹¡£¤³¤Î¥¤¥Ù¥ó¥È¤ò¼õ¤±¼è¤Ã¤¿¾ì¹ç¤Ï¡¢XRefreshKeyboardMapping ¤ò¼Â¹Ô¤¹¤Ù¤­¤È¤µ¤ì¤Æ¤¤¤Þ¤¹¡£

XRefreshKeyboardMapping( XMappingEvent* event_map );

¤³¤ì¤Ë¤è¤ê¡¢Xlib Æâ¤Î¥­¡¼¥Ü¡¼¥É¤Ë´Ø¤¹¤ë¾ðÊ󤬹¹¿·¤µ¤ì¤Þ¤¹¡£