LECTURE 7 Expose ¥¤¥Ù¥ó¥È

¡û ¤Ï¤¸¤á¤Ë

LECTURE 5 ¥°¥é¥Õ¥£¥Ã¥¯¥¹¤ÎÉÁ²è¤Ç¤Ï¡¢Expose ¥¤¥Ù¥ó¥È¤È¤¤¤¦¥¤¥Ù¥ó¥È¤ËÂбþ¤·¤¿½èÍý¤È¤·¤Æ¥°¥é¥Õ¥£¥Ã¥¯¥¹¤ÎÉÁ²è¤ò¹Ô¤¤¤Þ¤·¤¿¡£Expose ¥¤¥Ù¥ó¥È¤È¤Ï¡¢´Êñ¤Ë¤¤¤¦¤È¥¦¥£¥ó¥É¥¦¤Î±£¤ì¤Æ¤¤¤¿Éôʬ¤¬É½¤Ë½Ð¤¿»þ¤ËÀ¸¤¸¤ë¥¤¥Ù¥ó¥È¤Ç¤¹¡£ºÇ½é¤Ë¥¦¥£¥ó¥É¥¦¤¬É½¼¨¤µ¤ì¤ëºÝ¤Ë¤âÄÌÃΤµ¤ì¤ë¤·¡¢Â¾¤Î¥¦¥£¥ó¥É¥¦¤Î²¼¤Ë¤¢¤Ã¤¿¥¦¥£¥ó¥É¥¦¤¬¾å¤Ë¤Ê¤Ã¤¿»þ¤Ë¤âÄÌÃΤµ¤ì¤Þ¤¹¡£¥¦¥£¥ó¥É¥¦¤Ë¤È¤Ã¤Æ¤Ï°ìÈÖ½ÅÍפʥ¤¥Ù¥ó¥È¤È¸À¤¨¤ë¤Ç¤·¤ç¤¦¡£

¤³¤³¤Ç¤Ï Expose ¥¤¥Ù¥ó¥È¤Î¾ÜºÙ¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤¤¤­¤Þ¤¹¡£

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

¤¢¤ë¥¦¥£¥ó¥É¥¦¤Î±£¤ì¤Æ¤¤¤¿Éôʬ¤¬É½¤Ëɽ¼¨¤µ¤ì¤¿¾ì¹ç¡¢Expose ¤µ¤ì¤¿¤È¤¤¤¤¤Þ¤¹¡£ Expose ¤µ¤ì¤¿¾ì¹ç¤Ë¤Ï Expose ¥¤¥Ù¥ó¥È¤¬ X ¥µ¡¼¥Ð¤«¤éÄÌÃΤµ¤ì¤ë¤Î¤Ç¡¢¤½¤Î¥¤¥Ù¥ó¥È¤ËÂбþ¤·¤¿½èÍý¤È¤·¤Æ¿·¤¿¤Ëɽ¼¨¤µ¤ì¤¿Éôʬ¤òÉÁ²è¤·¤Ê¤±¤ì¤Ð¤¤¤±¤Þ¤»¤ó(Îã³°¤Ï¤¢¤ê¤Þ¤¹¤¬¡¢¤¤¤º¤ì)¡£Expose ¥¤¥Ù¥ó¥È»þ¤ÎÉÁ²è½èÍý¤òÉÁ¤«¤Ê¤«¤Ã¤¿¾ì¹ç¤Ï¡¢X ¥µ¡¼¥Ð¤¬¥¦¥£¥ó¥É¥¦¤Î¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¥«¥é¡¼¤ÇÅɤê¤Ä¤Ö¤·¤Þ¤¹¡£

Expose ¥¤¥Ù¥ó¥È¤¬È¯À¸¤¹¤ë¤Î¤Ï

  • ¥¦¥£¥ó¥É¥¦¤¬¥Þ¥Ã¥×¤µ¤ì¤¿¤È¤­
  • ¥¦¥£¥ó¥É¥¦¤Î±£¤ì¤Æ¤¤¤¿Éôʬ¤¬É½¤Ë½Ð¤¿¤È¤­
  • ¥¦¥£¥ó¥É¥¦¤ÎÆâÍƤò¥¯¥ê¥¢¤·¤¿¤È¤­

¤Ç¤¹¡£LECTURE 5 ¤Ç Expose ¥¤¥Ù¥ó¥È¤ËÂФ¹¤ë½èÍý¤È¤·¤ÆÉÁ²è¤ò¹Ô¤Ã¤¿Íýͳ¤Ç¤¹¤¬¡¢¥¦¥£¥ó¥É¥¦¤ò½é¤á¤Æ¥Þ¥Ã¥×¤¹¤ë¾ì¹ç¡¢¥Þ¥Ã¥×¤µ¤ì¤ëÁ°¤Ë¥¦¥£¥ó¥É¥¦¤ËÉÁ²è¤·¤Æ¤â²èÌ̤ˤϲ¿¤âɽ¼¨¤µ¤ì¤Þ¤»¤ó¡£¤è¤Ã¤Æ¡¢¥Þ¥Ã¥×¤µ¤ì¤Æ²èÌ̤Ëɽ¼¨¤µ¤ì¤¿¤³¤È¤òɽ¤¹ Expose ¥¤¥Ù¥ó¥È¤ò¼õ¤±¼è¤Ã¤Æ¤«¤é¥°¥é¥Õ¥£¥Ã¥¯¥¹¤òÉÁ²è¤¹¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤ë¤Î¤Ç¤¹¡£

Expose ¥¤¥Ù¥ó¥È¤ò¼õ¤±¼è¤Ã¤¿¤é¡¢¥¯¥é¥¤¥¢¥ó¥È¤Ï Expose ¤µ¤ì¤¿Îΰè¤òÄ´¤Ù¤ÆºÆÉÁ²è¤·¤Þ¤¹¡£Expose ¤µ¤ì¤¿Îΰè¤Ë°ÊÁ°ÉÁ²è¤µ¤ì¤Æ¤¤¤¿ÆâÍƤϼº¤ï¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢ºÆÉÁ²è¤¹¤ë¤¿¤á¤Î¾ðÊó¤Ï¥¯¥é¥¤¥¢¥ó¥È¦¤ÇÊݸ¤·¤Æ¤ª¤«¤Ê¤±¤ì¤Ð¤¤¤±¤Þ¤»¤ó¡£

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

Expose ¥¤¥Ù¥ó¥È¾ðÊó¤ò³ÊǼ¤¹¤ë¤¿¤á¤Î Expose ¥¤¥Ù¥ó¥È¹½Â¤ÂΤϼ¡¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£

typedef struct
{
  int           type;          /* ¥¤¥Ù¥ó¥È¤Î¼ïÎà */
  unsigned long serial;        /* ¥µ¡¼¥Ð¤¬½èÍý¤·¤¿ºÇ¸å¤Î¥ê¥¯¥¨¥¹¥ÈÈÖ¹æ */
  Bool          send_event;    /* ¥¯¥é¥¤¥¢¥ó¥È¤«¤éÁ÷¤é¤ì¤¿¥¤¥Ù¥ó¥È¤Ê¤éTrue */
  Display*      display;       /* ¥¤¥Ù¥ó¥È¤¬Æɤ߹þ¤Þ¤ì¤¿display */
  Window        window;        /* ¥¤¥Ù¥ó¥È¤¬µ¯¤³¤Ã¤¿ window¤ÎID */
  int           x, y;          /* Expose¤µ¤ì¤¿Îΰè¤Îº¸¾å¤ÎºÂɸ */
  int           width, height; /* Expose¤µ¤ì¤¿Îΰè¤ÎÉý¤È¹â¤µ */
  int           count;         /* ¸å¤¤¤¯¤ÄExpose¥¤¥Ù¥ó¥È¤¬Íè¤ë¤« */
} XExposeEvent;

ºÇ½é¤Î type ¤Ï¥¤¥Ù¥ó¥È¤Î¼ïÎà¤òɽ¤·¤Æ¤ª¤ê¡¢Expose ¥¤¥Ù¥ó¥È¤Î¾ì¹ç¤Ë¤Ï Äê¿ô Expose ¤¬Æþ¤ê¤Þ¤¹¡£x¡¢y¡¢width¡¢height ¤Ë¤è¤Ã¤Æ Expose¤µ¤ì¤¿Ä¹Êý·ÁÎΰ褬ɽ¤µ¤ì¤Þ¤¹¡£Expose ¥¤¥Ù¥ó¥È¤ÏÊ£¿ô¸ÄƱ»þ¤ËÁ÷¤é¤ì¤ÆÍè¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¤¬¡¢Ëè²óºÆÉÁ²è¤·¤Æ¤¤¤Æ¤Ï̵ÂÌ¤Ê¤Î¤Ç count ¤¬ 0 ¤Î¾ì¹ç(°ìÏ¢¤Î Expose ¥¤¥Ù¥ó¥È¤ÎºÇ¸å)¤òÂԤäÆÉÁ²è¤¹¤ë¤Î¤¬ÉáÄ̤Ǥ¹¡£

serial¤Ë¤Ï¡¢¥¯¥é¥¤¥¢¥ó¥È¤¬ X ¥µ¡¼¥Ð¤ËÁ÷¤Ã¤¿¥ê¥¯¥¨¥¹¥È¤ÎÄ̤·Èֹ椬Æþ¤ê¤Þ¤¹¡£send_event ¤Ï¤³¤Î¥¤¥Ù¥ó¥È¤¬ X ¥µ¡¼¥Ð¤«¤é¤Ç¤Ï¤Ê¤¯Â¾¤Î¥¯¥é¥¤¥¢¥ó¥È¤«¤é XSendEvent() ¤ò»È¤Ã¤ÆÁ÷¤é¤ì¤¿¤³¤È¤ò¼¨¤¹¥Õ¥é¥°¤Ç¤¹¡£

Status XSendEvent( Display* display,
                   Window   w, 
                   Bool     propagate, 
                   long     event_mask, 
                   XEvent*  evt );

¡û ¥¯¥ê¥Ã¥Ô¥ó¥°

ÉÁ²è¤È¤¤¤¦½èÍý¤Ë¤Ï»þ´Ö¤¬¤«¤«¤ë¤Î¤Ç¡¢¤Ê¤ë¤Ù¤¯ÌµÂ̤ÊÉÁ²è¤ò¾Ê¤¯¤è¤¦¤Ë¤·¤Ê¤¤¤È¤¤¤±¤Þ¤»¤ó¡£ÉÁ²è¤¹¤ëÎΰè¤ò»ØÄꤷ¤Æ¤½¤ÎÎΰè¤À¤±¤òÉÁ²è¤¹¤ë¤¿¤á¤Ë¥¯¥ê¥Ã¥Ô¥ó¥°(ÀÚ¤êÈ´¤­)¤È¤¤¤¦½èÍý¤ò¹Ô¤¦¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£¥¯¥ê¥Ã¥Ô¥ó¥°¤Ï GC ¤Î°À­¤Ç¤¢¤ë¥¯¥ê¥Ã¥×¥Þ¥¹¥¯¤òÍѤ¤¤Æ¹Ô¤¤¤Þ¤¹¡£

GC ¤Ë¤Ï clip_mask ¤È¤¤¤¦¥á¥ó¥Ð¤¬¤¢¤ê¤Þ¤¹¡£¤³¤³¤Ë¤Ï¥Ô¥¯¥¹¥Þ¥Ã¥×¤òÀßÄꤹ¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤³¤Î¥Ô¥¯¥¹¥Þ¥Ã¥×¤òÀßÄꤷ¤¿ GC ¤ÇÉÁ²è¤ò¹Ô¤¦¤È¡¢¥Ô¥¯¥¹¥Þ¥Ã¥×Ãæ¤Î 0 ¤ËÂбþ¤¹¤ë Drawable ¤Î°ÌÃ֤ˤϲ¿¤âÉÁ²è¤µ¤ì¤Þ¤»¤ó¡£¤³¤Î¤è¤¦¤ÊƯ¤­¤ò¤¹¤ë¥Ô¥¯¥¹¥Þ¥Ã¥×¤ò¥¯¥ê¥Ã¥×¥Þ¥¹¥¯¤È¸Æ¤Ó¤Þ¤¹¡£

¥¯¥ê¥Ã¥×¥Þ¥¹¥¯¤ÎÀßÄê¤Ë¤Ï XSetClipMask() ¤ò»È¤¤¤Þ¤¹¡£

XSetClipMask( Display* display, GC gc, Pixmap clip_mask );

clip_mask : ¥¯¥ê¥Ã¥×¥Þ¥¹¥¯

¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¥¯¥ê¥Ã¥×¥Þ¥¹¥¯¤Îº¸¾å¤ÎºÂɸ¤¬ÉÁ²èÂоݤΠDrawable ¤Î¸¶ÅÀ¤Ë°ìÃפ·¤Þ¤¹¡£Drawable ¤ËÂФ¹¤ë¥¯¥ê¥Ã¥×¥Þ¥¹¥¯¤Î¸¶ÅÀ°ÌÃÖ¤òÊѤ¨¤¿¤¤¾ì¹ç¤Ï XSetClipOrigin() ¤ò»È¤¤¤Þ¤¹¡£

XSetClipOrigin( Display* display, GC gc, int clip_x_origin, int clip_y_origin );

clip_x_origin : ¢­
clip_y_origin : Drawable ¤ËÂФ¹¤ë¡¢¥¯¥ê¥Ã¥×¥Þ¥¹¥¯¤Î¸¶ÅÀ°ÌÃÖºÂɸ¡£(0, 0)¤È¤¹¤ë¤È
                Drawable ¤Î¸¶ÅÀ¤È°ìÃ×

¥¯¥ê¥Ã¥Ô¥ó¥°¤ò¤¹¤ë¾ì¹ç¤Î Expose ¥¤¥Ù¥ó¥È»þ¤Î½èÍý¤Ï¼¡¤Î¤è¤¦¤Ë½ñ¤±¤Þ¤¹¡£

  1. Expose ¥¤¥Ù¥ó¥È¤ò¼õ¤±¼è¤ë
  2. Expose ¤µ¤ì¤¿Îΰè¤ËÂбþ¤¹¤ë¥¯¥ê¥Ã¥×¥Þ¥¹¥¯¤òºî¤ë
  3. ¥¯¥ê¥Ã¥×¥Þ¥¹¥¯¤ò GC ¤Ë¥»¥Ã¥È¤¹¤ë
  4. ¤½¤Î GC ¤òÍѤ¤¤ÆºÆÉÁ²è¤¹¤ë

Expose ¥¤¥Ù¥ó¥È¤ÇÁ÷¤é¤ì¤ÆÍè¤ëÎΰè¤ÏÁ´¤ÆĹÊý·Á¤Ê¤Î¤Ç¡¢XSetClipRectangles() ¤ò»È¤Ã¤Æ´Êñ¤Ë¥¯¥ê¥Ã¥×¥Þ¥¹¥¯¤òºîÀ®¤Ç¤­¤Þ¤¹¡£

XSetClipRectangels( Display*    display, 
                    GC          gc, 
                    int         clip_x_origin, 
                    int         clip_y_origin,
                    XRectangle* rectangles, 
                    int         n, 
                    int         ordering 
                  );

clip_x_origin : ¢­
clip_y_origin : ¥¯¥ê¥Ã¥×¥Þ¥¹¥¯¤Î¸¶ÅÀ°ÌÃÖºÂɸ
rectangles;   : ĹÊý·Á¤ÎÇÛÎó
n             : ĹÊý·Á¤Î¸Ä¿ô
ordering      : ĹÊý·Á¤Î½ç½ø´Ø·¸

Ê£¿ô¤ÎϢ³¤·¤¿ Expose ¥¤¥Ù¥ó¥È¤¬Á÷¤é¤ì¤ÆÍ褿¾ì¹ç¤Ë¡¢³Æ Expose ¥¤¥Ù¥ó¥È¤ÎĹÊý·ÁÎΰè¤ò rectangles(¤ª¤è¤Ó n) ¤Ë»ØÄꤷ¤Æ¼Â¹Ô¤¹¤ë¤È¡¢¤½¤ÎĹÊý·ÁÎΰè¤òÏÀÍýϤ·¤¿Îΰ褬¥¯¥ê¥Ã¥×¥Þ¥¹¥¯¤È¤·¤Æ gc ¤ËÀßÄꤵ¤ì¤Þ¤¹¡£

ordering ¤Ë¤Ï rectangles ¤Î½ç½ø´Ø·¸¤òÀßÄꤷ¤Þ¤¹¡£¼¡¤Î 4 ¤Ä¤Î¤¤¤º¤ì¤«¤ò»ØÄꤷ¤Þ¤¹¡£

Äê¿ô̾ ÀâÌÀ
Unsorted Æä˽ç½ø´Ø·¸¤Ï¤Ê¤¤(ʬ¤«¤é¤Ê¤¤¾ì¹ç¤Ï¤³¤ì¤ò»È¤¦)
YSorted ¸Ä¡¹¤ÎĹÊý·Á¤Î¸¶ÅÀ¤ÎyºÂɸ¤¬¾º½ç¤Ç¤¢¤ë
YXSorted YSorted¤ÇyºÂɸ¤¬Æ±¤¸Ä¹Êý·Á¤Î¸¶ÅÀ¤ÎxºÂɸ¤¬¾º½ç¤Ç¤¢¤ë
YXBounded YXSorted¤ÇƱ¤¸yºÂɸ¤È¹â¤µ¤ò»ý¤Ä