New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kindle 1.19 support #6638

Merged
merged 14 commits into from Jan 23, 2017

Conversation

Projects
None yet
3 participants
@jcsteh
Contributor

jcsteh commented Dec 13, 2016

This adds support for new Kindle functionality introduced in Kindle 1.19, as well as other improvements to Kindle support. It also adds documentation for Kindle support to the User Guide.

Features:

  • Reporting of links and graphics and activation of links. The IA2 embedded object model is used for this, so we use MozillaCompoundTextInfo.
  • Reporting of notes and highlights.
  • Selection of text and access to selection options (including creating highlights and notes).
  • Single letter navigation to links (including footnotes) and graphics.

Fixes/improvements:

  • Fix failure to detect focus change when opening a book from the Kindle library.
  • Handle page changes not triggered by NVDA (e.g. using the mouse, using a keyboard command not intercepted by NVDA, via the Table of Contents, resizing the window, etc.).
  • Better workaround for focus being inaccurately thrown into the Table of Contents when turning pages. Kindle still fires incorrect events, but we can now use the focused state on the book area to accurately determine whether these events are incorrect.
  • The find commands aren't currently supported, so report this fact rather than just throwing an exception.
  • Remove various hacks that are no longer needed: waiting in a loop for a pageChange event after turnPage (since the action is now synchronous), forcing shouldAllowIAccessibleFocusEvent for BookPageView (since Kindle now sets the focused state correctly).

This work required quite a few fixes and changes scattered throughout the code base. Because some of these changes will be hard to understand without context, I've split these into smaller commits. When it comes time to merge to master, this should be done as a standard merge, rather than our usual squash.

What's New entry: in New Features:

- Support for reading and navigating books in Kindle for PC version 1.19, including access to links, footnotes, graphics, highlighted text and user notes. Please see the Kindle for PC section of the NVDA User Guide for further information. (#6247, #6638)

jcsteh added some commits Nov 3, 2016

Fix failure to detect focus change when opening a book from the Kindl…
…e library.

IAccessibleHandler.OrderedWinEventLimiter: Don't drop focus events if we have a foreground event with the same parameters. Otherwise, we might drop a valid focus event even though the foreground event is invalid. With this change, pumpAll rejects the invalid foreground event and falls back to the valid focus event.
This will cause us to end up with more focus events in the limiter, so bump maxFocusItems from 3 to 4 to compensate.
CursorManager: Refactor selection code to work for TextInfos that are…
…n't offset based.

The previous code assumed that the TextInfo implementation allowed moving the end before the start. OffsetsTextInfo handles this and normalises the result so that end > start. However, TextInfos such as MozillaCompoundTextInfo and Microsoft Word don't handle this.
This fixes backwards selection in Kindle and Microsoft Word browse mode.
IA2TextTextInfo: When fetching IA2 text attributes, don't go back one…
… offset if the attributes string is empty, as an empty attributes string can mean no attributes which is a valid case such as in Kindle.
Compound TextInfos: Don't set the name attribute on control fields fo…
…r links, as this cause double speaking for quick nav. Use the content attribute on control fields for graphics, as this works well for both speech and braille.
MozillaCompoundTextInfo: Support instantiation from NVDAObject.
The previous hack of using caret doesn't work for Kindle, which doesn't have a real caret.
MozillaCompoundTextInfo: Support retrieving selection even when the i…
…mplementation doesn't have a caret (such as with Kindle).
Various fixes in CompoundTextInfo and MozillaCompoundTextInfo:
* Fix CompoundTextInfo.__eq__ when comparing against TextInfos of other types.
* Fix MozillaCompoundTextInfo.move for backwards movement.
* Fix off-by-one error in CompoundTextInfo which broke CursorManager selection across embedded objects.
Support for new Kindle functionality introduced in Kindle 1.19, as we…
…ll as other improvements to Kindle support.

Features:
* Reporting of links and graphics and activation of links. The IA2 embedded object model is used for this, so we use MozillaCompoundTextInfo.
* Reporting of notes and highlights.
* Selection of text and access to selection options (including creating highlights and notes).
* Single letter navigation to links (including footnotes) and graphics.

Fixes/improvements:
* Handle page changes not triggered by NVDA (e.g. using the mouse, using a keyboard command not intercepted by NVDA, via the Table of Contents, resizing the window, etc.).
* Better workaround for focus being inaccurately thrown into the Table of Contents when turning pages. Kindle still fires incorrect events, but we can now use the focused state on the book area to accurately determine whether these events are incorrect.
* The find commands aren't currently supported, so report this fact rather than just throwing an exception.
* Remove various hacks that are no longer needed: waiting in a loop for a pageChange event after turnPage (since the action is now synchronous), forcing shouldAllowIAccessibleFocusEvent for BookPageView (since Kindle now sets the focused state correctly).

@jcsteh jcsteh requested a review from michaelDCurran Dec 13, 2016

@jcsteh jcsteh added this to the 2017.1 milestone Dec 13, 2016

@jcsteh jcsteh added the p2 label Dec 13, 2016

Show outdated Hide outdated user_docs/en/userGuide.t2t

jcsteh added a commit that referenced this pull request Dec 15, 2016

jcsteh added a commit that referenced this pull request Jan 11, 2017

Fix failure when uninstalling add-ons that have an installTasks modul…
…e which imports the gui module.

This was due to the circular import of speech from textInfos and treeInterceptorHandler. We now import late to avoid this.
Fixes #6749.

jcsteh added a commit that referenced this pull request Jan 19, 2017

@jcsteh

This comment has been minimized.

Show comment
Hide comment
@jcsteh

jcsteh Jan 19, 2017

Contributor

@michaelDCurran reviewed and approved that last commit out-of-band. :)

We're going to merge to master on Monday, since we really need to get this into master for wider testing and I think this change is small enough that we don't need to reincubate for the whole time.

Contributor

jcsteh commented Jan 19, 2017

@michaelDCurran reviewed and approved that last commit out-of-band. :)

We're going to merge to master on Monday, since we really need to get this into master for wider testing and I think this change is small enough that we don't need to reincubate for the whole time.

@jcsteh jcsteh merged commit 47d1fb0 into master Jan 23, 2017

jcsteh added a commit that referenced this pull request Jan 23, 2017

@jcsteh

This comment has been minimized.

Show comment
Hide comment
@jcsteh

jcsteh Jan 23, 2017

Contributor

I accidentally squash merged this when I meant to full merge, so I quickly force pushed a full merge. The correct merge commit is 7fefb3a.

Contributor

jcsteh commented Jan 23, 2017

I accidentally squash merged this when I meant to full merge, so I quickly force pushed a full merge. The correct merge commit is 7fefb3a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment