Bug Hunting Session
Bug 96011 - Document is not focused on opening LO / opening existing documents
Summary: Document is not focused on opening LO / opening existing documents
Status: RESOLVED DUPLICATE of bug 75471
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.0.3.2 release
Hardware: x86 (IA32) Windows (All)
: medium minor
Assignee: Not Assigned
URL:
Whiteboard: target:5.4.0
Keywords:
: 96107 96843 100906 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-11-23 13:58 UTC by eBatch
Modified: 2018-01-27 21:17 UTC (History)
11 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 eBatch 2015-11-23 13:58:26 UTC
Using LO 5.0.3.2 / Windows 7 32 bit

Various issues arise with either (what should be) the current active LO window not being in focus OR the LO window is in focus, but the "just opened" document not being in focus within the window. These issues seem to go away when the Sidebar is open AND undocked, but not when the Sidebar is closed or when it is open AND docked.

For example, with Sidebar closed or with Sidebar open AND docked:

 * Launching LO Writer(by clicking LO Writer shortcut and opening default New Document) - works OK
 * Opening existing document (by double click in Windows Explorer) - works OK
 * Opening second (and subsequent) existing document(s) (e.g. by double click in Windows Explorer) - LO Window not in focus (when it should be).
  NOTE: first existing document is only OK if previously opened default New Document is left blank, else LO Window is not in focus when the first existing document is opened.

Also:
 - Launching LO Writer(by double clicking an existing document)  - works OK
 - Opening subsequent existing document(s) (by double click in Windows Explorer) - LO Window (for subsequent document) not in focus.


In the above examples, where the LO window is not in focus (when it should be) focus remains with the Windows Explorer window (or wherever the subsequent document was launched from).

All the above have been proven with LO Writer (using both .odt and .doc files). Have not thoroughly tested with Calc, but certainly similar effects are apparent with LO Calc.

Was previously using LO 4.1.6.2 / 4.1.5.3 and so these issues could not exist (no sidebar?).
Comment 1 eBatch 2015-11-23 15:27:34 UTC
Further clarification:

I previously said "Launching LO Writer(by clicking LO Writer shortcut and opening default New Document) - works OK"

This should read "Launching LO Writer(by clicking LO Writer shortcut and opening default New Document) - works OK when Sidebar closed. When Sidebar open AND docked, the LO Writer window opens and gets focus, but the new document does not get focus."

I'm guessing that (in the various at fault scenarios) the Sidebar is grabbing focus when it is closed (but maybe, in reality, still active in the background). Whereas when it is open AND undocked, being a separate pane it (somehow) does not grab focus (i.e. focus is in the main LO window and so focus remains on the latest document).
Comment 2 eBatch 2015-11-23 17:58:19 UTC
Thinking about it, that "guess" in the last para of my previous post doesn't stack up as the focus stays with the application, such as Windows Explorer, which is used to launch a document (when focus should transfer to LO Writer).
Comment 3 Buovjaga 2015-11-27 19:00:55 UTC
Reproduced.

Win 7 Pro 64-bit, Version: 5.0.3.2 (x64)
Build ID: e5f16313668ac592c1bfb310f4390624e3dbfb75
Locale: fi-FI (fi_FI)
Comment 4 Buovjaga 2015-11-30 08:34:48 UTC
It is really not about the sidebar. No difference for me even if the sidebar is completely closed. Adjusting summary.
Comment 5 Buovjaga 2015-11-30 08:34:58 UTC
*** Bug 96107 has been marked as a duplicate of this bug. ***
Comment 6 eBatch 2015-12-12 16:49:03 UTC
NEW INFORMATION
===============

Having experimented more with this (on on 3 PCS [2 x Win7HP + 1 x XP_Home] all using LO 5.0.3.2) I have consistently found the following when launching LO Writer (by clicking on LO Writer shortcut):

1. Without the Sidebar enabled (at launch), the size of the LO Window (at launch) relative to the widest toolbar affects whether the blank document receives focus. If the window is narrow enough to cause the widest toolbar to be truncated such that the right pointing chevrons icon is enforced at the right of the toolbar then the blank document does not receive focus. If the window is wide enough such that no toolbars are truncated then the blank document does receive focus.

2. With the sidebar enabled and docked (whether hidden or not), the blank document does not receive focus.

3. With the sidebar undocked the blank document does receive focus (except where the issue described in 1.above arises - as that takes precedence).

4. On opening further pre-existing documents (by clicking the documents in, say, Windows Explorer), LO itself does not even get focus, let alone the document within LO.

However, when launching LO Writer by opening a pre-existing document (by clicking the document in, say, Windows Explorer), the document always gets focus. But opening subsequent documents in the same way, the same as 4. above occurs.
Comment 7 Buovjaga 2016-01-04 10:56:27 UTC
*** Bug 96843 has been marked as a duplicate of this bug. ***
Comment 8 Óvári 2016-01-04 21:05:49 UTC
Added owner of bug 96843
Comment 9 Carsten Gehling 2016-02-22 12:30:43 UTC
I can confirm this bug on Windows 8.1, 

LibreOffice Version: 5.0.4.2
Build ID: 2b9802c1994aa0b7dc6079e128979269cf95bc78
Locale: da-DK (da_DK)

The behaviour is the same no matter what I do to the sidebar.

If a LibreOffice Writer document is already open, then whenever I doubleclick on a document in File Explorer (or through other "Shell Start" WinApi functions) the new document is opened but do not receive focus.
Comment 10 eBatch 2016-03-08 12:23:09 UTC
Having installed LO 5.0.5.2, whilst not having gone through all of the tests I reported on on 2015-12-12 16:49:03 UTC, I can see that the same fundamental issues still exist.
Comment 11 Mark Hung 2016-04-11 11:26:29 UTC
Is this a duplicate of tdf#48300?
Comment 12 Buovjaga 2016-04-12 11:26:45 UTC
(In reply to Mark Hung from comment #11)
> Is this a duplicate of tdf#48300?

bug 48300

I think your fix was in the build I tested (based on build time), but this issue still exists:

When Sidebar open AND docked, the LO Writer window opens and gets focus, but the new document does not get focus."

Key: "New document"

Opening documents seem to always give focus now - only the new document problem remains.

Win 7 Pro 64-bit Version: 5.2.0.0.alpha0+
Build ID: b0e678c86136ef6d65cea66168a99217664c0278
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2016-04-11_23:06:28
Locale: fi-FI (fi_FI)
Comment 13 Buovjaga 2016-07-18 09:06:47 UTC
*** Bug 100906 has been marked as a duplicate of this bug. ***
Comment 14 billy78 2016-10-15 11:11:17 UTC
It happens to me too in many occasions. I use Windows 7 SP1 and while I have no document open, if I go to Windows Explorer and double-click a file, it opens behind Windows Explorer and I have to click the icon in the taskbar to bring it in the front and it is very annoying.
Comment 15 Clint 2016-10-28 03:02:35 UTC
This bug has plagued me for a long time. As a workaround for Windows, I worked up a script for AutoHotkey that automatically brings the window to the foreground. Might not work for everyone, but I put it here to help those that it can help. You'll have to download and install Autohotkey from their website and save the script below.

*******Save the lines below as libreoffice.ahk*******
#Persistent
Gui +LastFound
hWnd := WinExist()

DllCall( "RegisterShellHookWindow", UInt,hWnd )
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )
Return

ShellMessage( wParam,lParam ) {
  Local k
  If ( wParam = 1 ) ;  HSHELL_WINDOWCREATED := 1
     {
       NewID := lParam
       WinGetClass, Class, ahk_id %NewID%
       If ( Class = "SALFRAME" )
          {
            WinActivateBottom, ahk_id %NewID%

          }
     }
}
Comment 16 Samuel Mehrbrodt (CIB) 2017-01-13 13:58:23 UTC
This probably is a duplicate of bug 75471.

*** This bug has been marked as a duplicate of bug 75471 ***
Comment 17 Commit Notification 2017-01-13 14:37:17 UTC
Samuel Mehrbrodt committed a patch related to this issue.
It has been pushed to "master":

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

tdf#96011 Document is not focused when opening a second window

It will be available in 5.4.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 18 John Marchi 2018-01-25 18:37:03 UTC
Upgraded to 5.4.4 today. Opened a .xls document with Calc. Calc opened the "Import Options" window behind other windows.
Comment 19 Buovjaga 2018-01-26 13:32:47 UTC
(In reply to John Marchi from comment #18)
> Upgraded to 5.4.4 today. Opened a .xls document with Calc. Calc opened the
> "Import Options" window behind other windows.

On Windows, Linux or Mac? Not sure, if the import options window is related to this one.

Import options is known to be a bit unruly: bug 95630
Comment 20 John Marchi 2018-01-26 13:55:58 UTC
The Import Options window issue is with Windows 8.1.
Comment 21 mattreecebentley 2018-01-26 23:22:17 UTC
I'm on Win7 and this is still the case with latest stable version of Libreoffice - NOT Fixed

Process -
open excel document from explorer by double-clicking. Import options shows up fine.
Open second excel document from explorer. Import options do not show up until you click on the libreoffice window.
Comment 22 Buovjaga 2018-01-27 08:36:57 UTC
This report is not about the Import Options dialog. Please read the description by eBatch and do your testing against it.

Open a new report about the Import Options behaviour.

*** This bug has been marked as a duplicate of bug 75471 ***
Comment 23 Buovjaga 2018-01-27 08:38:42 UTC
In https://bugs.documentfoundation.org/show_bug.cgi?id=75471#c75 bug 49134 was pointed out. It additionally has some interesting "See also" entries.
Comment 24 Buovjaga 2018-01-27 15:46:26 UTC
(In reply to mattreecebentley from comment #21)
> Open second excel document from explorer. Import options do not show up
> until you click on the libreoffice window.

Stuart pointed out this exact match in another report: bug 32935 - CSV import dialog doesn't get focus if libreoffice is already running
You can add yourself to the CC list of the report to stay informed of future developments.
Comment 25 mattreecebentley 2018-01-27 21:17:16 UTC Comment hidden (no-value)