Пример #1
0
/*----------------------------------------------------------------------*/

# ifdef KEYSYM_RESOURCE
/*
 * Define key from XrmEnumerateDatabase.
 *   quarks will be something like
 *      "rxvt" "keysym" "0xFF01"
 *   value will be a string
 */
/* ARGSUSED */
/* INTPROTO */
Bool
rxvt_define_key(XrmDatabase *database __attribute__((unused)), XrmBindingList bindings __attribute__((unused)), XrmQuarkList quarks, XrmRepresentation *type __attribute__((unused)), XrmValue *value, XPointer closure __attribute__((unused)))
{
    int             last;
    rxvt_t         *r = rxvt_get_r();

    for (last = 0; quarks[last] != NULLQUARK; last++)	/* look for last quark in list */
	;
    last--;
    rxvt_parse_keysym(r, XrmQuarkToString(quarks[last]), (char *)value->addr);
    return False;
}

/*
 * look for something like this (XK_Delete)
 * rxvt*keysym.0xFFFF: "\177"
 *
 * arg will be
 *      NULL for ~/.Xdefaults and
 *      non-NULL for command-line options (need to allocate)
Пример #2
0
/* EXTPROTO */
int
ThaiUpdateMap(text_t *stp, text_t *dtp, rend_t *srp, rend_t *drp, char *map, int len)
{
	rxvt_t*		r = rxvt_get_r ();
	int	stp_col=0, dtp_col=0;    /* index */
	int stp_lev=0, dtp_lev=0;    /* # of characters at the column */
	int i=0,match=0;             /* matching flag */
	int lastbold=0;              /* BOLD_OVERSTRIKE feature */
	int nupdate;                 /* # chars to update */

	nupdate = len;
	/* update by default */
	for (i=0;i<len;i++) map[i]=1;

	/* Bug Fixed: 12/27/2000  */
	/* sync the first column for both stp and dtp */
	for (stp_col=0; stp_col < len && thai_map[(unsigned char)stp[stp_col]]!=0; stp_col++);
	for (dtp_col=0; dtp_col < len && thai_map[(unsigned char)dtp[dtp_col]]!=0; dtp_col++);

	while (stp_col < len && dtp_col < len){

		/* check if identical column */
		match = 0;
  	  	if (stp_lev==dtp_lev){
	        for (i=0;
				i < stp_lev &&
				/* same chars */
				stp[stp_col+i]==dtp[dtp_col+i]  && 
				/* either same ATTR*/
				(srp[stp_col+i]==drp[dtp_col+i] ||
				 /* or space with same background */
                 ((stp[stp_col+i]==' ') &&
				  (GET_BGATTR(srp[stp_col+i]) == 
				   GET_BGATTR(drp[dtp_col+i]))));
				i++)
				;


			/* set matching flag */
	        if (i==stp_lev) match = 1;
	    }

	    /* if match don't update */
	   	 if (match){
			/*
			 * previous Bold character can leave excess dot on screen
             * so we must update char to clean up the mess
             */
			if (!lastbold)
	    	    for (i=0;i < stp_lev; i++){
  		          	map[stp_col+i] = 0;
					nupdate--;
				}

			lastbold = 0;
   	     }
		 else    /* set bold flag */
			lastbold = MONO_BOLD(srp[stp_col]);

        stp_col += stp_lev;
        dtp_col += dtp_lev;

		/* go to next Thai column and also fing # of levels too */
		for (stp_lev=1;
			thai_map[(unsigned char)stp[stp_col+stp_lev]]!=0 &&
			(stp_col+stp_lev)<len;
			stp_lev++)
			;

	    for (dtp_lev=1;
			thai_map[(unsigned char)dtp[dtp_col+dtp_lev]]!=0 &&
			(dtp_col+dtp_lev)<len;
			dtp_lev++)
			;

	}

	/* in drawn_text buffer is full, won't update */
	while (stp_col < dtp_col) {
		/*
		 * Bug fixed: only skip update only its a blankspace.
		 * (12/27/2000)
		 */
		if (stp[stp_col] == ' '){
			map[stp_col]=0;
			nupdate--;
		}
		stp_col++;
	}

	return nupdate;
}