1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-21 22:50:14 +03:00

new wayland id discovery for helper windows

This commit is contained in:
Michail Vourlakos 2020-03-02 09:39:07 +02:00
parent 6bc604feca
commit 67d0ca76dd
6 changed files with 43 additions and 6 deletions

View File

@ -76,6 +76,11 @@ FloatingGapWindow::~FloatingGapWindow()
{
}
QString FloatingGapWindow::validTitlePrefix() const
{
return QString("#subfloatgap#");
}
void FloatingGapWindow::updateGeometry()
{
if (m_latteView->positioner()->slideOffset() != 0) {

View File

@ -73,6 +73,7 @@ signals:
protected:
bool event(QEvent *ev) override;
QString validTitlePrefix() const override;
void updateGeometry() override;
private:

View File

@ -75,6 +75,11 @@ ScreenEdgeGhostWindow::~ScreenEdgeGhostWindow()
{
}
QString ScreenEdgeGhostWindow::validTitlePrefix() const
{
return QString("#subghostedge#");
}
void ScreenEdgeGhostWindow::updateGeometry()
{
if (m_latteView->positioner()->slideOffset() != 0) {

View File

@ -77,6 +77,7 @@ signals:
protected:
bool event(QEvent *ev) override;
QString validTitlePrefix() const override;
void updateGeometry() override;
private:

View File

@ -50,6 +50,7 @@ SubWindow::SubWindow(Latte::View *view, QString debugType) :
m_showColor = QColor(Qt::transparent);
m_hideColor = QColor(Qt::transparent);
setTitle(validTitle());
setColor(m_showColor);
setDefaultAlphaBuffer(true);
@ -129,12 +130,7 @@ SubWindow::SubWindow(Latte::View *view, QString debugType) :
m_trackedWindowId = winId();
m_corona->wm()->registerIgnoredWindow(m_trackedWindowId);
} else {
connect(m_corona->wm(), &WindowSystem::AbstractWindowInterface::latteWindowAdded, this, [&]() {
if (m_trackedWindowId.isNull()) {
m_trackedWindowId = m_corona->wm()->winIdFor("latte-dock", geometry());
m_corona->wm()->registerIgnoredWindow(m_trackedWindowId);
}
});
connect(m_corona->wm(), &WindowSystem::AbstractWindowInterface::latteWindowAdded, this, &SubWindow::updateWaylandId);
}
setScreen(m_latteView->screen());
@ -172,6 +168,16 @@ int SubWindow::thickness() const
return m_thickness;
}
QString SubWindow::validTitlePrefix() const
{
return QString("#subwindow#");
}
QString SubWindow::validTitle() const
{
return QString(validTitlePrefix() + QString::number(m_latteView->containment()->id()));
}
Latte::View *SubWindow::parentView()
{
return m_latteView;
@ -198,6 +204,20 @@ void SubWindow::fixGeometry()
}
}
void SubWindow::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 SubWindow::startGeometryTimer()
{
m_fixGeometryTimer.start();

View File

@ -58,6 +58,8 @@ public:
int location();
int thickness() const;
QString validTitle() const;
void hideWithMask();
void showWithMask();
@ -72,12 +74,15 @@ signals:
protected:
bool event(QEvent *ev) override;
virtual QString validTitlePrefix() const;
//! it is used to update m_calculatedGeometry correctly
virtual void updateGeometry() = 0;
private slots:
void startGeometryTimer();
void fixGeometry();
void updateWaylandId();
private:
void setupWaylandIntegration();