mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-23 02:50:12 +03:00
new wayland id discovery for settings windows
This commit is contained in:
parent
d5033d1bed
commit
6bc604feca
@ -183,12 +183,16 @@ void Positioner::updateWaylandId()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_trackedWindowId.isNull()) {
|
||||
m_corona->wm()->unregisterIgnoredWindow(m_trackedWindowId);
|
||||
}
|
||||
Latte::WindowSystem::WindowId newId = m_corona->wm()->winIdFor("latte-dock", validTitle);
|
||||
|
||||
m_trackedWindowId = m_corona->wm()->winIdFor("latte-dock", validTitle);
|
||||
m_corona->wm()->registerIgnoredWindow(m_trackedWindowId);
|
||||
if (m_trackedWindowId != newId) {
|
||||
if (!m_trackedWindowId.isNull()) {
|
||||
m_corona->wm()->unregisterIgnoredWindow(m_trackedWindowId);
|
||||
}
|
||||
|
||||
m_trackedWindowId = newId;
|
||||
m_corona->wm()->registerIgnoredWindow(m_trackedWindowId);
|
||||
}
|
||||
}
|
||||
|
||||
int Positioner::currentScreenId() const
|
||||
|
@ -62,15 +62,12 @@ PrimaryConfigView::PrimaryConfigView(Plasma::Containment *containment, Latte::Vi
|
||||
|
||||
setupWaylandIntegration();
|
||||
|
||||
setTitle(validTitle());
|
||||
|
||||
if (KWindowSystem::isPlatformX11()) {
|
||||
m_corona->wm()->registerIgnoredWindow(winId());
|
||||
} else {
|
||||
connect(m_corona->wm(), &WindowSystem::AbstractWindowInterface::latteWindowAdded, this, [&]() {
|
||||
if (m_waylandWindowId.isNull()) {
|
||||
m_waylandWindowId = m_corona->wm()->winIdFor("latte-dock", geometry());
|
||||
m_corona->wm()->registerIgnoredWindow(m_waylandWindowId);
|
||||
}
|
||||
});
|
||||
connect(m_corona->wm(), &WindowSystem::AbstractWindowInterface::latteWindowAdded, this, &PrimaryConfigView::updateWaylandId);
|
||||
}
|
||||
|
||||
setScreen(m_latteView->screen());
|
||||
@ -195,6 +192,11 @@ inline Qt::WindowFlags PrimaryConfigView::wFlags() const
|
||||
return (flags() | Qt::FramelessWindowHint) & ~Qt::WindowDoesNotAcceptFocus;
|
||||
}
|
||||
|
||||
QString PrimaryConfigView::validTitle() const
|
||||
{
|
||||
return QString("#primaryconfig#" + QString::number(m_latteView->containment()->id()));
|
||||
}
|
||||
|
||||
QQuickView *PrimaryConfigView::secondaryWindow()
|
||||
{
|
||||
return m_secConfigView;
|
||||
@ -247,10 +249,7 @@ QRect PrimaryConfigView::geometryWhenVisible() const
|
||||
void PrimaryConfigView::requestActivate()
|
||||
{
|
||||
if (KWindowSystem::isPlatformWayland() && m_shellSurface) {
|
||||
if (m_waylandWindowId.isNull()) {
|
||||
m_waylandWindowId = m_corona->wm()->winIdFor("latte-dock", geometry());
|
||||
}
|
||||
|
||||
updateWaylandId();
|
||||
m_corona->wm()->requestActivate(m_waylandWindowId);
|
||||
} else {
|
||||
QQuickView::requestActivate();
|
||||
@ -317,7 +316,7 @@ void PrimaryConfigView::syncGeometry()
|
||||
|
||||
position = {xPos, yPos};
|
||||
|
||||
updateEnabledBorders();
|
||||
updateEnabledBorders();
|
||||
|
||||
m_geometryWhenVisible = QRect(position.x(), position.y(), size.width(), size.height());
|
||||
|
||||
@ -572,6 +571,20 @@ void PrimaryConfigView::updateShowInlineProperties()
|
||||
// qDebug() << " showSecWindow:" << showSecWindow << " _ " << " inline:"<< !showSecWindow;
|
||||
}
|
||||
|
||||
void PrimaryConfigView::updateWaylandId()
|
||||
{
|
||||
Latte::WindowSystem::WindowId newId = m_corona->wm()->winIdFor("latte-dock", validTitle());
|
||||
|
||||
if (m_waylandWindowId != newId) {
|
||||
if (!m_waylandWindowId.isNull()) {
|
||||
m_corona->wm()->unregisterIgnoredWindow(m_waylandWindowId);
|
||||
}
|
||||
|
||||
m_waylandWindowId = newId;
|
||||
m_corona->wm()->registerIgnoredWindow(m_waylandWindowId);
|
||||
}
|
||||
}
|
||||
|
||||
int PrimaryConfigView::complexity() const
|
||||
{
|
||||
return (int)m_complexity;
|
||||
|
@ -99,6 +99,8 @@ public:
|
||||
QRect availableScreenGeometry() const;
|
||||
QRect geometryWhenVisible() const;
|
||||
|
||||
QString validTitle() const;
|
||||
|
||||
Plasma::FrameSvg::EnabledBorders enabledBorders() const;
|
||||
|
||||
QQuickView *secondaryWindow();
|
||||
@ -131,6 +133,7 @@ private slots:
|
||||
void updateAvailableScreenGeometry(View *origin = nullptr);
|
||||
void updateEnabledBorders();
|
||||
void updateShowInlineProperties();
|
||||
void updateWaylandId();
|
||||
|
||||
void createSecondaryWindow();
|
||||
void deleteSecondaryWindow();
|
||||
|
@ -56,15 +56,12 @@ SecondaryConfigView::SecondaryConfigView(Latte::View *view, QWindow *parent)
|
||||
|
||||
setupWaylandIntegration();
|
||||
|
||||
setTitle(validTitle());
|
||||
|
||||
if (KWindowSystem::isPlatformX11()) {
|
||||
m_corona->wm()->registerIgnoredWindow(winId());
|
||||
} else {
|
||||
connect(m_corona->wm(), &WindowSystem::AbstractWindowInterface::latteWindowAdded, this, [&]() {
|
||||
if (m_waylandWindowId.isNull()) {
|
||||
m_waylandWindowId = m_corona->wm()->winIdFor("latte-dock", geometry());
|
||||
m_corona->wm()->registerIgnoredWindow(m_waylandWindowId);
|
||||
}
|
||||
});
|
||||
connect(m_corona->wm(), &WindowSystem::AbstractWindowInterface::latteWindowAdded, this, &SecondaryConfigView::updateWaylandId);
|
||||
}
|
||||
|
||||
setResizeMode(QQuickView::SizeViewToRootObject);
|
||||
@ -164,6 +161,11 @@ inline Qt::WindowFlags SecondaryConfigView::wFlags() const
|
||||
return (flags() | Qt::FramelessWindowHint /*| Qt::WindowStaysOnTopHint*/) & ~Qt::WindowDoesNotAcceptFocus;
|
||||
}
|
||||
|
||||
QString SecondaryConfigView::validTitle() const
|
||||
{
|
||||
return QString("#secconfig#" + QString::number(m_latteView->containment()->id()));
|
||||
}
|
||||
|
||||
QRect SecondaryConfigView::geometryWhenVisible() const
|
||||
{
|
||||
return m_geometryWhenVisible;
|
||||
@ -172,10 +174,7 @@ QRect SecondaryConfigView::geometryWhenVisible() const
|
||||
void SecondaryConfigView::requestActivate()
|
||||
{
|
||||
if (KWindowSystem::isPlatformWayland() && m_shellSurface) {
|
||||
if (m_waylandWindowId.isNull()) {
|
||||
m_waylandWindowId = m_corona->wm()->winIdFor("latte-dock", geometry());
|
||||
}
|
||||
|
||||
updateWaylandId();
|
||||
m_corona->wm()->requestActivate(m_waylandWindowId);
|
||||
} else {
|
||||
QQuickView::requestActivate();
|
||||
@ -398,6 +397,20 @@ void SecondaryConfigView::hideConfigWindow()
|
||||
}
|
||||
}
|
||||
|
||||
void SecondaryConfigView::updateWaylandId()
|
||||
{
|
||||
Latte::WindowSystem::WindowId newId = m_corona->wm()->winIdFor("latte-dock", validTitle());
|
||||
|
||||
if (m_waylandWindowId != newId) {
|
||||
if (!m_waylandWindowId.isNull()) {
|
||||
m_corona->wm()->unregisterIgnoredWindow(m_waylandWindowId);
|
||||
}
|
||||
|
||||
m_waylandWindowId = newId;
|
||||
m_corona->wm()->registerIgnoredWindow(m_waylandWindowId);
|
||||
}
|
||||
}
|
||||
|
||||
void SecondaryConfigView::updateEffects()
|
||||
{
|
||||
//! Don't apply any effect before the wayland surface is created under wayland
|
||||
|
@ -77,6 +77,8 @@ public:
|
||||
|
||||
QRect geometryWhenVisible() const;
|
||||
|
||||
QString validTitle() const;
|
||||
|
||||
Plasma::FrameSvg::EnabledBorders enabledBorders() const;
|
||||
|
||||
public slots:
|
||||
@ -97,6 +99,7 @@ protected:
|
||||
|
||||
private slots:
|
||||
void updateEnabledBorders();
|
||||
void updateWaylandId();
|
||||
|
||||
private:
|
||||
void setupWaylandIntegration();
|
||||
|
Loading…
x
Reference in New Issue
Block a user