Bug 48300 - UI: Window doesn't take focus when opening an already open document
Summary: UI: Window doesn't take focus when opening an already open document
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) All
: high normal
Assignee: Not Assigned
URL:
Whiteboard: target:6.0.0
Keywords:
: 77518 79025 84666 89776 92167 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-04-04 09:09 UTC by bugtrack
Modified: 2023-08-21 08:21 UTC (History)
22 users (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 bugtrack 2012-04-04 09:09:01 UTC
Problem description: 
When working with many documents open at the same time and want to open a document that is already open by double clicking the file in windows explorer I expect the already opened document to take focus. 


Steps to reproduce:
1. open document "aaa.odt"
2. minimize all windows
3. double click on file "aaa.odt"

Current behavior:
When double clicking on a file in windows explorer that is already open in LibreOffice nothing happends. This can, on a hectic day, lead to a false conclusion, that the file cannot be opened for some reason. This is by the way, the standard behavior by most windows programs.

Expected behavior:
The window with the already opened file should take focus.

Platform (if different from the browser):               
Browser: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:14.0) Gecko/20120403 Firefox/14.0a1
Comment 1 bfoman (inactive) 2012-08-31 09:06:17 UTC
Confirmed with:
LO 3.5.6.2 
Build ID: own W7 debug build
Windows 7 Professional SP1 64 bit
Comment 2 Maxim Monastirsky 2014-02-25 10:31:37 UTC
*** Bug 75471 has been marked as a duplicate of this bug. ***
Comment 3 Maxim Monastirsky 2014-04-16 12:28:33 UTC
*** Bug 77518 has been marked as a duplicate of this bug. ***
Comment 4 tommy27 2014-05-06 12:33:41 UTC
still reproducible under Win7x64 with LibO 4.2.3.3

what about Linux and MacOS? is situation different?
Comment 5 tommy27 2014-05-07 12:55:04 UTC
a s an additional information an user from the italian AOO/OOo/LibO newsgroup told me that AOO has the same issue.

I suspect this bug is "inherited from OOo"
Comment 6 Maxim Monastirsky 2014-05-21 19:48:17 UTC
*** Bug 79025 has been marked as a duplicate of this bug. ***
Comment 7 Mikeyy - L10n HR 2014-06-19 12:48:16 UTC
Can you please re-test this since when testing on 4.2.5.2 it seams to behave as bug reporter wanted to behave.
Comment 8 Mikeyy - L10n HR 2014-06-19 13:01:18 UTC
Sorry, it's not fixed. I didn't test with minimised windows, only with few already opened spredsheets and it always bring one I double open in foreground.
But it only works if calc windows aren't minimised.
Comment 9 d.krause 2014-08-14 07:20:44 UTC
Any news about this bug? It happens here as well and really disturbs when working with multiple documents.

Plattform: Windows 8 64 bit, LO 4.2.5.2 (older versions as well...)
Comment 10 tommy27 2014-08-16 12:53:29 UTC
no news about it. still present in 4.3.0.4 release as well.
Comment 11 John 2014-10-02 09:32:52 UTC
Still present in 4.3.1.2
Comment 12 tommy27 2014-10-02 09:42:24 UTC
@John 
please do not change version field.
it must indicate earlier version the bug has been seen, not latest.
i reverted your change.
Comment 13 Luuk 2015-02-28 09:31:34 UTC
Besides the 'expected behaviour' reported:
The window with the already opened file should take focus.

LibreOffice should not only get focus, but also restore window from minimized to the previous size.
Comment 14 Jean-Baptiste Faure 2015-02-28 18:09:35 UTC
(In reply to tommy27 from comment #4)
> still reproducible under Win7x64 with LibO 4.2.3.3
> 
> what about Linux and MacOS? is situation different?

LibreOffice 4.4.2.0.0+ works as expected for me under Ubuntu 14.10 x86-64

Best regards. JBF
Comment 15 tommy27 2015-02-28 20:54:07 UTC
yes, Windows only bug.
still present in 4.4.1.2 under Win8x64
Comment 16 Luca 2015-03-01 13:08:39 UTC
*** Bug 75471 has been marked as a duplicate of this bug. ***
Comment 17 Buovjaga 2015-03-04 18:48:31 UTC
*** Bug 89776 has been marked as a duplicate of this bug. ***
Comment 18 tommy27 2015-03-07 08:32:51 UTC
what would be interesting to know if such behaviour was also present in earlier LibO release (3.3.x and 3.4.x series) and OOo/AOO as well.

actually the first report is about 3.5.1
was that a 3.5.x regression or it has always been like that?
Comment 19 Mikeyy - L10n HR 2015-03-07 12:55:27 UTC
There a 2 bugs here, but QA keeps marking everything as duplicate of this bug.

1. Bug = this bug 48300 = minimize bug
2. Bug = bug 79025 = bug 89776 = partly bug 75471 = regression, working in LO 4.1, not sure about 4.2
Comment 20 Tobias Leupold 2015-04-06 08:20:06 UTC
I also think there are multiple bugs here. At least, the focus problem described in Bug #75471 (and probably also here?!) also exists here on Gentoo Linux with KDE and is quite annoying.
Comment 21 Tobias Leupold 2015-04-06 08:21:38 UTC
> not sure about 4.2
Oh, I forgot: I see this with 4.3.5.2
Comment 22 Nicolas R 2015-05-07 09:24:04 UTC
And also present in 4.3.7
Comment 23 tommy27 2015-05-10 08:20:31 UTC
as said in comment 18 it is important to know if it has ever worked in older LibO releases like 3.3.x and 3.4.x since first report is about LibO 3.5.1

how does it work in OOo/AOO?
Comment 24 Mikeyy - L10n HR 2015-05-11 10:58:05 UTC
(In reply to tommy27 from comment #23)
> as said in comment 18 it is important to know if it has ever worked in older
> LibO releases like 3.3.x and 3.4.x since first report is about LibO 3.5.1
> 
> how does it work in OOo/AOO?

Yes, 4.1 worked ok and brought newly opened files in foreground/focus.
I skipped 4.2 (didn't not use it), but I think that's first buggy version.
Comment 25 Robert Gonzalez MX 2015-05-24 02:20:20 UTC
*** Bug 84666 has been marked as a duplicate of this bug. ***
Comment 26 Robert Gonzalez MX 2015-05-24 04:15:18 UTC
2015 05 23 New notes.
I think that it is necessary to test all the versions, I will try since 3.6.7.2, but uninstalling all other versions.
To preserve my actual preferences, I saved my user profile from 4.4.3.2 and then perform the process.
Uninstall the registered version, install one version at a time and test.

I suspect that since version 4.2 this is present. In the release notes is stated “Windows are now grouped together by application in the taskbar on Windows 7 and higher (Jesús Corrius). Recent documents list support in the taskbar icon on Windows 7 and higher (Jesús Corrius and Fridrich Štrba)”


Tests on Windows 8
Test with LO 3.6.7.2 behaves normally. The application opens the file with focus

Test with LO 4.0.6.2 behaves normally. The application opens the file with focus. Trying to open the same file being open, returns the focus to the same file. Opening other files from the windows explorer brings each file to focus. Windows 8 groups the files in the taskbar. These feature was introduced on 4.2 for win 7.

Test with LO 4.1.3.2, behaves normally. The application opens the file with focus. Trying to open the same file being open, returns the focus to the same file. Opening other files from the windows explorer brings each file to focus. Windows 8 groups the files in the taskbar. 

Test with LO 4.2.8.2. The first file opened from the windows explorer, opens the application and brings the file (writer) to focus, but opening a second writer file, it opens in the background. Opening a third file (calc) also opens in the background, and when opening a password protected file, the enter password window opens in the background too. So this confirm ( at least on Windows 8) that with this version the problem begins. 

Test with LO 4.3.7.2. The first file (writer) opened from the windows explorer, opens the application and opens the file in the background, doesn't bring the focus to edit the file. Opening a second and third writer files, opens it in the background. Opening a calc file, goes to the background also. When opening a password protected file, the enter password window opens in the background too. Windows 8 groups the window by application correctly. 

Something I noticed is that when using Alt-Tab to change between applications, the list of applications opened begins with the last opened window, but not the Writer file. It seems that when the file is opened is  misplaced in the stack of applications.

Test with LO 4.4.3.2. The first file (writer) opened from the windows explorer, opens the application and opens the file in the background, doesn't bring the focus to edit the file. Opening a second and third writer files, opens it in the background. Opening a calc file, goes to the background also. When opening a password protected file, the enter password window opens in the background too. Windows 8 groups the window by application correctly.

I will need to test in the same way in a windows 7 pc, that I have, but it will be a slow process because is a relative old machine.

I hope this tests being useful.
Comment 27 tommy27 2015-05-24 07:21:26 UTC
Thanks Robert.

the original steps to reproduce from comment 0 are

1. open document "aaa.odt"
2. minimize all windows
3. double click on file "aaa.odt"

regarding your tests, it's not clear to me what happens with 4.2.8.2 when double clicking on an already opened but minimize file.

you said focus is correctly set back to that file in 3.6, 4.0 and 4.1 releases, but what about 4.2.8.2, where you talk about opening other files and not double clicking on the original minimized first file?

would you please try a 3.5 version?
the bug was first reported with 3.5.1 and confirmed with 3.5.6 (comment 1)
and you tell it was working fine in 3.6 to 4.1 releases.

so if all the informations are correct the bug present in 3.5.x disappeared in 3.6 to 4.1 and reappered in 4.2.
Comment 28 Robert Gonzalez MX 2015-05-24 16:49:21 UTC
OK.
Reading slowly from the beginning, I now see what's the initial point to test.

Test with LO 3.3.4.1 on Windows 7 x64
Opening Writer file from the windows explorer with double click opens the application and opens the file with focus to edit.
Minimize window
double click to open again and nothing happens.

So I open the windows task manager and repeated the test:
a new instance of soffice.bin, soffice.exe and swriter.exe opens and then closes, but doesn't bring the file to focus to edit.

I will try with LO 3.3.0
Comment 29 tommy27 2015-05-24 16:58:37 UTC
(In reply to Robert Gonzalez MX from comment #26)
> 
> ...
> 
> Test with LO 4.1.3.2, behaves normally. The application opens the file with
> focus. Trying to open the same file being open, returns the focus to the
> same file. Opening other files from the windows explorer brings each file to
> focus. Windows 8 groups the files in the taskbar. 
> 
> ...

(In reply to Robert Gonzalez MX from comment #28)
> OK.
> Reading slowly from the beginning, I now see what's the initial point to
> test.
> 
> Test with LO 3.3.4.1 on Windows 7 x64
> Opening Writer file from the windows explorer with double click opens the
> application and opens the file with focus to edit.
> Minimize window
> double click to open again and nothing happens.
> 
> 

thanks Robert for your tests.

please clarify this.... according to the quotations above you said
4.1.3.2 behaved normally and 3.3.4 did not. is that correct? 

my suspect is that no LibO version ever worked fine and maybe the issue is inherited from OOo (see my old comment below)

(In reply to tommy27 from comment #5)
> a s an additional information an user from the italian AOO/OOo/LibO
> newsgroup told me that AOO has the same issue.
> 
> I suspect this bug is "inherited from OOo"

so next test would be to install OOo 3.3.0 or any of the AOO releases
Comment 30 Robert Gonzalez MX 2015-05-24 17:08:43 UTC
Test with LO 3.3.0.4 on Windows 7 is the same.

Opening Writer file from the windows explorer with double click opens the application and opens the file with focus to edit.
Minimize window
double click to open again and nothing happens.

Reviewing the windows task manager when doing the test:
A new instance of soffice.bin, soffice.exe and swriter.exe opens and then closes, but doesn't bring the file to focus to edit.

So I believe that is inherited from OO 3.3.

Reviewing the windows task manager in Windows 8 is the same, new instances of soffice.bin, soffice.exe and swriter.exe opens and then closes, but doesn't bring the file to focus to edit.

Also made the same test with MSO Word 2007, and trying to open an already opened file, which is minimized, brings the file to foreground and focus to edit.
Comment 31 Robert Gonzalez MX 2015-05-24 17:37:58 UTC
Clarifying:
I was confused at the beginning about this bug because of another problem that I reported with Bug 84666, and marked as duplicate of this one.

The tests that I have made on Windows 8 yesterday, refers to the problem of opening different files from the windows explorer and not coming to foreground and focus to edit but opening behind the windows explorer window. So I will file another bug about this.

I will try with OOo 3.2 and AOO 4.1
Comment 32 tommy27 2015-05-24 18:14:05 UTC
ok, thanks for clarification.
I set version to LibO 3.3.0 but I strongly suspect this is inherited from OOo
Comment 33 Robert Gonzalez MX 2015-05-24 18:28:41 UTC
I confirm that this problem is present in OOo 3.2.1.9502 and AOO 4.1.1 
I tested it on Windows 7
Comment 34 tommy27 2015-05-24 19:24:15 UTC
so it's inherited from OOo
Comment 35 Carlos Rodriguez 2015-06-28 17:14:07 UTC
*** Bug 92167 has been marked as a duplicate of this bug. ***
Comment 36 paour 2015-07-29 06:23:39 UTC
Hello,
I confirm the same description as Bug 79025 under windows 7 and 8.1 with Libo version 4.3.7, 4.4.4 and 4.4.5.2
Regards
Nicolas
Comment 37 Frederic BOYER 2015-08-28 13:48:50 UTC
Hi, also in  5.0.1.2 (x64) on win 7 x64 pro
Comment 38 s.malacarne 2015-10-07 17:35:25 UTC
The bug is still here in version 5.0.2.2 x64 on windows 10.
Comment 39 Carsten Gehling 2016-02-22 12:47:06 UTC
I can confirm this bug on Windows 8.1, 

LibreOffice Version: 5.0.4.2
Build ID: 2b9802c1994aa0b7dc6079e128979269cf95bc78
Locale: da-DK (da_DK)
Comment 40 Commit Notification 2016-04-11 10:34:29 UTC
Mark Hung committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e9230b2b09a8dc0ea71263a1c321f4f63a222ac9

tdf#48300 bring window to top and restore window when minimized.

It will be available in 5.2.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 41 JSladek 2016-04-16 22:04:07 UTC
This patch appears to be a change to the source files for LO.  I am using LO4.3.3.2 from the Debian repository.  Are or will there be patch instructions for user modification to existing installed versions?
Comment 42 s.malacarne 2016-06-28 14:07:28 UTC
I test on 5.2 RC1
The bug is still there.
if i try to open several calc document they open in the background and they show in reverse order in task switch.
Comment 43 V Stuart Foote 2016-06-28 15:15:42 UTC
(In reply to s.malacarne from comment #42)
> I test on 5.2 RC1
> The bug is still there.
> if i try to open several calc document they open in the background and they
> show in reverse order in task switch.

STR here are:

1. to open a document in Windows Explorer
2.use Explorer and select same document again

Expected: document gets focus in front of Explorer

Result: document gets focus in front of Explorer

True for multiple documents after their initial launch from Explorer shell.


On Windows 10 Pro 64-bit en-US with
Version: 5.2.0.1 (x64)
Build ID: fcbcb4963bda8633ba72bd2108ca1e802aad557d
CPU Threads: 8; OS Version: Windows 6.19; UI Render: GL; 
Locale: en-US (en_US)

The issue from summary behaves correctly. An already open document takes focus.

Resolved Fixed. Residual issues are in bug 75471
Comment 44 Luca 2016-06-29 19:42:26 UTC
This is solved, but the real problem is bug 75471. Still there in 5.2.
Comment 45 Robert Gonzalez MX 2016-06-29 23:42:40 UTC
I confirm that the problem is solved.

Tested with Version: 5.2.0.1
Build ID: fcbcb4963bda8633ba72bd2108ca1e802aad557d
CPU Threads: 8; OS Version: Windows 6.2; UI Render: default; 
Locale: es-MX (es_MX)on Windows 10
Comment 46 Gitsy 2017-03-29 18:54:31 UTC
The bug is still present in 5.3.1.2
Comment 47 Commit Notification 2017-11-10 09:46:46 UTC
Katarina Behrens committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=bb6a8dce405bd0fcd551c217c05a503e559dbf4d

tdf#48300 kde4+gen: bring forward the window with already opened doc

It will be available in 6.0.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 48 Jean-Baptiste Faure 2017-11-11 12:36:19 UTC
Status WontFix is wrong.
That said it does not work for me under Ubuntu/Unity with LO 5.4 from Ubuntu PPA.
On step 3 from steps to reproduce, I get a notification from Unity dock (icon moving) but the window is not restored.
If I do the same test with a plain text and text editor gedit, the window is restored. So the problem seems to be on LO side, not on Unity side.

According to these test and the commit in comment #47, I set the status to reopened and OS to all.

Best regards. JBF
Comment 49 Katarina Behrens (Inactive) 2018-03-23 12:18:35 UTC
(In reply to Jean-Baptiste Faure from comment #48)
> Status WontFix is wrong.
> That said it does not work for me under Ubuntu/Unity with LO 5.4 from Ubuntu
> PPA.

> According to these test and the commit in comment #47, I set the status to
> reopened and OS to all.

Uhm, I don't understand why is this bug reopened (or new). Is the fix not working as expected? 

Of course it still happens in 5.4 because I only fixed it for 6.0 and wasn't asked to backport.

*confused* 

QA is hard, let's go shopping
Comment 50 Jean-Baptiste Faure 2018-03-31 07:59:18 UTC
(In reply to Katarina Behrens (CIB) from comment #49)
> [...]
> Uhm, I don't understand why is this bug reopened (or new). Is the fix not
> working as expected? 
> 
Because there is a target 5.2. I see two options:
1/remove the target 5.2 and close the bug report as fixed
2/change the target to 5.4 and backport the fix to 5.4

That said my comment #47 applies to LO 6.0 (Ubuntu & Unity 16.04). I do not know how it works with other desktop managers.

Best regards. JBF
Comment 51 V Stuart Foote 2018-03-31 08:16:44 UTC
Option 2, Whiteboard adjusted...
=> Fixed at 6.0
Comment 52 Katarina Behrens (Inactive) 2018-04-04 12:45:56 UTC
> 2/change the target to 5.4 and backport the fix to 5.4

Nay, backport is a bad idea, the bugfix caused regression
Comment 53 V Stuart Foote 2018-04-04 13:53:15 UTC
+1, target 5.2 removed and fixed at 6.0.0 (which was option 1 not 2).