Bug 150773 - Do not bring document to front after user had switched from it to other tasks on loading
Summary: Do not bring document to front after user had switched from it to other tasks...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:7.5.0
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-04 11:43 UTC by Mike Kaganski
Modified: 2024-05-29 06:47 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2022-09-04 11:43:19 UTC
Bringing opened document to front is indeed wanted by most users - see bug 75471.

However, as mentioned in bug 150771, people might find it intrusive that after the loading application was shown in the foreground the first time, and user switched to another task before loading ended, it activates itself another time at the end of the loading process.

To reproduce this unwanted behavior:
1. Download a large document - e.g., Calc 7.4 Guide PDF from https://documentation.libreoffice.org/en/english-documentation/;
2. Right-click on the downloaded PDF, and choose "Open with -> LibreOffice";
3. See that an empty window appears, in which a progress bar at the bottom will show the loading progress;
4. Before the loading finishes, switch to another process (e.g., to an email client), and start typing something there;
5. See that after loading ends, the document gets to foreground automatically, *interrupting your current task*.

This is reproducible at least on Windows with Version: 7.4.1.1 (x64) / LibreOffice Community
Build ID: 0a046a10cbf1679eea5538bd3ab63156caa3a036
CPU threads: 12; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: en-US (ru_RU); UI: en-US
Calc: CL Jumbo

Additionally, setting ForceFocusAndToFront to false does not prevent bringing the document to foreground.

So the wanted behavior would be:

1. If ForceFocusAndToFront is true (the default), it should bring the document window to the foreground (as soon as possible, to give some feedback to user, who otherwise could assume their actions didn't start loading), but only once (do not bring to foreground the second time after loading completes);
2. If ForceFocusAndToFront is false, it should not steal the focus even the first time.

It would still be reasonable to bring dialogs to front during loading, because they indicate that user interaction is required to complete the user-initiated loading process.
Comment 1 Mike Kaganski 2022-09-04 13:00:03 UTC
https://gerrit.libreoffice.org/c/core/+/139362
Comment 2 V Stuart Foote 2022-09-04 16:09:05 UTC
Oh very cool. Seems like the piece needed to finish off work from i99971 to make the 'ForceFocusAndToFront' toggle fully functional.

Thanks Mike!
Comment 3 Commit Notification 2022-09-04 17:45:46 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/42d197ef301db68e56f7e45b6e36ace5fae04b4d

tdf#150773: Avoid bringing loading files to front several times

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.