1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-08 13:18:09 +03:00

improve some functionality used

This commit is contained in:
Michail Vourlakos 2019-12-26 17:21:03 +02:00
parent 72777d18c1
commit 3554c4a006
4 changed files with 19 additions and 37 deletions

View File

@ -166,6 +166,11 @@ int Positioner::currentScreenId() const
return -1;
}
Latte::WindowSystem::WindowId Positioner::trackedWindowId()
{
return m_trackedWindowId;
}
QString Positioner::currentScreenName() const
{
return m_screenToFollowId;
@ -450,7 +455,7 @@ QRect Positioner::maximumNormalGeometry()
&& m_view->visibility()->mode() != Latte::Types::WindowsAlwaysCover) {
KWindowSystem::setState(m_view->winId(), NET::KeepAbove);
} else {
KWindowSystem::clearState(m_view->winId(), NET::KeepAbove);
// KWindowSystem::clearState(m_view->winId(), NET::KeepAbove);
}
return maxGeometry;

View File

@ -63,6 +63,8 @@ public:
void reconsiderScreen();
Latte::WindowSystem::WindowId trackedWindowId();
public slots:
Q_INVOKABLE void hideDockDuringLocationChange(int goToLocation);
Q_INVOKABLE void hideDockDuringMovingToLayout(QString layoutName);

View File

@ -142,11 +142,6 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
m_mode = mode;
if (mode != Types::AlwaysVisible && mode != Types::WindowsGoBelow) {
//set wayland visibility mode
if (m_latteView->surface()) {
m_latteView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::WindowsGoBelow);
}
m_connections[0] = connect(m_wm, &WindowSystem::AbstractWindowInterface::currentDesktopChanged, this, [&] {
if (m_raiseOnDesktopChange) {
raiseViewTemporarily();
@ -161,11 +156,6 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
});
base = 2;
} else {
//set wayland visibility mode
if (m_latteView->surface()) {
m_latteView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AutoHide);
}
}
switch (m_mode) {
@ -237,6 +227,9 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
case Types::WindowsGoBelow:
break;
case Types::WindowsAlwaysCover:
break;
default:
break;
}

View File

@ -342,13 +342,11 @@ WindowInfoWrap XWindowInterface::requestInfo(WindowId wid) const
| NET::WM2TransientFor};
//! update desktop id
bool isDesktop{false};
if (winfo.windowClassName() == "plasmashell" && isPlasmaDesktop(winfo.geometry())) {
isDesktop = true;
windowsTracker()->setPlasmaDesktop(wid);
}
WindowInfoWrap winfoWrap;
if (!winfo.valid()) {
@ -556,43 +554,27 @@ void XWindowInterface::requestToggleKeepAbove(WindowId wid) const
void XWindowInterface::setKeepAbove(WindowId wid, bool active) const
{
WindowInfoWrap wInfo = requestInfo(wid);
if (!wInfo.isValid() || wInfo.isPlasmaDesktop()) {
if (wid.toUInt() <= 0) {
return;
}
NETWinInfo ni(QX11Info::connection(), wid.toUInt(), QX11Info::appRootWindow(), NET::WMState, NET::Properties2());
if ((wInfo.isKeepAbove() && active) || (!wInfo.isKeepAbove() && !active)) {
return;
}
if (wInfo.isKeepAbove()) {
ni.setState(NET::States(), NET::StaysOnTop);
if (active) {
KWindowSystem::setState(wid.toUInt(), NET::KeepAbove);
} else {
ni.setState(NET::StaysOnTop, NET::StaysOnTop);
KWindowSystem::clearState(wid.toUInt(), NET::KeepAbove);
}
}
void XWindowInterface::setKeepBelow(WindowId wid, bool active) const
{
WindowInfoWrap wInfo = requestInfo(wid);
if (!wInfo.isValid() || wInfo.isPlasmaDesktop()) {
if (wid.toUInt() <= 0) {
return;
}
NETWinInfo ni(QX11Info::connection(), wid.toUInt(), QX11Info::appRootWindow(), NET::WMState, NET::Properties2());
if ((wInfo.isKeepBelow() && active) || (!wInfo.isKeepBelow() && !active)) {
return;
}
if (wInfo.isKeepBelow()) {
ni.setState(NET::States(), NET::KeepBelow);
if (active) {
KWindowSystem::setState(wid.toUInt(), NET::KeepBelow);
} else {
ni.setState(NET::KeepBelow, NET::KeepBelow);
KWindowSystem::clearState(wid.toUInt(), NET::KeepBelow);
}
}