1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-10 21:18:19 +03:00

update infoview to be ignored properly

This commit is contained in:
Michail Vourlakos 2020-03-21 13:06:03 +02:00
parent 70359602b8
commit 6188888840
2 changed files with 38 additions and 1 deletions

View File

@ -49,6 +49,10 @@ InfoView::InfoView(Latte::Corona *corona, QString message, QScreen *screen, QWin
m_message(message),
m_screen(screen)
{
m_id = QString::number(qrand() % 1000);
setTitle(validTitle());
setupWaylandIntegration();
setResizeMode(QQuickView::SizeViewToRootObject);
@ -60,6 +64,13 @@ InfoView::InfoView(Latte::Corona *corona, QString message, QScreen *screen, QWin
setScreen(screen);
setFlags(wFlags());
if (KWindowSystem::isPlatformX11()) {
m_trackedWindowId = winId();
m_corona->wm()->registerIgnoredWindow(m_trackedWindowId);
} else {
connect(m_corona->wm(), &WindowSystem::AbstractWindowInterface::latteWindowAdded, this, &InfoView::updateWaylandId);
}
init();
}
@ -97,6 +108,11 @@ void InfoView::init()
syncGeometry();
}
QString InfoView::validTitle() const
{
return "#layoutinfowindow#" + m_id;
}
Plasma::FrameSvg::EnabledBorders InfoView::enabledBorders() const
{
return m_borders;
@ -143,6 +159,20 @@ void InfoView::showEvent(QShowEvent *ev)
PanelShadows::self()->setEnabledBorders(this, m_borders);
}
void InfoView::updateWaylandId()
{
Latte::WindowSystem::WindowId newId = m_corona->wm()->winIdFor("latte-dock", validTitle());
if (m_trackedWindowId != newId) {
if (!m_trackedWindowId.isNull()) {
m_corona->wm()->unregisterIgnoredWindow(m_trackedWindowId);
}
m_trackedWindowId = newId;
m_corona->wm()->registerIgnoredWindow(m_trackedWindowId);
}
}
void InfoView::setupWaylandIntegration()
{
if (m_shellSurface) {

View File

@ -23,6 +23,7 @@
// local
#include "lattecorona.h"
#include "wm/windowinfowrap.h"
// Qt
#include <QObject>
@ -47,6 +48,8 @@ public:
InfoView(Latte::Corona *corona, QString message, QScreen *screen = qGuiApp->primaryScreen(), QWindow *parent = nullptr);
~InfoView() override;
QString validTitle() const;
Plasma::FrameSvg::EnabledBorders enabledBorders() const;
void init();
@ -64,16 +67,20 @@ protected:
void showEvent(QShowEvent *ev) override;
bool event(QEvent *e) override;
private:
private slots:
void setupWaylandIntegration();
void updateWaylandId();
private:
QString m_id;
QString m_message;
QScreen *m_screen{nullptr};
Plasma::FrameSvg::EnabledBorders m_borders{Plasma::FrameSvg::TopBorder | Plasma::FrameSvg::BottomBorder};
Latte::WindowSystem::WindowId m_trackedWindowId;
KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr};
Latte::Corona *m_corona{nullptr};