Commit 549374ba authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Windows Runner] Gather window again when running result

Since we fixed RunnerManager::teardown to actually be emitted, the runner would throw away its gathered window info and then crash in run().
I couldn't figure out what the proper API was so this is a workaround to keep it from crashing at least.
However, the runner also didn't check whether the window was actually still valid by the time run() was called,
so querying for the window again once it is called and checking validity is a good thing either way imho.
In the future, this probably should be ported to using libtaskmanager :)

BUG: 412386
FIXED-IN: 5.17.1

Differential Revision: https://phabricator.kde.org/D24849
parent b59af69b
......@@ -336,9 +336,13 @@ void WindowsRunner::run(const Plasma::RunnerContext& context, const Plasma::Quer
const QStringList parts = match.data().toString().split(QLatin1Char('_'));
WindowAction action = WindowAction(parts[0].toInt());
WId w(parts[1].toULong());
//this is needed since KWindowInfo() doesn't exist, m_windows[w] doesn't work
QHash<WId, KWindowInfo>::iterator i = m_windows.find(w);
KWindowInfo info = i.value();
KWindowInfo info(w, NET::WMWindowType | NET::WMDesktop | NET::WMState | NET::XAWMState | NET::WMName,
NET::WM2WindowClass | NET::WM2WindowRole | NET::WM2AllowedActions);
if (!info.valid()) {
return;
}
switch (action) {
case ActivateAction:
KWindowSystem::forceActiveWindow(w);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment