예제 #1
0
파일: inputCore.py 프로젝트: lpintes/NVDA
	def executeGesture(self, gesture):
		"""Perform the action associated with a gesture.
		@param gesture: The gesture to execute.
		@type gesture: L{InputGesture}
		@raise NoInputGestureAction: If there is no action to perform.
		"""
		if watchdog.isAttemptingRecovery:
			# The core is dead, so don't try to perform an action.
			# This lets gestures pass through unhindered where possible,
			# as well as stopping a flood of actions when the core revives.
			raise NoInputGestureAction

		script = gesture.script
		focus = api.getFocusObject()
		if focus.sleepMode is focus.SLEEP_FULL or (focus.sleepMode and not getattr(script, 'allowInSleepMode', False)):
			raise NoInputGestureAction

		wasInSayAll=False
		if gesture.isModifier:
			if not self.lastModifierWasInSayAll:
				wasInSayAll=self.lastModifierWasInSayAll=sayAllHandler.isRunning()
		elif self.lastModifierWasInSayAll:
			wasInSayAll=True
			self.lastModifierWasInSayAll=False
		else:
			wasInSayAll=sayAllHandler.isRunning()
		if wasInSayAll:
			gesture.wasInSayAll=True

		speechEffect = gesture.speechEffectWhenExecuted
		if speechEffect == gesture.SPEECHEFFECT_CANCEL:
			queueHandler.queueFunction(queueHandler.eventQueue, speech.cancelSpeech)
		elif speechEffect in (gesture.SPEECHEFFECT_PAUSE, gesture.SPEECHEFFECT_RESUME):
			queueHandler.queueFunction(queueHandler.eventQueue, speech.pauseSpeech, speechEffect == gesture.SPEECHEFFECT_PAUSE)

		if log.isEnabledFor(log.IO) and not gesture.isModifier:
			log.io("Input: %s" % gesture.logIdentifier)

		if self._captureFunc:
			try:
				if self._captureFunc(gesture) is False:
					return
			except:
				log.error("Error in capture function, disabling", exc_info=True)
				self._captureFunc = None

		if gesture.isModifier:
			raise NoInputGestureAction

		if config.conf["keyboard"]["speakCommandKeys"] and gesture.shouldReportAsCommand:
			queueHandler.queueFunction(queueHandler.eventQueue, speech.speakMessage, gesture.displayName)

		gesture.reportExtra()

		if script:
			scriptHandler.queueScript(script, gesture)
			return

		raise NoInputGestureAction
예제 #2
0
    def executeGesture(self, gesture):
        """Perform the action associated with a gesture.
		@param gesture: The gesture to execute.
		@type gesture: L{InputGesture}
		@raise NoInputGestureAction: If there is no action to perform.
		"""
        if watchdog.isAttemptingRecovery:
            # The core is dead, so don't try to perform an action.
            # This lets gestures pass through unhindered where possible,
            # as well as stopping a flood of actions when the core revives.
            raise NoInputGestureAction

        script = gesture.script
        focus = api.getFocusObject()
        if focus.sleepMode is focus.SLEEP_FULL or (
                focus.sleepMode
                and not getattr(script, 'allowInSleepMode', False)):
            raise NoInputGestureAction

        speechEffect = gesture.speechEffectWhenExecuted
        if speechEffect == gesture.SPEECHEFFECT_CANCEL:
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       speech.cancelSpeech)
        elif speechEffect in (gesture.SPEECHEFFECT_PAUSE,
                              gesture.SPEECHEFFECT_RESUME):
            queueHandler.queueFunction(
                queueHandler.eventQueue, speech.pauseSpeech,
                speechEffect == gesture.SPEECHEFFECT_PAUSE)

        if log.isEnabledFor(log.IO) and not gesture.isModifier:
            log.io("Input: %s" % gesture.logIdentifier)

        if self.isInputHelpActive:
            bypass = getattr(script, "bypassInputHelp", False)
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       self._handleInputHelp,
                                       gesture,
                                       onlyLog=bypass)
            if not bypass:
                return

        if gesture.isModifier:
            raise NoInputGestureAction

        if config.conf["keyboard"][
                "speakCommandKeys"] and gesture.shouldReportAsCommand:
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       speech.speakMessage,
                                       gesture.displayName)

        gesture.reportExtra()

        if script:
            scriptHandler.queueScript(script, gesture)
            return

        raise NoInputGestureAction
예제 #3
0
파일: inputCore.py 프로젝트: daisymax/nvda
    def executeGesture(self, gesture):
        """Perform the action associated with a gesture.
		@param gesture: The gesture to execute.
		@type gesture: L{InputGesture}
		@raise NoInputGestureAction: If there is no action to perform.
		"""
        if watchdog.isAttemptingRecovery:
            # The core is dead, so don't try to perform an action.
            # This lets gestures pass through unhindered where possible,
            # as well as stopping a flood of actions when the core revives.
            raise NoInputGestureAction

        script = gesture.script
        focus = api.getFocusObject()
        if focus.sleepMode is focus.SLEEP_FULL or (focus.sleepMode and not getattr(script, "allowInSleepMode", False)):
            raise NoInputGestureAction

        speechEffect = gesture.speechEffectWhenExecuted
        if speechEffect == gesture.SPEECHEFFECT_CANCEL:
            queueHandler.queueFunction(queueHandler.eventQueue, speech.cancelSpeech)
        elif speechEffect in (gesture.SPEECHEFFECT_PAUSE, gesture.SPEECHEFFECT_RESUME):
            queueHandler.queueFunction(
                queueHandler.eventQueue, speech.pauseSpeech, speechEffect == gesture.SPEECHEFFECT_PAUSE
            )

        if log.isEnabledFor(log.IO) and not gesture.isModifier:
            log.io("Input: %s" % gesture.logIdentifier)

        if self.isInputHelpActive:
            bypass = getattr(script, "bypassInputHelp", False)
            queueHandler.queueFunction(queueHandler.eventQueue, self._handleInputHelp, gesture, onlyLog=bypass)
            if not bypass:
                return

        if gesture.isModifier:
            raise NoInputGestureAction

        if config.conf["keyboard"]["speakCommandKeys"] and gesture.shouldReportAsCommand:
            queueHandler.queueFunction(queueHandler.eventQueue, speech.speakMessage, gesture.displayName)

        gesture.reportExtra()

        if script:
            scriptHandler.queueScript(script, gesture)
            return

        raise NoInputGestureAction
예제 #4
0
def executeGesture(self, gesture):
    """Perform the action associated with a gesture.
		@param gesture: The gesture to execute.
		@type gesture: L{InputGesture}
		@raise NoInputGestureAction: If there is no action to perform.
		"""
    if watchdog.isAttemptingRecovery:
        # The core is dead, so don't try to perform an action.
        # This lets gestures pass through unhindered where possible,
        # as well as stopping a flood of actions when the core revives.
        raise NoInputGestureAction

    script = gesture.script
    if "brailleDisplayDrivers" in str(type(gesture)):
        if instanceGP.brailleKeyboardLocked and (
            (hasattr(script, "__func__") and
             script.__func__.__name__ != "script_toggleLockBrailleKeyboard")
                or not hasattr(script, "__func__")):
            return
        if not config.conf["brailleExtender"][
                'stopSpeechUnknown'] and gesture.script == None:
            stopSpeech = False
        elif hasattr(script, "__func__") and (script.__func__.__name__ in [
                "script_braille_dots", "script_braille_enter",
                "script_volumePlus", "script_volumeMinus",
                "script_toggleVolume", "script_hourDate", "script_ctrl",
                "script_alt", "script_nvda", "script_win", "script_ctrlAlt",
                "script_ctrlAltWin", "script_ctrlAltWinShift",
                "script_ctrlAltShift", "script_ctrlWin", "script_ctrlWinShift",
                "script_ctrlShift", "script_altWin", "script_altWinShift",
                "script_altShift", "script_winShift"
        ] or (not config.conf["brailleExtender"]['stopSpeechScroll']
              and script.__func__.__name__ in
              ["script_braille_scrollBack", "script_braille_scrollForward"])):
            stopSpeech = False
        else:
            stopSpeech = True
    else:
        stopSpeech = True

    focus = api.getFocusObject()
    if focus.sleepMode is focus.SLEEP_FULL or (focus.sleepMode and not getattr(
            script, 'allowInSleepMode', False)):
        raise NoInputGestureAction

    wasInSayAll = False
    if gesture.isModifier:
        if not self.lastModifierWasInSayAll:
            wasInSayAll = self.lastModifierWasInSayAll = sayAllHandler.isRunning(
            )
    elif self.lastModifierWasInSayAll:
        wasInSayAll = True
        self.lastModifierWasInSayAll = False
    else:
        wasInSayAll = sayAllHandler.isRunning()
    if wasInSayAll:
        gesture.wasInSayAll = True

    speechEffect = gesture.speechEffectWhenExecuted
    if not stopSpeech: pass
    elif speechEffect == gesture.SPEECHEFFECT_CANCEL:
        queueHandler.queueFunction(queueHandler.eventQueue,
                                   speech.cancelSpeech)
    elif speechEffect in (gesture.SPEECHEFFECT_PAUSE,
                          gesture.SPEECHEFFECT_RESUME):
        queueHandler.queueFunction(queueHandler.eventQueue, speech.pauseSpeech,
                                   speechEffect == gesture.SPEECHEFFECT_PAUSE)

    if log.isEnabledFor(log.IO) and not gesture.isModifier:
        self._lastInputTime = time.time()
        log.io("Input: %s" % gesture.identifiers[0])

    if self._captureFunc:
        try:
            if self._captureFunc(gesture) is False:
                return
        except BaseException:
            log.error("Error in capture function, disabling", exc_info=True)
            self._captureFunc = None

    if gesture.isModifier:
        raise NoInputGestureAction

    if config.conf["keyboard"][
            "speakCommandKeys"] and gesture.shouldReportAsCommand:
        queueHandler.queueFunction(queueHandler.eventQueue,
                                   speech.speakMessage, gesture.displayName)

    gesture.reportExtra()

    # #2953: if an intercepted command Script (script that sends a gesture) is queued
    # then queue all following gestures (that don't have a script) with a fake script so that they remain in order.
    if not script and scriptHandler._numIncompleteInterceptedCommandScripts:
        script = lambda gesture: gesture.send()

    if script:
        scriptHandler.queueScript(script, gesture)
        return

    raise NoInputGestureAction
예제 #5
0
    def executeGesture(self, gesture):
        """Perform the action associated with a gesture.
		@param gesture: The gesture to execute.
		@type gesture: L{InputGesture}
		@raise NoInputGestureAction: If there is no action to perform.
		"""
        if watchdog.isAttemptingRecovery:
            # The core is dead, so don't try to perform an action.
            # This lets gestures pass through unhindered where possible,
            # as well as stopping a flood of actions when the core revives.
            raise NoInputGestureAction

        script = gesture.script
        focus = api.getFocusObject()
        if focus.sleepMode is focus.SLEEP_FULL or (
                focus.sleepMode
                and not getattr(script, 'allowInSleepMode', False)):
            raise NoInputGestureAction

        wasInSayAll = False
        if gesture.isModifier:
            if not self.lastModifierWasInSayAll:
                wasInSayAll = self.lastModifierWasInSayAll = sayAllHandler.isRunning(
                )
        elif self.lastModifierWasInSayAll:
            wasInSayAll = True
            self.lastModifierWasInSayAll = False
        else:
            wasInSayAll = sayAllHandler.isRunning()
        if wasInSayAll:
            gesture.wasInSayAll = True

        speechEffect = gesture.speechEffectWhenExecuted
        if speechEffect == gesture.SPEECHEFFECT_CANCEL:
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       speech.cancelSpeech)
        elif speechEffect in (gesture.SPEECHEFFECT_PAUSE,
                              gesture.SPEECHEFFECT_RESUME):
            queueHandler.queueFunction(
                queueHandler.eventQueue, speech.pauseSpeech,
                speechEffect == gesture.SPEECHEFFECT_PAUSE)

        if gesture.shouldPreventSystemIdle:
            winKernel.SetThreadExecutionState(winKernel.ES_SYSTEM_REQUIRED)

        if log.isEnabledFor(log.IO) and not gesture.isModifier:
            self._lastInputTime = time.time()
            log.io("Input: %s" % gesture.identifiers[0])

        if self._captureFunc:
            try:
                if self._captureFunc(gesture) is False:
                    return
            except:
                log.error("Error in capture function, disabling",
                          exc_info=True)
                self._captureFunc = None

        if gesture.isModifier:
            raise NoInputGestureAction

        if config.conf["keyboard"][
                "speakCommandKeys"] and gesture.shouldReportAsCommand:
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       speech.speakMessage,
                                       gesture.displayName)

        gesture.reportExtra()

        # #2953: if an intercepted command Script (script that sends a gesture) is queued
        # then queue all following gestures (that don't have a script) with a fake script so that they remain in order.
        if not script and scriptHandler._numIncompleteInterceptedCommandScripts:
            script = lambda gesture: gesture.send()

        if script:
            scriptHandler.queueScript(script, gesture)
            return
        else:
            # Clear memorized last script to avoid getLastScriptRepeatCount detect a repeat
            # in case an unbound gesture is executed between two identical bound gestures.
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       scriptHandler.clearLastScript)
            raise NoInputGestureAction
예제 #6
0
 def script_BRLdots(self, gesture):
     mode, mode_msgs, new_brl = self.inferBRLmode(), [], ""
     if mode & 2: mode_msgs.append("assumed")
     mode_msgs.append(("ENG", "CHI")[mode & 1])
     log.debug("BRLkeys: Mode is " + (" ".join(mode_msgs)))
     if mode & 1:  # CHI
         self.clear(brl_buffer=False)
     try:
         state = self.brl_composition(unichr(0x2800 | gesture.dots), mode)
     except NotImplementedError:  # ENG mode, or input is rejected by brl parser.
         done = False
         if gesture.dots == 0b01000000:
             if mode & 1 or not isinstance(
                     gesture, DummyBrailleInputGesture
             ) or brailleInput.handler.table.fileName.lower(
             ) != "unicode-braille.utb":
                 log.debug("BRLkeys: dot7 default")
                 scriptHandler.queueScript(
                     globalCommands.commands.script_braille_eraseLastCell,
                     gesture)
                 done = True
         elif gesture.dots == 0b10000000:
             if mode & 1 or not isinstance(
                     gesture, DummyBrailleInputGesture
             ) or brailleInput.handler.table.fileName.lower(
             ) != "unicode-braille.utb":
                 log.debug("BRLkeys: dot8 default")
                 scriptHandler.queueScript(
                     globalCommands.commands.script_braille_enter, gesture)
                 done = True
         elif gesture.dots == 0b11000000:
             if mode & 1 or not isinstance(
                     gesture, DummyBrailleInputGesture
             ) or brailleInput.handler.table.fileName.lower(
             ) != "unicode-braille.utb":
                 log.debug("BRLkeys: dot7+dot8 default")
                 scriptHandler.queueScript(
                     globalCommands.commands.script_braille_translate,
                     gesture)
                 done = True
         elif mode & 1:
             log.debug("BRLkeys: input rejected")
             beep_typo()
             done = True
         if not done:
             log.debug("BRLkeys: dots default")
             self.clear()
             scriptHandler.queueScript(
                 globalCommands.commands.script_braille_dots, gesture)
         elif braille.handler.buffer is braille.handler.messageBuffer:
             braille.handler._dismissMessage()
         return
     except:
         log.error("BRLkeys: Unexpected error.", exc_info=True)
         self.clear()
         play_NVDA_sound("error")
         return
     log.debug('BRLkeys: Done composition "{0}"'.format(state[0]))
     if braille.handler.buffer is braille.handler.messageBuffer:
         braille.handler._dismissMessage()
     if state[0]:  # Composition completed with non-empty output.
         if state[1]:  # The co-exist intermediate state.
             self.timer = [
                 Timer(0.25, self.send_input_and_clear, (state[0], )),
                 state[0]
             ]
             self.timer[0].start()
         else:
             self.send_input_and_clear(state[0])
예제 #7
0
    def _keyDown(self, vkCode, scanCode, extended, injected):
        log.debug("keydown: vk = 0x%02X%s" %
                  (vkCode, ", injected" if injected else ""))
        # Fix: Ctrl+X followed by X.
        try:  # Check for keys that must be ignored.
            if self.ignore_injected_keys[0][0] != (vkCode, scanCode,
                                                   bool(extended)):
                raise ValueError
            log.debug("keydown: pass injected key 0x%02X" % (vkCode, ))
            del self.ignore_injected_keys[0][0]
            return self._oldKeyDown(vkCode, scanCode, extended, injected)
        except:
            pass
        # Note: 2017.3 doesn't support getNVDAModifierKeys.
        if isNVDAModifierKey(
                vkCode, extended
        ) or vkCode in KeyboardInputGesture.NORMAL_MODIFIER_KEYS:
            self._trappedNVDAModifiers.add((vkCode, extended))
            return self._oldKeyDown(vkCode, scanCode, extended, injected)
        # Don't process vkCode if it is previously modified.
        if (vkCode, extended) in self._modifiedKeys:
            return self._oldKeyDown(vkCode, scanCode, extended, injected)
        # Don't process any numpad key.
        if vkCode & 0xF0 == 0x60:
            key_id, dots = vkCode & 0x0F, 0
            try:
                if currentModifiers or self._trappedNVDAModifiers or not configure.get(
                        "ALLOW_DOT_BY_DOT_BRL_INPUT_VIA_NUMPAD"):
                    raise NotImplementedError  # Modified numpad keys, or the feature is not enabled.
                elif 0x00 <= key_id <= 0x08:  # VK_NUMPAD0 to VK_NUMPAD8
                    dots = self._uncommittedDots | (1 << key_id)
                elif key_id == 0x09:  # VK_NUMPAD9 = 0x69
                    pass  # self._uncommittedDots is cleared.
                elif key_id == 0x0E:  # VK_DECIMAL = 0x6E
                    if not self._uncommittedDots:
                        raise NotImplementedError  # No uncommitted dots.
                    self._gesture = DummyBrailleInputGesture()
                    self._gesture.space = bool(self._uncommittedDots & 0x01)
                    self._gesture.dots = self._uncommittedDots >> 1
                elif key_id == 0x0F:  # VK_DIVIDE = 0x6F
                    dots = self._uncommittedDots
                    scriptHandler.queueScript(self.script_viewBRLbuffer, None)
                else:
                    raise NotImplementedError  # Unused numpad keys.
            except NotImplementedError:
                self._modifiedKeys.add((vkCode, extended))
                return self._oldKeyDown(vkCode, scanCode, extended, injected)
            finally:
                self._uncommittedDots = dots
            self._trappedKeys.add((vkCode, extended))
            return False
        # In some cases, a key not previously trapped must be passed
        # directly to NVDA:
        # (1) Any modifier key is held down.
        # (2) NVDA is in browse mode.
        # (3) The "kbbrl_deactivated" flag is set.
        def on_browse_mode():
            try:
                obj = api.getFocusObject()
                return (isinstance(obj.treeInterceptor,
                                   DocumentTreeInterceptor)
                        and not obj.treeInterceptor.passThrough)
            except:
                pass
            return False

        if currentModifiers or self._trappedNVDAModifiers or on_browse_mode(
        ) or self.config_r["kbbrl_deactivated"]:
            if (vkCode, extended) not in self._trappedKeys:
                self._modifiedKeys.add((vkCode, extended))
                return self._oldKeyDown(vkCode, scanCode, extended, injected)
        charCode = user32.MapVirtualKeyExW(vkCode, MAPVK_VK_TO_CHAR,
                                           getInputHkl())
        if HIWORD(charCode) != 0:
            return self._oldKeyDown(vkCode, scanCode, extended, injected)
        ch = unichr(LOWORD(charCode))
        log.debug('char code: %d' % (charCode, ))
        try:
            dot = 1 << configure.get("BRAILLE_KEYS").index(ch)
        except:  # not found
            if ch not in self.ACC_KEYS:
                return self._oldKeyDown(vkCode, scanCode, extended, injected)
            dot = 0
        self._trappedKeys.add((vkCode, extended))
        if (vkCode, extended) not in self.touched_mainKB_keys:
            self.touched_mainKB_keys[(vkCode, extended)] = ch
        if dot:
            if not self._gesture:
                self._gesture = DummyBrailleInputGesture()
            log.debug("keydown: dots|space = {0:09b}".format(dot))
            if dot == 1:
                self._gesture.space = True
            self._gesture.dots |= dot >> 1
        else:
            log.debug("keydown: ignored = %s" % (ch, ))
        return False
예제 #8
0
    def executeKeyboardGesture(self, gesture, bypassRemanence=False):
        """Perform the action associated with a gesture.
		@param gesture: The gesture to execute
		@type gesture: L{InputGesture}
		@raise NoInputGestureAction: If there is no action to perform.
		"""
        if not hasattr(gesture, "noAction"):
            gesture.noAction = False
        if watchdog.isAttemptingRecovery:
            # The core is dead, so don't try to perform an action.
            # This lets gestures pass through unhindered where possible,
            # as well as stopping a flood of actions when the core revives.
            raise NoInputGestureAction
        newGesture = self.manageRemanence(
            gesture) if not bypassRemanence else None
        if newGesture is not None:
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       self.executeNewGesture, newGesture)
            return
        newGesture = self.getNumpadKeyReplacement(gesture)
        if newGesture is not None:
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       self.executeNewGesture, newGesture)
            return
        script = gesture.script
        focus = api.getFocusObject()
        if focus.sleepMode is focus.SLEEP_FULL\
         or (focus.sleepMode and not getattr(script, 'allowInSleepMode', False)):
            raise NoInputGestureAction
        wasInSayAll = False
        if gesture.isModifier:
            if not _NVDA_InputManager.lastModifierWasInSayAll:
                wasInSayAll = _NVDA_InputManager.lastModifierWasInSayAll = sayAllHandler.isRunning(
                )
        elif _NVDA_InputManager.lastModifierWasInSayAll:
            wasInSayAll = True
            _NVDA_InputManager.lastModifierWasInSayAll = False
        else:
            wasInSayAll = sayAllHandler.isRunning()
        if wasInSayAll:
            gesture.wasInSayAll = True
        speechEffect = gesture.speechEffectWhenExecuted
        if speechEffect == gesture.SPEECHEFFECT_CANCEL:
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       speech.cancelSpeech)
        elif speechEffect in (gesture.SPEECHEFFECT_PAUSE,
                              gesture.SPEECHEFFECT_RESUME):  # noqa:E501
            queueHandler.queueFunction(
                queueHandler.eventQueue, speech.pauseSpeech,
                speechEffect == gesture.SPEECHEFFECT_PAUSE)
        if py3 and gesture.shouldPreventSystemIdle:
            winKernel.SetThreadExecutionState(winKernel.ES_SYSTEM_REQUIRED
                                              | winKernel.ES_DISPLAY_REQUIRED)
        if log.isEnabledFor(log.IO) and not gesture.isModifier:
            _NVDA_InputManager._lastInputTime = time.time()
            log.io("Input: %s" % gesture.identifiers[0])
        if _NVDA_InputManager._captureFunc:
            try:
                if _NVDA_InputManager._captureFunc(gesture) is False:
                    return
            except:  # noqa:E722
                log.error("Error in capture function, disabling",
                          exc_info=True)
                _NVDA_InputManager._captureFunc = None
        if gesture.isModifier:
            if gesture.noAction:
                gesture.normalizedModifiers = []
                return
            raise NoInputGestureAction
        self.speakGesture(gesture)
        if not script:
            gesture.reportExtra()
        # then queue all following gestures
        # (that don't have a script
        # ) with a fake script so that they remain in order.
        if not script and (
                bypassRemanence
                or scriptHandler._numIncompleteInterceptedCommandScripts):
            script = lambda gesture: gesture.send()  # noqa:E731
        if script:
            scriptHandler.queueScript(script, gesture)
            return
        raise NoInputGestureAction
예제 #9
0
파일: inputCore.py 프로젝트: ma10/nvdajp
    def executeGesture(self, gesture):
        """Perform the action associated with a gesture.
		@param gesture: The gesture to execute.
		@type gesture: L{InputGesture}
		@raise NoInputGestureAction: If there is no action to perform.
		"""
        if watchdog.isAttemptingRecovery:
            # The core is dead, so don't try to perform an action.
            # This lets gestures pass through unhindered where possible,
            # as well as stopping a flood of actions when the core revives.
            raise NoInputGestureAction

        script = gesture.script
        focus = api.getFocusObject()
        if focus.sleepMode is focus.SLEEP_FULL or (
                focus.sleepMode
                and not getattr(script, 'allowInSleepMode', False)):
            raise NoInputGestureAction

        wasInSayAll = False
        if gesture.isModifier:
            if not self.lastModifierWasInSayAll:
                wasInSayAll = self.lastModifierWasInSayAll = sayAllHandler.isRunning(
                )
        elif self.lastModifierWasInSayAll:
            wasInSayAll = True
            self.lastModifierWasInSayAll = False
        else:
            wasInSayAll = sayAllHandler.isRunning()
        if wasInSayAll:
            gesture.wasInSayAll = True

        speechEffect = gesture.speechEffectWhenExecuted
        if speechEffect == gesture.SPEECHEFFECT_CANCEL:
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       speech.cancelSpeech)
        elif speechEffect in (gesture.SPEECHEFFECT_PAUSE,
                              gesture.SPEECHEFFECT_RESUME):
            queueHandler.queueFunction(
                queueHandler.eventQueue, speech.pauseSpeech,
                speechEffect == gesture.SPEECHEFFECT_PAUSE)

        if log.isEnabledFor(log.IO) and not gesture.isModifier:
            log.io("Input: %s" % gesture.logIdentifier)

        if self._captureFunc:
            try:
                if self._captureFunc(gesture) is False:
                    return
            except:
                log.error("Error in capture function, disabling",
                          exc_info=True)
                self._captureFunc = None

        if gesture.isModifier:
            raise NoInputGestureAction

        if config.conf["keyboard"][
                "speakCommandKeys"] and gesture.shouldReportAsCommand:
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       speech.speakMessage,
                                       gesture.displayName)
        # nvdajp begin
        if hasattr(gesture, "vkCode") and gesture.vkCode == winUser.VK_RETURN:
            dummy = winUser.getAsyncKeyState(winUser.VK_BACK)
        # nvdajp end

        gesture.reportExtra()

        # #2953: if an intercepted command Script (script that sends a gesture) is queued
        # then queue all following gestures (that don't have a script) with a fake script so that they remain in order.
        if not script and scriptHandler._numIncompleteInterceptedCommandScripts:
            script = lambda gesture: gesture.send()

        if script:
            scriptHandler.queueScript(script, gesture)
            return

        raise NoInputGestureAction