LibreOffice windows and dialogs do not receive focus on startup (KDE, Razorqt)

Bug #1369424 reported by cleary
22
This bug affects 5 people
Affects Status Importance Assigned to Milestone
kde-workspace (Ubuntu)
Invalid
Wishlist

Bug Description

I hope I've got the correct package to log this against.

Symptom:
LibreOffice dialogs (such as password prompts, plaintext/csv imports etc) do not receive WM focus if a LibreOffice app is running and minimised.
This causes a fairly severe usability issue, where it seems like LibreOffice has crashed, since nothing seems to happen when you click (and continue to click) to open a file that requires user action on a dialog.

I've replicated the issue in KDE and RazorQT which is why I'm logging it against this qt-x11 package.

It affects 12.04 and 14.04 (tested, I imagine there are more)

The issue does not occur in Unity or Gnome.

I made two videos - based on:

Ubuntu 12.04, bog standard install. Add kde via:
  sudo apt-get install kubuntu-desktop

add this ppa: https://launchpad.net/~libreoffice/+archive/ubuntu/libreoffice-4-3
upgrade all libreoffice packages to 4.3.0.4:
  sudo apt-get install $(dpkg -l | grep libreoffice | awk '{print $2}')

Video 1: Unity Desktop, expected (correct) behaviour
https://drive.google.com/file/d/0BxhtBAYzjZj5V1V1NjRTRVRKZ0E/edit?usp=sharing

Video 2: Logged out of Unity, logged into KDE Desktop - unexpected behaviour, as described by this bug:
https://drive.google.com/file/d/0BxhtBAYzjZj5ODZ2RG1GZHZtUEE/edit?usp=sharing

Revision history for this message
cleary (bernard-gray) wrote :

This also affects 14.10, just did a check on utopic nightly build

tags: added: 14.10
tags: added: kubuntu
tags: added: utopic
removed: 14.10
Revision history for this message
cleary (bernard-gray) wrote :

I've logged this with the QT Bugtracker as well:
https://bugreports.qt-project.org/browse/QTBUG-41604

Revision history for this message
In , cleary (bernard-gray) wrote :

Symptom:
LibreOffice dialogs (such as password prompts, plaintext/csv imports etc) are not made visible if a LibreOffice app is running and minimised - it uses the minimised window as a parent, but does not raise the window to make it visible.

This causes a fairly severe usability issue, where it seems like LibreOffice has crashed, since nothing seems to happen when you click (and continue to click) to open a file that requires user action on a dialog.

I've replicated the issue in KDE and RazorQT which both use the kde-window-manager

I've tested the following:
Ubuntu 12.04/14.04/14.10 alpha
Debian unstable: with kwin 4.11.12

The issue does not occur in Unity or Gnome.

I made two videos - based on:

Ubuntu 12.04, bog standard install. Add kde via:
  sudo apt-get install kubuntu-desktop

add this ppa: https://launchpad.net/~libreoffice/+archive/ubuntu/libreoffice-4-3
upgrade all libreoffice packages to 4.3.x:
  sudo apt-get install $(dpkg -l | grep libreoffice | awk '{print $2}')

Video 1: Unity Desktop, expected (correct) behaviour
https://drive.google.com/file/d/0BxhtBAYzjZj5V1V1NjRTRVRKZ0E/edit?usp=sharing

Video 2: Logged out of Unity, logged into KDE Desktop - unexpected behaviour, as described by this bug:
https://drive.google.com/file/d/0BxhtBAYzjZj5ODZ2RG1GZHZtUEE/edit?usp=sharing

I've had a bit of trouble finding what to log this against, so there are a couple of related bugs floating around other trackers. I was helped in this (the right?) direction by kde-pepo in the #qt-labs channel, so I'll try and get the others cleaned up and pointing here.

On a side note, this is currently a showstopper for a rollout of ~200 desktops. I'm happy to consider a bounty style encouragement bonus, as a kde donation or otherwise if that will assist in getting the problem solved quickly.

Thanks,
Bernard Gray

Reproducible: Always

Steps to Reproduce:
1. Create a csv file, save it somewhere in the filesystem, close it
2. Open Libreoffice writer window, minimise it
3. Using a file browser, open the saved csv file

Actual Results:
The text import dialog is attached to the minimised Writer window which becomes it's parent, but the Writer window stays minimised with no particular visual clue that anything is happening or waiting for input.

Video:
https://drive.google.com/file/d/0BxhtBAYzjZj5ODZ2RG1GZHZtUEE/edit?usp=sharing

Expected Results:
Video:
https://drive.google.com/file/d/0BxhtBAYzjZj5V1V1NjRTRVRKZ0E/edit?usp=sharing

Revision history for this message
In , Christoph-maxiom (christoph-maxiom) wrote :

Created attachment 88932
Sample CSV file from Wikipedia

cleary (bernard-gray)
affects: kde-baseapps → kde-workspace (Ubuntu)
no longer affects: qt4-x11 (Ubuntu)
Revision history for this message
In , Christoph-maxiom (christoph-maxiom) wrote :

Reproducible with 4.14.1 and LibreOffice 4.3.2.2.

When right-clicking the file, use "Open With > LibreOffice Calc", not Writer.

LibreOffice "demands attention", though, at least the panel unhides. It looks like Unity catches the new dialog on the minimized window, and forces a restore. Should be solvable with a KWin script, e.g.

    workspace.clientAdded.connect(function(client) {
      client.minimized = false;
    });

Bernard, to test KWin scripts, type this in Konsole:

    qdbus org.kde.plasma-desktop /MainApplication showInteractiveKWinConsole

Then an Editor/Output window appears. Paste the above 3-line script there, and click "Execute". Then try to reproduce again.

Thomas might provide an improved and installable version.

Changed in kde-workspace (Ubuntu):
importance: Unknown → High
status: Unknown → New
Revision history for this message
In , cleary (bernard-gray) wrote :

(In reply to Christoph Feck from comment #2)
> Reproducible with 4.14.1 and LibreOffice 4.3.2.2.
>
> When right-clicking the file, use "Open With > LibreOffice Calc", not Writer.
>
> LibreOffice "demands attention", though, at least the panel unhides. It
> looks like Unity catches the new dialog on the minimized window, and forces
> a restore. Should be solvable with a KWin script, e.g.
>
> workspace.clientAdded.connect(function(client) {
> client.minimized = false;
> });
>
>
> Bernard, to test KWin scripts, type this in Konsole:
>
> qdbus org.kde.plasma-desktop /MainApplication showInteractiveKWinConsole
>
> Then an Editor/Output window appears. Paste the above 3-line script there,
> and click "Execute". Then try to reproduce again.

Tested and confirmed that workaround fixes the bug

This also seems to work around the issue where opening new libreoffice program windows would open in the background/minimised.

> Thomas might provide an improved and installable version.

Fantastic news - thanks for the unbelievably quick response :)

Revision history for this message
In , Thomas-luebking (thomas-luebking) wrote :

The behavior is deliberate (manage.cpp:~465 "// If a dialog is shown for minimized window, minimize it too") and likely intended to prevent the user from interruptions of minimized windows (the WM cannot decide whether this is spontanous or required) until the user moves focus to this window again.

You will also notice that LOo does not unminimize nor (attempt) to gain focus if you open a *.ods (which does not require a conversion dialog)

More interestingly, though the dialog is initially modal for the present window, it opens a new window with the csv (here at least), ie. the transiency and modality seems questionable in the first place.

-----

My suggestion would thus be to rather "fix" the "libreoffice" script to either map/raise/activate the mainwindow when opening a new document?

Something like

if [ -e "$2" ]; then
   wmctrl -x -a libreoffice
fi

on the head of /usr/lib/libreoffice/program/soffice ?

Revision history for this message
In , Thomas-luebking (thomas-luebking) wrote :

For general discussion on the topic of modal dialogs aligning to the mapping state of their leader, please see bug #339635

Revision history for this message
In , Mgraesslin (mgraesslin) wrote :

given that the window is marked as demands attention I consider this as the expected behavior.

Revision history for this message
In , cleary (bernard-gray) wrote :

Thanks for the detailed replies folks, at the very least I have the option of implementing some of my own patches for now if required -

Changed in kde-workspace (Ubuntu):
importance: High → Wishlist
status: New → Invalid
Revision history for this message
In , cleary (bernard-gray) wrote :

Once again, thanks for the quick follow up and various detailed workarounds. I've implemented a kwin script for now.
I've also arranged a donation to the KDE e.V. (to say thanks another way!)

Revision history for this message
In , Thomas-luebking (thomas-luebking) wrote :

http://kde-look.org/content/show.php?content=167372

The script only applies to transient dialogs and unminimizes the main window as well to ensure context.

Revision history for this message
In , Murz (murznn) wrote :

> The script only applies to transient dialogs and unminimizes the main window as well to ensure context.
Thanks, but can you describe more, this script solve problem with losted focus or only minimize problem?

Revision history for this message
Murz (murznn) wrote :

Maybe we can create workaround for libreoffice dialog windows that lost focus in KDE when showing via KWin Window Rules?

I have found how to detect libreoffice dialog windows:
Window class: Substring Match - libreoffice
Window types: Dialogue Window
Screenshot: http://i.imgur.com/w7NPSjm.png

And setup in Appearance & Fixes:

Focus stealing prevention: Force - None
Screenshot: http://i.imgur.com/XqXrPr0.png

but this is not work as described here: https://userbase.kde.org/KWin_Rules_Examples#Force_a_Window_to_the_Top

Maybe some other options must me changed? Can anybody describe why this option not work?

Revision history for this message
cleary (bernard-gray) wrote :

@Murz - you'll get better service/info if you reply directly to the KDE thread instead of here - I'm afraid I'm simply being guided by the guys replying there.

> Thanks, but can you describe more, this script solve problem with losted
> focus or only minimize problem?

For me, it only minimised the problem, it did not solve it completely

Revision history for this message
In , Murz (murznn) wrote :

Thomas Lübking, thanks for the script, but it not solve this issue fully.
Maybe we can extend it via auto move focus to any new LibreOffice window created? Is there any hooks for this event in kwin?

Revision history for this message
In , Thomas-luebking (thomas-luebking) wrote :

(In reply to Murz from comment #10)
> Maybe we can extend it via auto move focus to any new LibreOffice window
> created?

To get an idea what you're talking about: do you rather encounter bug #340915 ? (being -likely- https://bugs.documentfoundation.org/show_bug.cgi?id=75471)
The issue overthere is not about dialogs for minimized windows, but for libreoffice _actively_ denying to take the focus.

Revision history for this message
In , Murz (murznn) wrote :

Thomas Lübking, thanks for the link, I talking about https://bugs.kde.org/show_bug.cgi?id=340915 issue, so I will go into it :)

Revision history for this message
In , Dolgener-k (dolgener-k) wrote :

Quite unsurprisingly, the three liner from comment 2 as well as the script http://kde-look.org/content/show.php?content=167372 won't work on Plasma 5, giving
 "Error: ReferenceError: Can't find variable: workspace at line 16"

However, Libre Office's dialogs that do not get focus is really PITA even on Plasma 6 ,-)
Can anyone present an updated version here?

Revision history for this message
In , Thomas-luebking (thomas-luebking) wrote :

The script API didn't change (for KWin 5, no promises for 6 =) and the stock scripts "of course" access the workspace object.

How did you install the script, does it show up in "kcmshell5 kwinscripts" and is it present in ~/.local/share/kwin/scripts/ ?

Did you verify the warning is from the kwin_x11 process and you didn't perhaps install the script to plasmashell (the desktop) - what will of course not work?

Revision history for this message
In , Dolgener-k (dolgener-k) wrote :

You are right, my mistake was to overlook the choice between "Plasma" and "KWin" that has to be made close to the upper right corner of editor's toolbar. It defaults to "Plasma", and hence the script failed.
After choosing "KWin" it works on Plasma 5, too.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.