KCompletionBox: restore proper layering behaviour on Mac
Needs ReviewPublic

Authored by rjvbb on Dec 11 2017, 7:23 PM.

Details

Reviewers
None
Group Reviewers
Frameworks
Summary

This restores proper layering behaviour on Mac, fixing the regression described in the linked bug report (which has screenshots).

BUG: 387796
(https://bugs.kde.org/show_bug.cgi?id=387796)

Test Plan

Changing the window type from Qt::Window to Qt::Dialog was the last tweak I tried and the only one that causes the completion list to display in front of the grandparent window in all known situations on Mac/Cocoa, Mac/X11 and Linux/X11 (even an explicit raise() in the evidently locations had no effect).
It seems thus safe to apply unconditionally, or else with a simple #ifdef Q_OS_MACOS .

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped
rjvbb created this revision.Dec 11 2017, 7:23 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptDec 11 2017, 7:23 PM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript
rjvbb requested review of this revision.Dec 11 2017, 7:23 PM
rjvbb edited the summary of this revision. (Show Details)
rjvbb removed a subscriber: Frameworks.
ltoscano edited the summary of this revision. (Show Details)Dec 11 2017, 7:59 PM
rjvbb added a comment.Dec 11 2017, 8:33 PM

kurlrequestertest_gui on Mac, unpatched frameworks 5.38, Qt 5.8.0:

idem, with this patch:

ping?

Should I just commit this?

anthonyfieroni added inline comments.
src/kcompletionbox.cpp
68

This looks wrong to me, it's not a dialog. Can you try

q->setWindowFlags(q->windowFlags() | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint);

or Qt::Popup | ...
When you test with open completion box minimize or switch window (alt+tab) should dismiss it.

rjvbb added a comment.Dec 15 2017, 3:09 PM

This looks wrong to me, it's not a dialog

But how often is the parent not a dialog?
I don't notice any difference under X11 whether I use Qt::Window or Qt::Dialog, apparently those are effectively equivalent in this situation. But they're clearly not on Mac.

My guess would be that if the parent has some sort of modal character the completion box should have at least that too ... or else it will remain behind the parent.

q->setWindowFlags(q->windowFlags() | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint);

With this the completion box doesn't even appear.

or Qt::Popup | ...

This steals focus (on Mac/Cocoa and even grabs the keyboard under Mac/X11).

Did you try either of your suggestions yourself? It'd be more efficient if you didn't ask me to try all kinds of alternatives that don't work on your end ;)

When you test with open completion box minimize or switch window (alt+tab) should dismiss it.

Esc should too.

In D9289#179901, @rjvbb wrote:

Did you try either of your suggestions yourself? It'd be more efficient if you didn't ask me to try all kinds of alternatives that don't work on your end ;)

No :) I suggest you because you're on.

rjvbb added a comment.Dec 15 2017, 3:57 PM
No :) I suggest you because you're on.

Well, I could test anything but there isn't much point in testing something we already know won't work elsewhere. It's not like I can test multiple systems at once either.