Skip to content

Prevent system sleep when reading lon pieces of text in say all#10643

Merged
feerrenrut merged 1 commit into
nvaccess:masterfrom
LeonarddeR:avoidLockDuringSayAll
Jan 30, 2020
Merged

Prevent system sleep when reading lon pieces of text in say all#10643
feerrenrut merged 1 commit into
nvaccess:masterfrom
LeonarddeR:avoidLockDuringSayAll

Conversation

@LeonarddeR

@LeonarddeR LeonarddeR commented Dec 19, 2019

Copy link
Copy Markdown
Collaborator

Link to issue number:

Follow up of #10111

Summary of the issue:

When a system is set up to lock or go to sleep within one minute, say all is interrupted when reading long paragraphs in virtual buffers. Possibly in other cases as well.

Description of how this pull request fixes the issue:

Similar as in #10111. We instruct the system not to sleep. This happens on every line we reach.

Testing performed:

Tested with a long paragraph of text in Firefox browse mode. My system no longer locks within one minute.

Known issues with pull request:

In theory, say all could still be interrupted when reading a very long line at a very slow rate.

Change log entry:

  • Changes
    • NVDA prevents the system from locking or going to sleep when in say all.

@LeonarddeR LeonarddeR marked this pull request as ready for review December 20, 2019 08:08
@LeonarddeR LeonarddeR requested a review from feerrenrut January 30, 2020 12:51
@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

@feerrenrut: I'd like to shamelessly ask you to review this, as this really interrupts my current work flow in a major way. I have a system that has a lock of the screen enforced at one minute by means of a group policy, and this makes it very hard to use say all in Word and on the web.

@feerrenrut feerrenrut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @LeonarddeR

@feerrenrut feerrenrut merged commit b94442a into nvaccess:master Jan 30, 2020
@nvaccessAuto nvaccessAuto added this to the 2019.3 milestone Jan 30, 2020
@feerrenrut feerrenrut modified the milestones: 2019.3, 2020.1 Jan 30, 2020
feerrenrut added a commit that referenced this pull request Jan 30, 2020
@btman16

btman16 commented May 2, 2020

Copy link
Copy Markdown

Hi,

On systems without group policies set, it's preventing my laptop from turning off the screen which is consuming more power on my laptop. My laptop has a very small battery, so I need to get as much power out of it as I can, and this will have negative effects.
This is a huge show stopper for me, and I'd like to ask if this can be made optional please? Or could there be a way to do a say all without this change?

Thank you very much and I look forward to any input you may have.

Thanks,

Brandon

@feerrenrut

Copy link
Copy Markdown
Contributor

@LeonarddeR Did you investigate using only winKernel.SetThreadExecutionState(winKernel.ES_SYSTEM_REQUIRED) E.G. leaving out winKernel.ES_DISPLAY_REQUIRED?

@btman16 It would be best if you create a new issue to explain the problem. In the new issue please answer the following:

  • Do you expect the computer to sleep, or just let the display turn off and continue with say-all?
  • Is the screen being kept on even when not using say-all?

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

This flag was added on request of @michaelDCurran in #10111 (comment) . I"m happy to remove it for this case and provide a pr. Does this block 2020.1 from being released, though?

@feerrenrut

Copy link
Copy Markdown
Contributor

I"m happy to remove it for this case and provide a pr.

I'd like to understand the use-cases from @btman16 better first.

Does this block 2020.1 from being released

I don't think this is a serious enough issue to block the release at this late stage.

From the MS docs:

Multimedia applications, such as video players and presentation applications, must use ES_DISPLAY_REQUIRED when they display video for long periods of time without user input. Applications such as word processors, spreadsheets, browsers, and games do not need to call SetThreadExecutionState.

This makes me think that ES_DISPLAY_REQUIRED isn't appropriate for audio only users, though, of course this depends on the user. Low-vision users may still want the screen to be kept on. It's certainly annoying for me having the screen turn off while I'm trying to read a long thing.

Also the end of the MS docs has an answer to the screen saver question. Though the use of screen savers is pretty rare these days!

This function does not stop the screen saver from executing.

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

@btman16 Would you be able to try this build of NVDA to see whether this fixes it for you?

@LeonarddeR

LeonarddeR commented May 4, 2020

Copy link
Copy Markdown
Collaborator Author

Low-vision users may still want the screen to be kept on. It's certainly annoying for me having the screen turn off while I'm trying to read a long thing.

That's what I figured as well. Especially if we intend the NVDA highlighter to follow along say all at some point.

@btman16 nevertheless, it would be helpful to see how the try build behaves in your case. Also, wouldn't it be possible for you to disable your screen with windows+p entirely (choose second screen)? That works for several older pc's that still have a dedicated VGA connector, like my five year old laptop.

@btman16

btman16 commented May 4, 2020 via email

Copy link
Copy Markdown

@btman16

btman16 commented May 4, 2020 via email

Copy link
Copy Markdown

@josephsl

josephsl commented May 4, 2020 via email

Copy link
Copy Markdown
Contributor

@btman16

btman16 commented May 4, 2020 via email

Copy link
Copy Markdown

@feerrenrut

Copy link
Copy Markdown
Contributor

While low vision or sighted users likely want to keep their screen on during long periods of reading, I think they are more likely to windows settings appropriate for keeping their screen on, and familiar with using the mouse to keep the screen on.

It's certainly too late 2020.1, but I would accept a PR for this change.

@btman16

btman16 commented May 5, 2020 via email

Copy link
Copy Markdown

@XLTechie

XLTechie commented May 6, 2020 via email

Copy link
Copy Markdown
Collaborator

@btman16

btman16 commented May 6, 2020 via email

Copy link
Copy Markdown

@XLTechie

XLTechie commented May 6, 2020 via email

Copy link
Copy Markdown
Collaborator

@feerrenrut

Copy link
Copy Markdown
Contributor

Would you still like me to make a new issue describing this case?

@btman16 No new issue required. Thanks!

@btman16

btman16 commented May 8, 2020 via email

Copy link
Copy Markdown

@feerrenrut

Copy link
Copy Markdown
Contributor

Will it be showing up in Alpha?

Yes, it was delivered with PR #11118 and should now be available in alpha.

seanbudd pushed a commit that referenced this pull request Feb 16, 2025
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
Added new helper/wrapper methods to systemUtils
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.
@LeonarddeR LeonarddeR deleted the avoidLockDuringSayAll branch August 23, 2025 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants