wm.c
// identify modifiers in a key combination string
identify modifiers in a key combination string
identify modifiers in a key combination string
unsigned int parse_key_mask(char *keystr, unsigned int def)
{
	unsigned int modkey = 0;
	if (keystr)
	{
		if (strcasestr(keystr, "shift"))   modkey |= ShiftMask;
		if (strcasestr(keystr, "control")) modkey |= ControlMask;
		if (strcasestr(keystr, "mod1"))    modkey |= Mod1Mask;
		if (strcasestr(keystr, "mod2"))    modkey |= Mod2Mask;
		if (strcasestr(keystr, "mod3"))    modkey |= Mod3Mask;
		if (strcasestr(keystr, "mod4"))    modkey |= Mod4Mask;
		if (strcasestr(keystr, "mod5"))    modkey |= Mod5Mask;
	}
	if (!(modkey & (ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)))
		modkey |= def;
	return modkey;
}
unsigned int parse_key_mask ( char * keystr , unsigned int def ) { unsigned int modkey = 0 ; if ( keystr ) { if ( strcasestr ( keystr , " " ) ) modkey |= ShiftMask ; if ( strcasestr ( keystr , " " ) ) modkey |= ControlMask ; if ( strcasestr ( keystr , " " ) ) modkey |= Mod1Mask ; if ( strcasestr ( keystr , " " ) ) modkey |= Mod2Mask ; if ( strcasestr ( keystr , " " ) ) modkey |= Mod3Mask ; if ( strcasestr ( keystr , " " ) ) modkey |= Mod4Mask ; if ( strcasestr ( keystr , " " ) ) modkey |= Mod5Mask ; } if ( ! ( modkey & ( ControlMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask ) ) ) modkey |= def ; return modkey ; }
identify modifiers in a key combination string
identify modifiers in a key combination string