Bug 426613 - Middle click on sidebar tab bar unloads the document. Nice, but—wrong tab bar
Summary: Middle click on sidebar tab bar unloads the document. Nice, but—wrong tab bar
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 1.11.1
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-16 15:02 UTC by Laura David Hurka
Modified: 2020-10-27 12:22 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 1.11.3
Sentry Crash Report:


Attachments
Manually shown tab bar (14.80 KB, image/png)
2020-09-19 15:30 UTC, Laura David Hurka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laura David Hurka 2020-09-16 15:02:27 UTC
SUMMARY
Okular recently got the feature to close tabs by middle click. However, this also happens on the sidebar tab bar.

STEPS TO REPRODUCE
1. Open a document
2. Middle-click on Thumbnails tab

OBSERVED RESULT
Document vanishes

EXPECTED RESULT
Nothing

SOFTWARE/OS VERSIONS
KDE Neon 5.19
KDE Plasma Version: 5.74.0
Qt Version: 5.14.2
Comment 1 Nate Graham 2020-09-18 21:08:59 UTC
Hmm, cannot reproduce.
Comment 2 Laura David Hurka 2020-09-19 15:30:29 UTC
Created attachment 131778 [details]
Manually shown tab bar

I debugged it for you: Shell::eventFilter() listens to event of the whole main widget, and then tries to get the tab under the event.

In the screenshot we see the tab bar after manually invoking show(). Mouse events on the sidebar tab bar happen to match the position of the hidden tab.

This bug was not visible in older versions, because there was no tab bar, but the line edit, which accepts middle clicks.

A simple and clean solution is to make Shell::eventFilter() listen to the actual tab bar (not the tab widget), because that can’t promote events when it is hidden. Another clean solution is to make the tab bar process middle clicks itself.
Comment 3 Laura David Hurka 2020-09-19 15:32:20 UTC
And of course remove the Q_UNUSED()...
Comment 4 Nate Graham 2020-09-21 04:28:42 UTC
Good sleuthing!
Comment 5 Bug Janitor Service 2020-10-26 23:37:49 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/304
Comment 6 Albert Astals Cid 2020-10-27 11:46:57 UTC
Git commit 924a5fb9fcb23a88d3b18bfd3c64f6102a482b88 by Albert Astals Cid.
Committed on 26/10/2020 at 23:36.
Pushed by aacid into branch 'release/20.08'.

Fix middle click on sidebar tab bar unloads the document.

Filter the exact widget we care about for middle mouse buttons

M  +2    -4    shell/shell.cpp

https://invent.kde.org/graphics/okular/commit/924a5fb9fcb23a88d3b18bfd3c64f6102a482b88