[orca] Hack around broken text-insertion events from gnome-shell
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Hack around broken text-insertion events from gnome-shell
- Date: Sun, 14 Feb 2016 19:14:21 +0000 (UTC)
commit 353bdf7182ad47dd3e19bd0762cc86a753736be0
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Sun Feb 14 14:12:39 2016 -0500
Hack around broken text-insertion events from gnome-shell
src/orca/script_utilities.py | 3 ++
.../scripts/apps/gnome-shell/script_utilities.py | 22 ++++++++++++++++++++
src/orca/scripts/default.py | 4 ++-
3 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 58c3abd..99dfddc 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2289,6 +2289,9 @@ class Utilities:
return None
+ def insertedText(self, event):
+ return event.any_data
+
def selectedText(self, obj):
"""Get the text selection for the given object.
diff --git a/src/orca/scripts/apps/gnome-shell/script_utilities.py
b/src/orca/scripts/apps/gnome-shell/script_utilities.py
index 97da615..90a567d 100644
--- a/src/orca/scripts/apps/gnome-shell/script_utilities.py
+++ b/src/orca/scripts/apps/gnome-shell/script_utilities.py
@@ -53,6 +53,28 @@ class Utilities(script_utilities.Utilities):
return children
+ def insertedText(self, event):
+ if event.any_data:
+ return event.any_data
+
+ if event.detail1 == -1:
+ msg = "GNOME SHELL: Broken text insertion event"
+ debug.println(debug.LEVEL_INFO, msg, True)
+
+ text = self.queryNonEmptyText(event.source)
+ if text:
+ string = text.getText(0, -1)
+ if string:
+ msg = "HACK: Returning last char in '%s'" % string
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return string[-1]
+
+ msg = "GNOME SHELL: Unable to correct broken text insertion event"
+ debug.println(debug.LEVEL_INFO, msg, True)
+
+ return ""
+
+
def selectedText(self, obj):
string, start, end = super().selectedText(obj)
if -1 not in [start, end]:
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index bc45ca2..e96e56f 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -2563,7 +2563,9 @@ class Script(script.Script):
return
speakString = True
- string = event.any_data
+
+ # Because some implementations are broken.
+ string = self.utilities.insertedText(event)
if self.utilities.lastInputEventWasCommand():
msg = "DEFAULT: Insertion is believed to be due to command"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]