Skip to content
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

Ensure screen stays on during say all #17651

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

LeonarddeR
Copy link
Collaborator

Link to issue number:

Fixes #17649
Partially reverts #11118
Follow up of #10111, #10643,

Summary of the issue:

On some systems (mine, for example 😉) the screen still locks during a say all even though we reset the system idle timer. We also reset the display timer in the past, but this was reverted in #11118, particularly on request of @btman16

Description of user facing changes

Added a new advanced setting that, when enabled, also resets the display timer.

Description of development approach

  1. Added new helper/wrapper methods to systemUtils
  2. Rather than resetting the timer(s) many times during a say all, we now persist the state during say all using the ES_CONTINUOUS flag. This should avoid an edge case where reading a line takes more then a minute and the sleep timer is a minute, in which case the system will still lock.

Testing strategy:

Tested on my system. Noted that with the feature flag enabled, the system doesn't lock, whereas when disabled, it does lock.

Known issues with pull request:

None known

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@coderabbitai summary

@LeonarddeR LeonarddeR requested review from a team as code owners January 24, 2025 13:56
@zstanecic
Copy link
Contributor

@LeonarddeR
Just for the sake of the simple check:
What do you get on your system when you write in the windows terminal the following command?
powercfg /a
It is crucial answer, because this behavior has to do with the power schemes of windows and modern standby s0, where you don't have adjustable power plans like in the past, and all is literally regulated from the firmware/bios of your computer.

@LeonarddeR
Copy link
Collaborator Author

The only sleep state I have on this system is hybernate, since I unfortunately don't have S3 here. I once disabled s0 in the bios and was too lazy to re-enable it.

@zstanecic
Copy link
Contributor

btw, on some computers, it is not available to turn off the s0..

source/gui/settingsDialogs.py Outdated Show resolved Hide resolved
user_docs/en/userGuide.md Outdated Show resolved Hide resolved
source/gui/settingsDialogs.py Outdated Show resolved Hide resolved
user_docs/en/changes.md Outdated Show resolved Hide resolved
|Default |Disabled|

This option ensures that the screen stays on when reading with say all or with braille (e.g. when pressing scroll buttons).
This avoids the situation where the screen unexpectedly locks during a say all.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The option name talks about system lock whereas here, you talk about screen lock. I have not reviewed this PR in detail, but reading the UG does not clarify things for me.

Are we talking about system lock, I guess session lock?) or the screen turning off (black)?

I think that you should describe both the use cases for enabled and for disabled here. Thanks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More specifically and reading #17651 (comment) by @btman16, I have concerns regarding braille.
I'd say that systems using modern standby should never enter standby, thus never lock, when reading braille.

@btman16
Copy link

btman16 commented Jan 30, 2025 via email

@LeonarddeR
Copy link
Collaborator Author

@CyrilleB79 I think you are raising valid concerns here.

  1. I'm using screen lock and system lock interchangeably. When the screen is locked, the system is locked and vise versa. May be I should stick with system lock.
  2. We also need to distinguish between the system idle timer and the display idle timer. In a normal situation, resetting the system idle timer should prevent locking, however on newer system, this doesn't seem to be the case. Both in say all and when pressing a braille gesture, we're resetting the idle timer, but this doesn't seem sufficient. This is why this general setting is introduced.
  3. The reason why this general setting is disabled by default is that it resetting the display timer to prevent locking will also result in the display never going black during a say all. This means a negative impact on battery life.

I'm not sure how s3/s0 standby is related here. The problem is not the system idle timer, but the display idle timer. I don't think that's related to system power state, but to display power state, which is a different aspect.

@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Feb 3, 2025
@@ -1769,7 +1769,7 @@ def __init__(self, handler):
#: The translated braille representation of the entire buffer.
#: @type: [int, ...]
self.brailleCells = []
self._windowRowBufferOffsets: list[tuple[int, int]] = [(0, 1)]
self._windowRowBufferOffsets: list[tuple[int, int]] = [(0, 0)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are appears to be merge conflicts here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fixed now.

@LeonarddeR
Copy link
Collaborator Author

There was something wrong in the merge process, I rebased on master to get rid of it.

@CyrilleB79
Copy link
Collaborator

Frankly, the UX of this new option still seems strange and I am not sure to understand it if I only read the User Guide (i.e. not the PR).

The option is called "Prevent system lock during say all or reading with braille". As a simple user, I would wonder:
Who would disable this option? I.e. who would accept that the system locks while reading with braille? If you keep the option as is, you should at least explain that for some systems, system lock is only screen becoming black. And you should explain which system can or cannot let the screen becoming black without locking the session. But that would become a very difficult explanation for all users.

As a user, I would prefer an option "Allow the screen to sleep / become black during say all or while reading braille" or something similar. And NVDA should evaluate itself if the options is relevant or not depending on the standby capabilities of the system. The option should be greyed out on systems where screen standby = session lock because there is no point in enabling session lock while reading braille.

@Adriani90
Copy link
Collaborator

What exactly is the purpose of this setting? Is it that users using say all want to have longer batery time while using NVDA? When I use NVDA actively with the keyboard, the screen doesn't get black either. So why should this be optional when using say all?

@LeonarddeR
Copy link
Collaborator Author

I initially thought this needn't be an option, but then @btman16 chimed in, saying that it was negatively impacting his battery life. SO that's why it is an option now.
I think I know how to name this in a more obvious way.

@LeonarddeR LeonarddeR changed the title Avoid locking the screen during say all Ensure screen stays on during say all Feb 8, 2025
@LeonarddeR
Copy link
Collaborator Author

When I use NVDA actively with the keyboard, the screen doesn't get black either. So why should this be optional when using say all?

When NVDA is reading with review cursor say all, the physical cursor isn't moving so there's basically nothing happening from a visible point of view. It makes sense not to prevent the display from turning off in that case.
That said, your remark makes me think we should limit this option to say all only, and then we might want to move it to the speech section instead.

This option ensures that the display stays on when reading with say all or with braille (e.g. when pressing scroll buttons).
This avoids the situation where the screen unexpectedly locks during a say all.
This option is enabled by default.
Consider disabling this option if you are suffering from a shorter battery life.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe:

Suggested change
Consider disabling this option if you are suffering from a shorter battery life.
Consider disabling this option if you are suffering from a shorter battery life and you do not need to use the screen.

Just a suggestion. Feel free to accept, rephrase or decline depending on if you find it suitable or not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is relevant as locking may occur which would affect more than just screen usage

Comment on lines 3846 to 3851
# Translators: This is the label for a group of advanced options in the
# Advanced settings panel
label = _("System")
systemSizer = wx.StaticBoxSizer(wx.VERTICAL, self, label=label)
systemGroup = guiHelper.BoxSizerHelper(self, sizer=systemSizer)
sHelper.addItem(systemGroup)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be removed?

@@ -36,6 +36,9 @@ As a consequence, announcement of first line indent is now supported for LibreOf
* In Word, the selection update is now reported when using Word commands to extend or reduce the selection (`f8` or `shift+f8`). (#3293, @CyrilleB79)
* In Microsoft Word 16.0.18226 and higher or when using Word object model, NVDA will now report if a heading is collapsed in both speech and braille. (#17499)
* NVDA is now able to report caret changes when pressing `alt+upArrow` or `alt+downArrow` gestures, for example in Visual Studio. (#17652, @LeonarddeR)
* Added a general setting to prevent the display to turn off during say all or reading with braille.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Added a general setting to prevent the display to turn off during say all or reading with braille.
* Added a general setting to prevent the display turning off during say all or reading with braille.

@@ -36,6 +36,9 @@ As a consequence, announcement of first line indent is now supported for LibreOf
* In Word, the selection update is now reported when using Word commands to extend or reduce the selection (`f8` or `shift+f8`). (#3293, @CyrilleB79)
* In Microsoft Word 16.0.18226 and higher or when using Word object model, NVDA will now report if a heading is collapsed in both speech and braille. (#17499)
* NVDA is now able to report caret changes when pressing `alt+upArrow` or `alt+downArrow` gestures, for example in Visual Studio. (#17652, @LeonarddeR)
* Added a general setting to prevent the display to turn off during say all or reading with braille.
This option is enabled by default, but can possibly result in shorter battery life.
If you suspect this option to negatively impact your battery life, you're advised to disable it. (#17649, @LeonarddeR)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you suspect this option to negatively impact your battery life, you're advised to disable it. (#17649@LeonarddeR)
If you suspect this option is negatively impacting your battery life, you're advised to disable it. (#17649@LeonarddeR)

@@ -1846,6 +1846,18 @@ If you wish to change the update mirror, press the "Change..." button to open th
Please note that when using an update mirror, the operator of the mirror has access to all [information sent with update checks](#GeneralSettingsCheckForUpdates).
Contact the operator of the update mirror for details of their data handling policies to ensure you are comfortable with the way your information will be handled before setting an update mirror.

##### Prevent display from turning off during say all or reading with braille {#preventDisplayTurnOff}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please capitalie the first letter of anchors

Suggested change
##### Prevent display from turning off during say all or reading with braille {#preventDisplayTurnOff}
##### Prevent display from turning off during say all or reading with braille {#PreventDisplayTurnOff}

conf=config.conf,
)
)
self.bindHelpEvent("preventDisplayTurnOff", self.preventDisplayTurnOffCombo)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.bindHelpEvent("preventDisplayTurnOff", self.preventDisplayTurnOffCombo)
self.bindHelpEvent("PreventDisplayTurnOff", self.preventDisplayTurnOffCombo)

Comment on lines +1851 to +1854
| . {.hideHeaderRow} |.|
|---|---|
|Options |Default (Enabled), Disabled, Enabled|
|Default |Enabled|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move this to the bottom of the section as per the latest coding standards for more information.

This option ensures that the display stays on when reading with say all or with braille (e.g. when pressing scroll buttons).
This avoids the situation where the screen unexpectedly locks during a say all.
This option is enabled by default.
Consider disabling this option if you are suffering from a shorter battery life.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is relevant as locking may occur which would affect more than just screen usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

System still sleeps during say all
6 participants