[orca] Remove the Thunderbird script's onCaretMoved() callback
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Remove the Thunderbird script's onCaretMoved() callback
- Date: Thu, 14 Nov 2013 19:45:51 +0000 (UTC)
commit b5ff86a3600e64316ab1f9e70401f17f8fb133b6
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Thu Nov 14 14:19:36 2013 -0500
Remove the Thunderbird script's onCaretMoved() callback
* It was there to hack around hacks in the Gecko and default scripts.
Those hacks were removed as part of the refactor and rewrite.
* Its presence actually causes Orca to be silent sometimes; its removal
fixes that.
src/orca/scripts/apps/Thunderbird/script.py | 58 ---------------------------
src/orca/scripts/toolkits/Gecko/script.py | 19 +++------
2 files changed, 7 insertions(+), 70 deletions(-)
---
diff --git a/src/orca/scripts/apps/Thunderbird/script.py b/src/orca/scripts/apps/Thunderbird/script.py
index 0d6eb95..a4702e3 100644
--- a/src/orca/scripts/apps/Thunderbird/script.py
+++ b/src/orca/scripts/apps/Thunderbird/script.py
@@ -116,64 +116,6 @@ class Script(Gecko.Script):
prefs.writelines("%s.sayAllOnLoad = %s\n" % (prefix, value))
script_settings.sayAllOnLoad = value
- def onCaretMoved(self, event):
- """Called whenever the caret moves.
-
- Arguments:
- - event: the Event
- """
-
- # Much of the Gecko code is designed to handle Gecko's broken
- # caret navigation. This is not needed in -- and can sometimes
- # interfere with our presentation of -- a simple message being
- # composed by the user. Surely we can count on Thunderbird to
- # handle navigation in that case.
- #
- if self.isEditableMessage(event.source) \
- or self.isNonHTMLEntry(event.source):
- self.setCaretContext(event.source, event.detail1)
- return default.Script.onCaretMoved(self, event)
-
- # Page_Up/Page_Down are not used by Orca. However, users report
- # using these keys in Thunderbird without success. The default
- # script is sometimes rejecting the resulting caret-moved events
- # based on the locusOfFocus other times Gecko is because of the
- # caret context.
- #
- lastKey, mods = self.utilities.lastKeyAndModifiers()
- updatePosition = lastKey in ["Page_Up", "Page_Down"]
-
- # Unlike the unpredictable wild, wild web, odds are good that a
- # caret-moved event in a message composition window is valid. But
- # depending upon the locusOfFocus at the time this event is issued
- # the default Gecko toolkit script might not do the right thing.
- #
- if not updatePosition and event.detail1 >= 0:
- updatePosition = \
- event.source.getState().contains(pyatspi.STATE_EDITABLE)
-
- if updatePosition:
- orca.setLocusOfFocus(event, event.source, notifyScript=False)
- self.setCaretContext(event.source, event.detail1)
-
- # The Gecko script, should it be about to pass along this
- # event to the default script, will set the locusOfFocus to
- # the object returned by findFirstCaretContext(). If that
- # object is not the same as the event source or the event
- # source's parent, the default script will reject the event.
- # As a result, if the user presses Page_Up or Page_Down and
- # just so happens to land on an object whose sole contents
- # is an image, we'll say nothing. Ultimately this should
- # probably be handled elsewhere, but this close to the next
- # major (2.24) release, I (JD) am not risking it. :-)
- #
- [obj, offset] = \
- self.findFirstCaretContext(event.source, event.detail1)
- if obj.getRole() == pyatspi.ROLE_IMAGE:
- return default.Script.onCaretMoved(self, event)
-
- return Gecko.Script.onCaretMoved(self, event)
-
def onFocusedChanged(self, event):
"""Callback for object:state-changed:focused accessibility events."""
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 28b4008..dd28724 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -926,6 +926,13 @@ class Script(default.Script):
if not text:
return
+ [obj, characterOffset] = self.getCaretContext()
+ if characterOffset == event.detail1 \
+ and self.utilities.isSameObject(obj, event.source):
+ return
+
+ # TODO - JD: How much of the mess below is still needed?
+
eventSourceRole = event.source.getRole()
eventSourceState = event.source.getState()
eventSourceInDocument = self.inDocumentContent(event.source)
@@ -940,16 +947,6 @@ class Script(default.Script):
notify = False
- # Find out if the caret really moved. Firefox 3.1 gives us caret-moved
- # events when certain focusable objects first get focus. If we haven't
- # really moved, there's no point in updating braille again -- which is
- # what we'll wind up doing if this event reaches the default script.
- #
- [obj, characterOffset] = self.getCaretContext()
- if max(0, characterOffset) == event.detail1 \
- and self.utilities.isSameObject(obj, event.source):
- return
-
if isinstance(orca_state.lastInputEvent, input_event.KeyboardEvent):
string, mods = self.utilities.lastKeyAndModifiers()
if self.useCaretNavigationModel(orca_state.lastInputEvent):
@@ -1043,8 +1040,6 @@ class Script(default.Script):
#
return
- # Pass the event along to the default script for processing.
- #
default.Script.onCaretMoved(self, event)
def onTextDeleted(self, event):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]