Proper Focus on Startup Feature - B3P15/CSC-403-nvda-project GitHub Wiki
Author: Kieran Gilpin
Description
Referenced Issue: Here
- This feature searches for any open windows upon startup and sets the focus to the topmost window. If there are no open windows, the focus is set to the desktop. Within NVDA currently, if there is no focus already selected upon startup, focus is shifted to the start icon on the taskbar. This can lead to confusion from new users who would expect the focus of NVDA to be set to an application that was already open upon startup.
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 that determines the initial focus was modified. Using some of the windows accessibility APIs, the running processes are enumerated upon startup and their window handles are stored as an array. When building the array NVDA checks the window properties to ensure the window is actually visible to the user and is a user started application. The topmost window (index 0 of the list) is then selected as the initial focus. If the list is empty, the desktop window is selected as the focus.
What Went Right
- As this feature heavily involved windows APIs, there was plentiful documentation to determine how the logic for window selection would work.
- In addition, the portion of code that handles the initial focus of NVDA was clearly commented and constructed. This made identification of where the change should be easy.
What Went Wrong
- Although other portions of NVDA code perform similar functions when gathering active windows utilizing the windows APIS, new methods were required to be constructed to fulfill my requirements. This required time consuming unit and manual testing to ensure the background processes NVDA uses to build virtual buffers were not included in the window enumeration.
- This solution required some cascading logic modifications that allows the NVDA core (main driver) to view properties of the windows as NVDAObjects (main class type for most OS components) rather than windows API objects.
Next Steps
- During the next sprint I will ensure that when constructing new methods I will analyze any similar logic already implemented in the code and determine how modifications alter behavior.