Summary: | Window operations menu desktop selection menu closes when clicking a desktop checkbox | ||
---|---|---|---|
Product: | [Plasma] kwin | Reporter: | Oded Arbel <oded> |
Component: | platform-wayland-nested | Assignee: | KWin default assignee <kwin-bugs-null> |
Status: | REPORTED --- | ||
Severity: | normal | CC: | azrdev, nate |
Priority: | NOR | Keywords: | usability |
Version: | git master | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
See Also: | https://bugs.kde.org/show_bug.cgi?id=438198 | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | screencast showing a possible fix |
Description
Oded Arbel
2021-06-07 10:01:03 UTC
This is a core behavior of QMenu from Qt which cannot be changed by us. The real solution is probably to just fix Bug 438198. :) (In reply to Nate Graham from comment #1) > This is a core behavior of QMenu from Qt which cannot be changed by us. The > real solution is probably to just fix Bug 438198. :) This assertion doesn't seem to be correct. For once, QAction::triggered() documentation - https://doc.qt.io/qt-5/qaction.html#triggered - notes that triggered() is not emitted by toggle(). But also notably, kwin's relevant code - here: https://invent.kde.org/odeda/kwin/-/blob/770875a76e662a1ed7728da769f8f7d019623701/src/useractions.cpp#L585 - connects the checkbox's clicked() signal to the QAction:triggered() slot. It didn't have to do that - that signal can be connected to something in UserActionsMenu that understands that a checkbox was clicked and not trigger the QAction. Created attachment 139877 [details]
screencast showing a possible fix
Here's a hack I've done on the activities menu (I'm currently on X11 so I have radio buttons for virtual desktops, but the code is kind of the same on activities, so I messed with that):
I replaced the connect() call in activityPopupAboutToShow() with the following code:
connect(box, &QCheckBox::clicked, [this,action](bool checked){ Q_UNUSED(checked); this->slotToggleOnActivity(action); });
and the result can be seen in the animation - the checkboxes can be toggled without closing the menu.
Interesting! I had no idea. Can you submit that as a MR that I and others can test and review? (In reply to Nate Graham from comment #4) > Can you submit that as a MR that I and others can test and review? Its probably not a good idea - the behavior is not great (it goes back to how it used to be in the past where if you unchecked the current activity, the window would disappear from the screen while the menu is still visible) and the rest of the code is a bit of a mess (actually, I lied - the line I've shown is not the only line to be changed - a couple of things need to be moved around, though once you try to use that code you'd see immediately for yourself). When I find a bit more time (I'm kind of busy over my head with other tasks atm), I'll make a clean patch that tries to address the "unchecking yourself" edge case. |