Bug 120326 - Running slideshow must disable screensaver/sleep mode on Windows
Summary: Running slideshow must disable screensaver/sleep mode on Windows
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All Windows (All)
: medium minor
Assignee: Mike Kaganski
URL:
Whiteboard: target:7.5.0
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-04 21:35 UTC by Mike Kaganski
Modified: 2022-10-13 14:21 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2018-10-04 21:35:16 UTC
When in presentation controlled using Impress Remote (at least on Windows), using next/previous slide from the Remote does not treated by OS as user events that reset screen saver; so after some time in the presentation, the screen may power off. The proposal is to send some user events to system to reset the idle timer at each Remote interaction.

STR:
1. Start a presentation using Impress Remote
2. Don't touch computer's keyboard or mouse; keep controlling the presentation using Remote

Actual results:
Eventually, screens (both main and presentation) would turn off after system-defined timeout

Expected Results:
If time since last Remote interaction is less than the screen saver timeout, it shouldn't be activated, even if the presentation itself is running long enough.
Comment 1 Xisco Faulí 2018-11-05 13:02:06 UTC
moving to NEW
Comment 2 QA Administrators 2019-11-06 03:30:53 UTC Comment hidden (obsolete)
Comment 3 Christian Lohmaier 2019-11-11 11:11:20 UTC
as the app only communicates with LibreOffice, and doesn't interact with the OS itself, this requires a change in LibreOffice Impress, thus reassigning
Comment 4 QA Administrators 2021-11-11 04:14:14 UTC Comment hidden (obsolete, spam)
Comment 5 Mike Kaganski 2021-11-11 07:13:32 UTC
Code pointers:

The place where we should insert calls to inform OS about user input is

  Receiver::executeCommand in sd/source/ui/remotecontrol/Receiver.cxx

Additionally/alternatively, we might consider setting an OS flag on remote connection/initiated slideshow start, and clear it on disconnection/slideshow end. This needs to be done at

  Communicator ctor and dtor in sd/source/ui/remotecontrol/Communicator.cxx

The code to inform OS is necessarily OS/WM-specific. For Windows, informing OS about user input (in Receiver) should be done using SendInput [1], as discussed at [2]. Using PowerSetRequest [3] and/or SetThreadExecutionState [4] may be used in the Communicator, as these calls do not represent some events, but rather some state.

[1] https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendinput
[2] http://stackoverflow.com/a/1675793/1889329
[3] https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-powersetrequest
[4] https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setthreadexecutionstate
Comment 7 Mike Kaganski 2022-10-13 08:39:43 UTC
Oh - it's actually a bug, and the presentation should disable screen saver completely:

https://opengrok.libreoffice.org/xref/core/vcl/win/window/salframe.cxx?r=82ad6bc4#1883
Comment 8 Mike Kaganski 2022-10-13 10:56:30 UTC
https://gerrit.libreoffice.org/c/core/+/141289
Comment 9 Commit Notification 2022-10-13 14:21:37 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ba42683fada2abafa18a49cd50ce8298b92851c8

tdf#120326: properly prevent Windows from entering power saving

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.