mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
fix the close button
use the c++ part aain for hasCloseableActiveWindow
This commit is contained in:
parent
f97c377b06
commit
220f4f79e8
3 changed files with 12 additions and 4 deletions
|
|
@ -143,7 +143,7 @@ PlasmaCore.ColorScope {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
iconSource: "window-close"
|
iconSource: "window-close"
|
||||||
//FIXME:Qt.UserRole+9 is IsWindow Qt.UserRole+15 is IsClosable. We can't reach that enum from QML
|
//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: {
|
onClicked: {
|
||||||
var index = taskSwitcher.model.activeTask;
|
var index = taskSwitcher.model.activeTask;
|
||||||
if (index) {
|
if (index) {
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,10 @@ TaskPanel::TaskPanel(QObject *parent, const QVariantList &args)
|
||||||
{
|
{
|
||||||
setHasConfigurationInterface(true);
|
setHasConfigurationInterface(true);
|
||||||
initWayland();
|
initWayland();
|
||||||
|
m_activeTimer = new QTimer(this);
|
||||||
|
m_activeTimer->setSingleShot(true);
|
||||||
|
m_activeTimer->setInterval(250);
|
||||||
|
connect(m_activeTimer, &QTimer::timeout, this, &TaskPanel::updateActiveWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskPanel::~TaskPanel()
|
TaskPanel::~TaskPanel()
|
||||||
|
|
@ -81,7 +85,10 @@ void TaskPanel::initWayland()
|
||||||
emit showingDesktopChanged(m_showingDesktop);
|
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();
|
updateActiveWindow();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -132,7 +139,7 @@ void TaskPanel::setPanel(QWindow *panel)
|
||||||
|
|
||||||
void TaskPanel::updateActiveWindow()
|
void TaskPanel::updateActiveWindow()
|
||||||
{
|
{
|
||||||
if (!m_windowManagement) {
|
if (!m_windowManagement || m_activeWindow == m_windowManagement->activeWindow()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_activeWindow) {
|
if (m_activeWindow) {
|
||||||
|
|
@ -154,7 +161,7 @@ void TaskPanel::updateActiveWindow()
|
||||||
|
|
||||||
bool TaskPanel::hasCloseableActiveWindow() const
|
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()
|
void TaskPanel::forgetActiveWindow()
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@ private:
|
||||||
KWayland::Client::PlasmaWindowManagement *m_windowManagement = nullptr;
|
KWayland::Client::PlasmaWindowManagement *m_windowManagement = nullptr;
|
||||||
KWayland::Client::PlasmaWindowModel *m_windowModel = nullptr;
|
KWayland::Client::PlasmaWindowModel *m_windowModel = nullptr;
|
||||||
QPointer<KWayland::Client::PlasmaWindow> m_activeWindow;
|
QPointer<KWayland::Client::PlasmaWindow> m_activeWindow;
|
||||||
|
QTimer *m_activeTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue