private void registerKeyPressedEvent(KeyPressedEvent e, MapDef m) {

        if (e.getID() == KeyPressedEvent.KEY_RELEASED) {
            keysCurrentlyDown.remove(e.getCharCode());
            if ((option.isCapsSendsUpAndDownNotEnabled())
                   ) {
                //logger.debug("Turning CAPSLOCK off - key release");
                capsLockDown = false;
            }
            lastEventMatched = false;
        }

        if (e.getID() == KeyPressedEvent.KEY_PRESSED) {
            lastKeyPressedEvent = e;
            if (m != null)
                lastEventMatched = true;
            else
                lastEventMatched = false;
            if ((option.isCapsSendsUpAndDownEnabled())
                    ) {
                //logger.debug("Toggling CAPSLOCK");
                capsLockDown = !capsLockDown;
            } /*else if (e.getCharCode() == KeyPressedEvent.VK_CAPS_LOCK) {
                //logger.debug("Turning CAPSLOCK on - key press");
                capsLockDown = true;
            }*/            
            
        }

        if (lastKeyPressedEvent != null
                && m != null
                && !keysCurrentlyDown.containsKey(lastKeyPressedEvent
                        .getCharCode())) {
            keysCurrentlyDown.put(lastKeyPressedEvent.getCharCode(), m);
            lastKeyPressedEvent = null;
        }

    }