Ejemplo n.º 1
0
Status
_XkbReadGetIndicatorMapReply(	Display *			dpy,
				xkbGetIndicatorMapReply *	rep,
				XkbDescPtr			xkb,
				int	*			nread_rtrn)
{
XkbIndicatorPtr		leds;
XkbReadBufferRec	buf;

    if ((!xkb->indicators)&&(XkbAllocIndicatorMaps(xkb)!=Success))
	return BadAlloc;
    leds= xkb->indicators;

    leds->phys_indicators = rep->realIndicators;
    if (rep->length>0) {
	register int left;
	if (!_XkbInitReadBuffer(dpy,&buf,(int)rep->length*4))
	    return BadAlloc;
	if (nread_rtrn)
	    *nread_rtrn= (int)rep->length*4;
	if (rep->which) {
	    register int i,bit;
	    left= (int)rep->which;
	    for (i=0,bit=1;(i<XkbNumIndicators)&&(left);i++,bit<<=1) {
		if (left&bit) {
		    xkbIndicatorMapWireDesc *wire;
		    wire= (xkbIndicatorMapWireDesc *)
			  _XkbGetReadBufferPtr(&buf,
					SIZEOF(xkbIndicatorMapWireDesc));
		    if (wire==NULL) {
			_XkbFreeReadBuffer(&buf);
			return BadAlloc;
		    }
		    leds->maps[i].flags= wire->flags;
		    leds->maps[i].which_groups= wire->whichGroups;
		    leds->maps[i].groups= wire->groups;
		    leds->maps[i].which_mods= wire->whichMods;
		    leds->maps[i].mods.mask= wire->mods;
		    leds->maps[i].mods.real_mods= wire->realMods;
		    leds->maps[i].mods.vmods= wire->virtualMods;
		    leds->maps[i].ctrls= wire->ctrls;
		    left&= ~bit;
		}
	    }
	}
	left= _XkbFreeReadBuffer(&buf);
    }
    return Success;
}
Ejemplo n.º 2
0
static Status
XkbInitIndicatorMap(XkbSrvInfoPtr xkbi)
{
XkbDescPtr		xkb;
XkbIndicatorPtr		map;
XkbSrvLedInfoPtr	sli;

    xkb= xkbi->desc;
    if (XkbAllocIndicatorMaps(xkb)!=Success)
	return BadAlloc;

    if (!(xkb->defined & XkmIndicatorsMask)) {
        map= xkb->indicators;
        map->phys_indicators = PHYS_LEDS;
        map->maps[LED_CAPS-1].flags= XkbIM_NoExplicit;
        map->maps[LED_CAPS-1].which_mods= XkbIM_UseLocked;
        map->maps[LED_CAPS-1].mods.mask= LockMask;
        map->maps[LED_CAPS-1].mods.real_mods= LockMask;

        map->maps[LED_NUM-1].flags= XkbIM_NoExplicit;
        map->maps[LED_NUM-1].which_mods= XkbIM_UseLocked;
        map->maps[LED_NUM-1].mods.mask= 0;
        map->maps[LED_NUM-1].mods.real_mods= 0;
        map->maps[LED_NUM-1].mods.vmods= vmod_NumLockMask;

        map->maps[LED_SCROLL-1].flags= XkbIM_NoExplicit;
        map->maps[LED_SCROLL-1].which_mods= XkbIM_UseLocked;
        map->maps[LED_SCROLL-1].mods.mask= Mod3Mask;
        map->maps[LED_SCROLL-1].mods.real_mods= Mod3Mask;
    }

    sli= XkbFindSrvLedInfo(xkbi->device,XkbDfltXIClass,XkbDfltXIId,0);
    if (sli)
	XkbCheckIndicatorMaps(xkbi->device,sli,XkbAllIndicatorsMask);

    return Success;
}