NVDA Menu Cursor Movement Feature - B3P15/CSC-403-nvda-project GitHub Wiki

Author: Kieran Gilpin

Description

Referenced Issue: Here

  • This feature modifies the mouse behavior when opening the NVDA menu (NVDA+n shortcut) so that the mouse is moved back to its original position once the menu is opened. Currently in NVDA, the mouse is moved to the center of the screen when the main NVDA menu is opened. This is because the menu is generated at the position of the mouse. This is done to ensure consistent placement of the menu in the middle of the screen.

General Approach

  • This feature was structured as a source code change. That is, the main NVDA files were modified and build into a developer instance that is built from scratch on the local machine and compiled into the running application.
  • To implement this feature, the logic of the menu generation was modified. As the NVDA menu is generated at the position of the mouse, the mouse must still be moved to the center of the screen. However, the user's mouse location is saved prior to the menu generation. Using a slight delay in the calling of a method that moves the mouse, the mouse can be moved to the center for menu generation, then quickly moved back to the prior position. This feature was important to implement as some users with a large DPI (dots per inch) and a larger cursor have NVDA focus shifted to unwanted menu icons when the menu is generated right under the mouse.

What Went Right

  • Although this change required some logic modification, the refactoring of existing code was limited. Most of the change comprised of saving information prior to performing already implemented actions.

What Went Wrong

  • Initial work and investigation of where this feature should be implemented was frustrating. The method that actually creates the NVDA menu is from a C++ package, and pauses the main thread upon menu generation until the menu is closed. With this restriction, any mouse movement method called after the menu generation occurred after the menu was closed. This required a creative workaround that calls the mouse movement method on a slight delay, so that the function call was queued before the thread is paused, but executes afterward.

Next Steps

  • During the next sprint, I will ensure that any C++ methods called that are relevant to my feature do not interfere with planned functionality. If they do, it is imperative to determine how to work around thread pausing.