Commit 220f4f79 authored by Marco Martin's avatar Marco Martin

fix the close button

use the c++ part aain for hasCloseableActiveWindow
parent f97c377b
......@@ -143,7 +143,7 @@ PlasmaCore.ColorScope {
anchors.right: parent.right
iconSource: "window-close"
//FIXME:Qt.UserRole+9 is IsWindow Qt.UserRole+15 is IsClosable. We can't reach that enum from QML
enabled: taskSwitcher.model ? (taskSwitcher.model.data(taskSwitcher.model.activeTask, Qt.UserRole+9) === true && taskSwitcher.model.data(taskSwitcher.model.activeTask, Qt.UserRole+15) === true) : false
enabled: plasmoid.nativeInterface.hasCloseableActiveWindow
onClicked: {
var index = taskSwitcher.model.activeTask;
if (index) {
......
......@@ -42,6 +42,10 @@ TaskPanel::TaskPanel(QObject *parent, const QVariantList &args)
{
setHasConfigurationInterface(true);
initWayland();
m_activeTimer = new QTimer(this);
m_activeTimer->setSingleShot(true);
m_activeTimer->setInterval(250);
connect(m_activeTimer, &QTimer::timeout, this, &TaskPanel::updateActiveWindow);
}
TaskPanel::~TaskPanel()
......@@ -81,7 +85,10 @@ void TaskPanel::initWayland()
emit showingDesktopChanged(m_showingDesktop);
}
);
connect(m_windowManagement, &PlasmaWindowManagement::activeWindowChanged, this, &TaskPanel::updateActiveWindow);
//FIXME
//connect(m_windowManagement, &PlasmaWindowManagement::activeWindowChanged, this, &TaskPanel::updateActiveWindow, Qt::QueuedConnection);
connect(m_windowManagement, SIGNAL(activeWindowChanged()), m_activeTimer, SLOT(start()));
updateActiveWindow();
}
);
......@@ -132,7 +139,7 @@ void TaskPanel::setPanel(QWindow *panel)
void TaskPanel::updateActiveWindow()
{
if (!m_windowManagement) {
if (!m_windowManagement || m_activeWindow == m_windowManagement->activeWindow()) {
return;
}
if (m_activeWindow) {
......@@ -154,7 +161,7 @@ void TaskPanel::updateActiveWindow()
bool TaskPanel::hasCloseableActiveWindow() const
{
return m_activeWindow && m_activeWindow->isCloseable() && !m_activeWindow->isMinimized();
return m_activeWindow && m_activeWindow->isCloseable() /*&& !m_activeWindow->isMinimized()*/;
}
void TaskPanel::forgetActiveWindow()
......
......@@ -80,6 +80,7 @@ private:
KWayland::Client::PlasmaWindowManagement *m_windowManagement = nullptr;
KWayland::Client::PlasmaWindowModel *m_windowModel = nullptr;
QPointer<KWayland::Client::PlasmaWindow> m_activeWindow;
QTimer *m_activeTimer;
};
#endif
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