Add toggle signal for applet de-/activation in order to fix non-closing launchers on Meta (and also on Active Screenedges)
Review Request #129204 - Created Oct. 17, 2016 and submitted
The new Meta-key support for launcher opening doesn't work for closing at the moment. My analysis of the problem was as follows:
- KWin calls Applet::activated() over DBus
- Applet::activated() is connected to AppletInterface::activated()
- AppletInterface::activated() is connected to setExpanded(true), which can only expand the launcher, but not the other way around
Q: Why is Alt+F1 working though?
A: The launchers seem to inherit the reimplemented function Dialog::focusOutEvent(..). Atleast when you delete line 1094 in dialog.cpp, which sets the visibility to false, it's not working anymore. Alt+F1 triggers the focusOutEvent(..) as a global shortcut.
Q: Why is it working with the Dashboard though?
A: The dashboard doesn't use the expanded feature of the plasmoid, but rather connects directly to the AppletInterface::activated() signal and shows/hides an independent widget when this signal gets triggered.
Create new toggled() signal chain in KWin, Applet, AppletInterface, which tests the current expanded state and sets it afterwards accordingly to the opposite. This diff here in plasma-framework is the first one, which the others depend on. The others are on Phabricator:
- kwin: https://phabricator.kde.org/D3077
- plasma-workspace: https://phabricator.kde.org/D3078
- plasma-desktop: https://phabricator.kde.org/D3079
Need feedback regarding:
- Should we remove the activated() signal chain? Is it used somewhere else than KWin?
- Could a race condition occur if we deexpand the applet while at the same time setting the visibility to false through focusOutEvent()? My tests until now don't suggest it, but I haven't yet looked into it extensively.
Because AppletInterface::activated is a signal, applets could connect to to do extra actions on external activation; we're not emitting that with this signal.
and this isn't just hypothetical as kicker does.
(ironically to do toggling on the dash window)
By introducing a new signal, this breaks existing applets.
We could maybe simply add
if (activate) emit activated();
and it'd work.
the current global shortcuts seem to toggle, and they only connect to activate(), how do they work?
Changed structure completely in order to support legacy applets and the asynced releases of Plasma and Frameworks. The new structure also reduces the extent of changes to other components. For example we don't need any changes anymore in KWin and Plasma-Workspace. The solution now works like this:
- A qml based applet can decide if it wants to use legacy behaviour of activation, which means while being activated it will NOT trigger shrinking or if it wants to let the shortcut work like a switch of the expanded state
- The default value of this behaviour is false in order to not break legacy applets
- The launchers set it to true, in case of kicker only if it's not in Dash mode (maybe we could use the new system here too, but it shouldn't be part of this diff)
Revision 2 (+33 -3)