Fix krunner's alt+f2 on wayland
ClosedPublic

Authored by apol on Jan 30 2018, 11:57 PM.

Details

Summary

Don't go through the workaround introduced for X11 that makes it go mental.

BUG: 385693

Test Plan

Have been a happy krunner user since

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
apol created this revision.Jan 30 2018, 11:57 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJan 30 2018, 11:57 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
apol requested review of this revision.Jan 30 2018, 11:57 PM
davidedmundson added inline comments.
krunner/view.cpp
202–203

This code here is definitely not designed for X11

apol updated this revision to Diff 26232.Jan 31 2018, 12:14 AM

Remove code

davidedmundson accepted this revision.Jan 31 2018, 12:21 AM

For context, krunner inherits from Dialog.
Dialog does all this stuff. Duplicating it here is wrong.

Must have been ported first or something.

krunner/view.cpp
196–203

This relates to the QXcbWindow comment that you removed, can you leave it.

(I /think/ you can remove this code, it relates to David Rosca's patch that landed ages ago. Check first though)

This revision is now accepted and ready to land.Jan 31 2018, 12:21 AM
apol updated this revision to Diff 26233.Jan 31 2018, 12:26 AM

Readd the comment

If somebody can test it on X11, I'd merge to 5.12.

davidedmundson accepted this revision.Jan 31 2018, 12:38 AM
This revision was automatically updated to reflect the committed changes.
broulik added a subscriber: broulik.Feb 2 2018, 4:21 PM
broulik added inline comments.
krunner/view.cpp
246

Don't we still need this somewhere?

I fear this broke some functionality of KRunner. It is important to be a dock window! Otherwise KRunner might not be able to go above fullscreen windows and won't be on all desktops. Also without being a PlasmaSurface the manual positioning cannot work. If it works for you, I fear it is pure chance.

graesslin reopened this revision.Feb 4 2018, 9:04 AM

I just verified with KWin's debug console: KRunner window is now marked as NET::Normal and not as NET::Dock. This is a problem, KRunner needs to be a dock.

This revision is now accepted and ready to land.Feb 4 2018, 9:04 AM
apol added a comment.Feb 6 2018, 1:38 AM

I fear this broke some functionality of KRunner. It is important to be a dock window! Otherwise KRunner might not be able to go above fullscreen windows and won't be on all desktops. Also without being a PlasmaSurface the manual positioning cannot work. If it works for you, I fear it is pure chance.

Please read before freaking out. As David pointed out the surface code is already part of its parent class.

In D10197#201733, @apol wrote:

I fear this broke some functionality of KRunner. It is important to be a dock window! Otherwise KRunner might not be able to go above fullscreen windows and won't be on all desktops. Also without being a PlasmaSurface the manual positioning cannot work. If it works for you, I fear it is pure chance.

Please read before freaking out. As David pointed out the surface code is already part of its parent class.

No it is not. The parent class doesn't support docks - I checked.

I really think this needs to be reverted. Krunner must be a dock, it must be set to windows go below and it must take focus. This is all functionality not provided by Plasma::Dialog. Just removing the code doesn't work unfortunately.

I have a hard time understanding what the actual problem was. For me KRunner was always working. The change says it's about workarounds for X11, but that doesn't match the change as everything what's red is Wayland only. Can someone elaborate on what the actual problem was which this change was trying to address.

apol added a comment.Feb 6 2018, 4:46 PM

Feel free to revert and reopen the bug:
https://bugs.kde.org/show_bug.cgi?id=385693

The old code is clearly wrong.

It calls Dialog::event(event);

that will set up a shellsurface in the expose event
Then we process further and set up a shell surface in the expose event

PlasmaShellSurfaces are shared, but you still have two objects handling the move event simultaneously, and worst still

} else if (event->type() == QEvent::Hide) {

delete m_plasmaShellSurface;

is just screaming out for a crash as dialog is sharing that same object. We're just being very lucky at the moment.

I wouldn't want to see this reverted as-is.

But clearly we need the setRole and the setPanelTakesFocus. I missed that in my review.
That could mean just adding an if(Dock) in Dialog.cpp , only setting those parts in ExposeEvent here, or adding an extra virtual to configure dialog somehow.

As the commit went into the 5.12 branch we cannot build up on any functionality not yet available in Dialog.

To ensure we don't forget about it I created: https://bugs.kde.org/show_bug.cgi?id=389964

apol closed this revision.Feb 20 2018, 2:35 PM
meven added a subscriber: meven.May 16 2020, 8:47 AM
meven added inline comments.
krunner/view.cpp
247

And this too, it causes https://bugs.kde.org/show_bug.cgi?id=389964
KRunner appears behind keep above windows.