[orca] Add means to test if the last input event came from the current application
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Add means to test if the last input event came from the current application
- Date: Wed, 17 Oct 2018 17:52:14 +0000 (UTC)
commit 79351eb3c57dbcfe642e52e7f5a6726c3a0cc5ff
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Oct 17 19:51:38 2018 +0200
Add means to test if the last input event came from the current application
src/orca/input_event.py | 5 +++++
src/orca/script_utilities.py | 7 +++++++
2 files changed, 12 insertions(+)
---
diff --git a/src/orca/input_event.py b/src/orca/input_event.py
index b653611bd..396b76363 100644
--- a/src/orca/input_event.py
+++ b/src/orca/input_event.py
@@ -446,6 +446,11 @@ class KeyboardEvent(InputEvent):
return self.event_string in ["space", " "]
+ def isFromApplication(self, app):
+ """Return True if this is associated with the specified app."""
+
+ return self._app == app
+
def isCharacterEchoable(self):
"""Returns True if the script will echo this event as part of
character echo. We do this to not double-echo a given printable
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 8ca544e79..511eecbd1 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -4542,6 +4542,13 @@ class Utilities:
text = "%s\n%s" % (text, newText)
clipboard.set_text(text, -1)
+ def lastInputEventCameFromThisApp(self):
+ if not isinstance(orca_state.lastInputEvent, input_event.KeyboardEvent):
+ return False
+
+ event = orca_state.lastNonModifierKeyEvent
+ return event and event.isFromApplication(self._script.app)
+
def lastInputEventWasPrintableKey(self):
event = orca_state.lastInputEvent
if not isinstance(event, input_event.KeyboardEvent):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]