mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-21 10:50:30 +03:00
support toggle onAllDesktops for LastActiveWindow
This commit is contained in:
parent
af609ca53f
commit
51c11071dd
@ -105,6 +105,7 @@ public:
|
||||
virtual void requestActivate(WindowId wid) const = 0;
|
||||
virtual void requestClose(WindowId wid) const = 0;
|
||||
virtual void requestMoveWindow(WindowId wid, QPoint from) const = 0;
|
||||
virtual void requestToggleIsOnAllDesktops(WindowId wid) const = 0;
|
||||
virtual void requestToggleKeepAbove(WindowId wid) const = 0;
|
||||
virtual void requestToggleMinimized(WindowId wid) const = 0;
|
||||
virtual void requestToggleMaximized(WindowId wid) const = 0;
|
||||
|
@ -296,6 +296,11 @@ void LastActiveWindow::requestMove(int localX, int localY)
|
||||
emit draggingStarted();
|
||||
}
|
||||
|
||||
void LastActiveWindow::requestToggleIsOnAllDesktops()
|
||||
{
|
||||
m_wm->requestToggleIsOnAllDesktops(m_winId);
|
||||
}
|
||||
|
||||
void LastActiveWindow::requestToggleKeepAbove()
|
||||
{
|
||||
m_wm->requestToggleKeepAbove(m_winId);
|
||||
|
@ -89,6 +89,7 @@ public slots:
|
||||
Q_INVOKABLE void requestActivate();
|
||||
Q_INVOKABLE void requestClose();
|
||||
Q_INVOKABLE void requestMove(int localX, int localY);
|
||||
Q_INVOKABLE void requestToggleIsOnAllDesktops();
|
||||
Q_INVOKABLE void requestToggleKeepAbove();
|
||||
Q_INVOKABLE void requestToggleMinimized();
|
||||
Q_INVOKABLE void requestToggleMaximized();
|
||||
|
@ -479,6 +479,25 @@ void WaylandInterface::requestMoveWindow(WindowId wid, QPoint from) const
|
||||
}
|
||||
}
|
||||
|
||||
void WaylandInterface::requestToggleIsOnAllDesktops(WindowId wid) const
|
||||
{
|
||||
#if KF5_VERSION_MINOR >= 52
|
||||
auto w = windowFor(wid);
|
||||
|
||||
if (w && isValidWindow(w) && m_desktops.count() > 1) {
|
||||
if (w->isOnAllDesktops()) {
|
||||
w->requestEnterVirtualDesktop(m_currentDesktop);
|
||||
} else {
|
||||
const QStringList &now = w->plasmaVirtualDesktops();
|
||||
|
||||
foreach (const QString &desktop, now) {
|
||||
w->requestLeaveVirtualDesktop(desktop);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void WaylandInterface::requestToggleKeepAbove(WindowId wid) const
|
||||
{
|
||||
auto w = windowFor(wid);
|
||||
|
@ -83,6 +83,7 @@ public:
|
||||
void requestActivate(WindowId wid) const override;
|
||||
void requestClose(WindowId wid) const override;
|
||||
void requestMoveWindow(WindowId wid, QPoint from) const override;
|
||||
void requestToggleIsOnAllDesktops(WindowId wid) const override;
|
||||
void requestToggleKeepAbove(WindowId wid) const override;
|
||||
void requestToggleMinimized(WindowId wid) const override;
|
||||
void requestToggleMaximized(WindowId wid) const override;
|
||||
|
@ -454,6 +454,26 @@ void XWindowInterface::requestMoveWindow(WindowId wid, QPoint from) const
|
||||
ri.moveResizeRequest(wInfo.wid().toUInt(), validX, validY, NET::Move);
|
||||
}
|
||||
|
||||
void XWindowInterface::requestToggleIsOnAllDesktops(WindowId wid) const
|
||||
{
|
||||
WindowInfoWrap wInfo = requestInfo(wid);
|
||||
|
||||
if (!wInfo.isValid() || wInfo.isPlasmaDesktop()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (KWindowSystem::numberOfDesktops() <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (wInfo.isOnAllDesktops()) {
|
||||
KWindowSystem::setOnDesktop(wid.toUInt(), KWindowSystem::currentDesktop());
|
||||
KWindowSystem::forceActiveWindow(wid.toUInt());
|
||||
} else {
|
||||
KWindowSystem::setOnAllDesktops(wid.toUInt(), true);
|
||||
}
|
||||
}
|
||||
|
||||
void XWindowInterface::requestToggleKeepAbove(WindowId wid) const
|
||||
{
|
||||
WindowInfoWrap wInfo = requestInfo(wid);
|
||||
@ -613,24 +633,6 @@ void XWindowInterface::windowChangedProxy(WId wid, NET::Properties prop1, NET::P
|
||||
return;
|
||||
}
|
||||
|
||||
//! when only WMState changed we can whitelist the acceptable states
|
||||
if ((prop1 & NET::WMState)
|
||||
&& !(prop1 & NET::WMGeometry)
|
||||
&& !(prop1 & NET::ActiveWindow)
|
||||
&& !(prop1 & NET::WMDesktop)
|
||||
&& !(prop1 & (NET::WMName | NET::WMVisibleName)) ) {
|
||||
KWindowInfo info(wid, NET::WMState);
|
||||
|
||||
if (info.valid()) {
|
||||
if ( !info.hasState(NET::KeepAbove) && !info.hasState(NET::Sticky) && !info.hasState(NET::Shaded)
|
||||
&& !info.hasState(NET::FullScreen) && !info.hasState(NET::Hidden)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//! ignore windows that do not respect normal windows types
|
||||
if (!isValidWindow(wid)) {
|
||||
return;
|
||||
|
@ -67,6 +67,7 @@ public:
|
||||
void requestActivate(WindowId wid) const override;
|
||||
void requestClose(WindowId wid) const override;
|
||||
void requestMoveWindow(WindowId wid, QPoint from) const override;
|
||||
void requestToggleIsOnAllDesktops(WindowId wid) const override;
|
||||
void requestToggleKeepAbove(WindowId wid) const override;
|
||||
void requestToggleMinimized(WindowId wid) const override;
|
||||
void requestToggleMaximized(WindowId wid) const override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user