Example #1
0
/*
 * key up
 */
LOCAL void ieKeyUp( InnerEvent *evt, TMO *tmout )
{
	KeyEvt		keyEvt;
	UH		code;

        /* convert to character code */
	code = kpToKeycode(evt->i.key.keytop, &evt->i.key.meta);

        /* lock key needs no processing */
	if ( isMetaKey(code) ) goto skip;

        /* PD simulation processing */
	if ( kpExecPdSimKeyUp(evt, code, tmout) ) {
                /* process PD simulation only */
		goto skip;
	}

        /* notify key up event */
	keyEvt.h.evttyp = TDE_KEYUP;
	keyEvt.keytop = kpKeyTopCode(evt->i.key.keytop,
				evt->i.key.meta.o.kbsel);
	keyEvt.code = code;
	keyEvt.stat = evt->i.key.meta.o;
	kpNotifyEvent(&keyEvt, sizeof(keyEvt));

skip:
        /* switch temporary shift or simple lock modes */
	if ( kpChangeShiftLock(evt->type, NoShift) ) {

                /* notify meta key status change event */
		kpNotifyMetaEvent();
	}
}
Example #2
0
/*
 * check for key to enter PD simulation mode
 */
LOCAL PdSimMode isPdSimModeKey( InnerEvent *evt, UH code )
{
	static /*const*/ KpMetaBut meta = {{0}};	/* no shift status */

	if ( kpMgrInfo.kpState.stat.rsh == 0
	  || kpMgrInfo.kpState.stat.lsh == 0 ) return 0;

	if ( evt->i.key.keytop.u.tenkey != 0 ) {
		if ( isMainCC(code) ) return PdSim_TenKey;
		code = kpToKeycode(evt->i.key.keytop, &meta);
		if ( isMainCC(code) ) return PdSim_TenKey;
		return 0;
	}

	if ( isSubCC(code)
	  || code == KC_PG_U || code == KC_PG_D
	  || code == KC_PGUP || code == KC_PGDN
	  || code == KC_HOME || code == KC_END ) {
		return PdSim_MainBut;
	}

	if ( isMainCC(code) ) return PdSim_Std;

	return 0;
}
Example #3
0
/*
 * key down
 */
LOCAL void ieKeyDown( InnerEvent *evt, TMO *tmout )
{
	KeyEvt		keyEvt;
	UH		code;

        /* convert to character code */
	code = kpToKeycode(evt->i.key.keytop, &evt->i.key.meta);

        /* lock key processing */
	if ( lockKeyDown(code) ) {
                /* process only lock key and finish */
		return;
	}

        /* PD simulation processing */
	if ( kpExecPdSimKeyDown(evt, code, tmout) ) {
                /* process PD simulation only and finish */
		return;
	}

        /* notify key down event */
	keyEvt.h.evttyp = TDE_KEYDOWN;
	keyEvt.keytop = kpKeyTopCode(evt->i.key.keytop,
				evt->i.key.meta.o.kbsel);
	keyEvt.code = code;
	keyEvt.stat = evt->i.key.meta.o;
	kpNotifyEvent(&keyEvt, sizeof(keyEvt));
}
Example #4
0
/*
 * find out key type
 *     return InKeyKind if it is direct key input
 *       if it is shiftkey, then return ShiftKeyKind
 */
EXPORT W kpGetKeyKind( KeyTop keytop )
{
	UH			code;

        /* evaluate keycode obtained from the keymap corresponding to the current shift status. */
	code = kpToKeycode(keytop, (KpMetaBut*)&kpMgrInfo.kpState.stat);

	switch ( code ) {
          /* shift key */
	  case KC_SHT_R:	return SK_SHIFT_R;	/* shift right */
	  case KC_SHT_L:	return SK_SHIFT_L;	/* shift Left */
	  case KC_EXP:		return SK_EXPANSION;	/* expansion */
	  case KC_CMD:		return SK_COMMAND;	/* command */

          /* direct key input */
	  case KC_CC_U:		return IK_CC_U;		/* main CC */
	  case KC_CC_D:		return IK_CC_D;		/* main CC */
	  case KC_CC_R:		return IK_CC_R;		/* main CC */
	  case KC_CC_L:		return IK_CC_L;		/* main CC */
	}
	return NormalKey;
}