summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Hein <hein@kde.org>2017-02-09 13:31:04 (GMT)
committerEike Hein <hein@kde.org>2017-02-13 18:01:28 (GMT)
commit61489110c597ad4e4cb69b004d30dbda8b4110ef (patch)
treea170081a48ebfa3dd39a57d85feb41b838b47c87
parent9d75021a8238960b1f61f9ac6a66dc21c87b82e7 (diff)
Fix crash when invoking Present Windows with the group dialog open.
Summary: This fixes a regression from aeec4ae8 which unsets the taskManagerItem prop when the group dialog is shown to intentionally break window highlighting while the dialog is open. This patch instead fixes highlighting from the group dialog properly by including it in the highlight list. Also adds some extra crash guards. CCMAIL:bvbfan@abv.bg BUG:376205 BUG:376234 Reviewers: #plasma, anthonyfieroni Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D4525
-rw-r--r--applets/taskmanager/package/contents/ui/Task.qml2
-rw-r--r--applets/taskmanager/package/contents/ui/main.qml3
-rw-r--r--applets/taskmanager/plugin/backend.cpp22
-rw-r--r--applets/taskmanager/plugin/backend.h6
4 files changed, 32 insertions, 1 deletions
diff --git a/applets/taskmanager/package/contents/ui/Task.qml b/applets/taskmanager/package/contents/ui/Task.qml
index 404d742..bf4e857 100644
--- a/applets/taskmanager/package/contents/ui/Task.qml
+++ b/applets/taskmanager/package/contents/ui/Task.qml
@@ -121,6 +121,8 @@ MouseArea {
} else if (mouse.button == Qt.LeftButton) {
TaskTools.activateTask(modelIndex(), model, mouse.modifiers);
}
+
+ backend.cancelHighlightWindows();
}
pressed = false;
diff --git a/applets/taskmanager/package/contents/ui/main.qml b/applets/taskmanager/package/contents/ui/main.qml
index f390efc..74dca9e 100644
--- a/applets/taskmanager/package/contents/ui/main.qml
+++ b/applets/taskmanager/package/contents/ui/main.qml
@@ -175,8 +175,9 @@ Item {
TaskManagerApplet.Backend {
id: backend
- taskManagerItem: groupDialog.visible ? null : tasks
+ taskManagerItem: tasks
toolTipItem: toolTipDelegate
+ groupDialog: groupDialog
highlightWindows: plasmoid.configuration.highlightWindows
onAddLauncher: {
diff --git a/applets/taskmanager/plugin/backend.cpp b/applets/taskmanager/plugin/backend.cpp
index efbd095..58cb233 100644
--- a/applets/taskmanager/plugin/backend.cpp
+++ b/applets/taskmanager/plugin/backend.cpp
@@ -88,6 +88,20 @@ void Backend::setToolTipItem(QQuickItem *item)
}
}
+QQuickWindow *Backend::groupDialog() const
+{
+ return m_groupDialog;
+}
+
+void Backend::setGroupDialog(QQuickWindow *dialog)
+{
+ if (dialog != m_groupDialog) {
+ m_groupDialog = dialog;
+
+ emit groupDialogChanged();
+ }
+}
+
bool Backend::highlightWindows() const
{
return m_highlightWindows;
@@ -324,6 +338,10 @@ bool Backend::canPresentWindows() const
void Backend::presentWindows(const QVariant &_winIds)
{
+ if (!m_taskManagerItem || !m_taskManagerItem->window()) {
+ return;
+ }
+
QList<WId> winIds;
const QVariantList &_winIdsList = _winIds.toList();
@@ -427,5 +445,9 @@ void Backend::updateWindowHighlight()
windows.append(m_toolTipItem->window()->winId());
}
+ if (windows.count() && m_groupDialog) {
+ windows.append(m_groupDialog->winId());
+ }
+
KWindowEffects::highlightWindows(m_panelWinId, windows);
}
diff --git a/applets/taskmanager/plugin/backend.h b/applets/taskmanager/plugin/backend.h
index a75013a..87037c6 100644
--- a/applets/taskmanager/plugin/backend.h
+++ b/applets/taskmanager/plugin/backend.h
@@ -41,6 +41,7 @@ class Backend : public QObject
Q_PROPERTY(QQuickItem* taskManagerItem READ taskManagerItem WRITE setTaskManagerItem NOTIFY taskManagerItemChanged)
Q_PROPERTY(QQuickItem* toolTipItem READ toolTipItem WRITE setToolTipItem NOTIFY toolTipItemChanged)
+ Q_PROPERTY(QQuickWindow* groupDialog READ groupDialog WRITE setGroupDialog NOTIFY groupDialogChanged)
Q_PROPERTY(bool highlightWindows READ highlightWindows WRITE setHighlightWindows NOTIFY highlightWindowsChanged)
public:
@@ -62,6 +63,9 @@ class Backend : public QObject
QQuickItem *toolTipItem() const;
void setToolTipItem(QQuickItem *item);
+ QQuickWindow *groupDialog() const;
+ void setGroupDialog(QQuickWindow *dialog);
+
bool highlightWindows() const;
void setHighlightWindows(bool highlight);
@@ -88,6 +92,7 @@ class Backend : public QObject
Q_SIGNALS:
void taskManagerItemChanged() const;
void toolTipItemChanged() const;
+ void groupDialogChanged() const;
void highlightWindowsChanged() const;
void addLauncher(const QUrl &url) const;
@@ -101,6 +106,7 @@ class Backend : public QObject
QQuickItem *m_taskManagerItem;
QQuickItem *m_toolTipItem;
+ QQuickWindow *m_groupDialog;
WId m_panelWinId;
bool m_highlightWindows;
QList<WId> m_windowsToHighlight;