1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-24 17:33:50 +03:00

simplify keepabove/below calling

--start a bit to work with "Windows Always Cover"
visibility mode
This commit is contained in:
Michail Vourlakos 2019-12-26 21:10:11 +02:00
parent 3554c4a006
commit d9e18794c8
8 changed files with 34 additions and 25 deletions

View File

@ -763,7 +763,7 @@ void Corona::aboutApplication()
aboutDialog = new KAboutApplicationDialog(KAboutData::applicationData());
connect(aboutDialog.data(), &QDialog::finished, aboutDialog.data(), &QObject::deleteLater);
m_wm->skipTaskBar(*aboutDialog);
m_wm->setKeepAbove(*aboutDialog, true);
m_wm->setKeepAbove(aboutDialog->winId(), true);
aboutDialog->show();
}

View File

@ -141,6 +141,12 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
m_timerHide.stop();
m_mode = mode;
if (m_mode == Types::WindowsCanCover || m_mode == Types::WindowsAlwaysCover) {
m_wm->setViewExtraFlags(m_latteView, false, mode);
} else {
m_wm->setViewExtraFlags(m_latteView, true, mode);
}
if (mode != Types::AlwaysVisible && mode != Types::WindowsGoBelow) {
m_connections[0] = connect(m_wm, &WindowSystem::AbstractWindowInterface::currentDesktopChanged, this, [&] {
if (m_raiseOnDesktopChange) {
@ -227,6 +233,9 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
case Types::WindowsGoBelow:
break;
case Types::WindowsCanCover:
break;
case Types::WindowsAlwaysCover:
break;

View File

@ -92,7 +92,6 @@ public:
virtual WindowInfoWrap requestInfo(WindowId wid) const = 0;
virtual WindowInfoWrap requestInfoActive() const = 0;
virtual void setKeepAbove(const QDialog &dialog, bool above = true) const = 0;
virtual void skipTaskBar(const QDialog &dialog) const = 0;
virtual void slideWindow(QWindow &view, Slide location) const = 0;
virtual void enableBlurBehind(QWindow &view) const = 0;

View File

@ -24,7 +24,8 @@
#include "view/screenedgeghostwindow.h"
#include "view/view.h"
#include "../lattecorona.h"
#include "../liblatte2/extras.h"
#include "../../liblatte2/extras.h"
#include "../../liblatte2/types.h"
// Qt
#include <QDebug>
@ -351,15 +352,6 @@ WindowId WaylandInterface::activeWindow() const
return wid ? wid->internalId() : 0;
}
void WaylandInterface::setKeepAbove(const QDialog &dialog, bool above) const
{
if (above) {
KWindowSystem::setState(dialog.winId(), NET::KeepAbove);
} else {
KWindowSystem::clearState(dialog.winId(), NET::KeepAbove);
}
}
void WaylandInterface::skipTaskBar(const QDialog &dialog) const
{
KWindowSystem::setState(dialog.winId(), NET::SkipTaskbar);
@ -620,6 +612,10 @@ void WaylandInterface::setKeepAbove(WindowId wid, bool active) const
auto w = windowFor(wid);
if (w) {
if (active) {
setKeepBelow(wid, false);
}
if ((w->isKeepAbove() && active) || (!w->isKeepAbove() && !active)) {
return;
}
@ -633,6 +629,10 @@ void WaylandInterface::setKeepBelow(WindowId wid, bool active) const
auto w = windowFor(wid);
if (w) {
if (active) {
setKeepAbove(wid, false);
}
if ((w->isKeepBelow() && active) || (!w->isKeepBelow() && !active)) {
return;
}

View File

@ -70,7 +70,6 @@ public:
WindowInfoWrap requestInfo(WindowId wid) const override;
WindowInfoWrap requestInfoActive() const override;
void setKeepAbove(const QDialog &dialog, bool above = true) const override;
void skipTaskBar(const QDialog &dialog) const override;
void slideWindow(QWindow &view, Slide location) const override;
void enableBlurBehind(QWindow &view) const override;

View File

@ -24,7 +24,8 @@
#include "tasktools.h"
#include "view/screenedgeghostwindow.h"
#include "view/view.h"
#include "../liblatte2/extras.h"
#include "../../liblatte2/extras.h"
#include "../../liblatte2/types.h"
// Qt
#include <QDebug>
@ -105,10 +106,18 @@ void XWindowInterface::setViewExtraFlags(QObject *view,bool isPanelWindow, Latte
if (isPanelWindow) {
KWindowSystem::setType(winId, NET::Dock);
} else {
KWindowSystem::setType(winId, NET::Normal);
}
KWindowSystem::setState(winId, NET::SkipTaskbar | NET::SkipPager);
KWindowSystem::setOnAllDesktops(winId, true);
if (mode == Latte::Types::WindowsCanCover || mode == Latte::Types::WindowsAlwaysCover) {
setKeepBelow(winId, true);
} else {
setKeepAbove(winId, true);
}
}
void XWindowInterface::setViewStruts(QWindow &view, const QRect &rect
@ -217,15 +226,6 @@ WindowId XWindowInterface::activeWindow() const
return KWindowSystem::self()->activeWindow();
}
void XWindowInterface::setKeepAbove(const QDialog &dialog, bool above) const
{
if (above) {
KWindowSystem::setState(dialog.winId(), NET::KeepAbove);
} else {
KWindowSystem::clearState(dialog.winId(), NET::KeepAbove);
}
}
void XWindowInterface::skipTaskBar(const QDialog &dialog) const
{
KWindowSystem::setState(dialog.winId(), NET::SkipTaskbar);
@ -560,6 +560,7 @@ void XWindowInterface::setKeepAbove(WindowId wid, bool active) const
if (active) {
KWindowSystem::setState(wid.toUInt(), NET::KeepAbove);
KWindowSystem::clearState(wid.toUInt(), NET::KeepBelow);
} else {
KWindowSystem::clearState(wid.toUInt(), NET::KeepAbove);
}
@ -573,6 +574,7 @@ void XWindowInterface::setKeepBelow(WindowId wid, bool active) const
if (active) {
KWindowSystem::setState(wid.toUInt(), NET::KeepBelow);
KWindowSystem::clearState(wid.toUInt(), NET::KeepAbove);
} else {
KWindowSystem::clearState(wid.toUInt(), NET::KeepBelow);
}

View File

@ -54,7 +54,6 @@ public:
WindowInfoWrap requestInfo(WindowId wid) const override;
WindowInfoWrap requestInfoActive() const override;
void setKeepAbove(const QDialog &dialog, bool above = true) const override;
void skipTaskBar(const QDialog &dialog) const override;
void slideWindow(QWindow &view, Slide location) const override;
void enableBlurBehind(QWindow &view) const override;

View File

@ -36,7 +36,8 @@
<label>opacity value for edit mode background</label>
</entry>
<entry name="lastWindowsVisibilityMode" type="Int">
<default>0</default>
<default>5</default>
<label>last windows visibility mode used, 5 stands for "Windows Go Below"</label>
</entry>
<!-- this is percentage -->