mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-23 13:33:50 +03:00
wayland:improve latte windows id discovering
This commit is contained in:
parent
1ef328bd3a
commit
3a465782e1
@ -59,6 +59,13 @@ Positioner::Positioner(Latte::View *parent)
|
||||
if (m_corona) {
|
||||
if (KWindowSystem::isPlatformX11()) {
|
||||
m_corona->wm()->registerIgnoredWindow(m_view->winId());
|
||||
} else {
|
||||
connect(m_corona->wm(), &WindowSystem::AbstractWindowInterface::latteWindowAdded, this, [&]() {
|
||||
if (m_waylandWindowId.isNull()) {
|
||||
m_waylandWindowId = m_corona->wm()->winIdFor("latte-dock", m_view->geometry());
|
||||
m_corona->wm()->registerIgnoredWindow(m_waylandWindowId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
m_screenSyncTimer.setInterval(qMax(m_corona->universalSettings()->screenTrackerInterval() - 500, 1000));
|
||||
@ -317,11 +324,6 @@ void Positioner::syncGeometry()
|
||||
|
||||
qDebug() << "syncGeometry() called...";
|
||||
|
||||
if (KWindowSystem::isPlatformWayland() && m_waylandWindowId.isNull()) {
|
||||
m_waylandWindowId = m_corona->wm()->winIdFor("latte-dock", m_view->geometry());
|
||||
m_corona->wm()->registerIgnoredWindow(m_waylandWindowId);
|
||||
}
|
||||
|
||||
//! before updating the positioning and geometry of the dock
|
||||
//! we make sure that the dock is at the correct screen
|
||||
if (m_view->screen() != m_screenToFollow) {
|
||||
|
@ -126,6 +126,13 @@ ScreenEdgeGhostWindow::ScreenEdgeGhostWindow(Latte::View *view) :
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setScreen(m_latteView->screen());
|
||||
@ -171,11 +178,6 @@ KWayland::Client::PlasmaShellSurface *ScreenEdgeGhostWindow::surface()
|
||||
|
||||
void ScreenEdgeGhostWindow::updateGeometry()
|
||||
{
|
||||
if (KWindowSystem::isPlatformWayland() && m_waylandWindowId.isNull()) {
|
||||
m_waylandWindowId = m_corona->wm()->winIdFor("latte-dock", geometry());
|
||||
m_corona->wm()->registerIgnoredWindow(m_waylandWindowId);
|
||||
}
|
||||
|
||||
QRect newGeometry;
|
||||
int thickness;
|
||||
if (KWindowSystem::compositingActive()) {
|
||||
|
@ -64,6 +64,13 @@ PrimaryConfigView::PrimaryConfigView(Plasma::Containment *containment, Latte::Vi
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setScreen(m_latteView->screen());
|
||||
@ -250,11 +257,6 @@ void PrimaryConfigView::syncGeometry()
|
||||
return;
|
||||
}
|
||||
|
||||
if (KWindowSystem::isPlatformWayland() && m_waylandWindowId.isNull()) {
|
||||
m_waylandWindowId = m_corona->wm()->winIdFor("latte-dock", geometry());
|
||||
m_corona->wm()->registerIgnoredWindow(m_waylandWindowId);
|
||||
}
|
||||
|
||||
const QSize size(rootObject()->width(), rootObject()->height());
|
||||
setMaximumSize(size);
|
||||
setMinimumSize(size);
|
||||
|
@ -58,6 +58,13 @@ SecondaryConfigView::SecondaryConfigView(Latte::View *view, QWindow *parent)
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setResizeMode(QQuickView::SizeViewToRootObject);
|
||||
@ -179,11 +186,6 @@ void SecondaryConfigView::syncGeometry()
|
||||
return;
|
||||
}
|
||||
|
||||
if (KWindowSystem::isPlatformWayland() && m_waylandWindowId.isNull()) {
|
||||
m_waylandWindowId = m_corona->wm()->winIdFor("latte-dock", geometry());
|
||||
m_corona->wm()->registerIgnoredWindow(m_waylandWindowId);
|
||||
}
|
||||
|
||||
const QSize size(rootObject()->width(), rootObject()->height());
|
||||
setMaximumSize(size);
|
||||
setMinimumSize(size);
|
||||
|
@ -138,6 +138,8 @@ signals:
|
||||
void currentDesktopChanged();
|
||||
void currentActivityChanged();
|
||||
|
||||
void latteWindowAdded();
|
||||
|
||||
protected:
|
||||
QString m_currentDesktop;
|
||||
QString m_currentActivity;
|
||||
|
@ -64,6 +64,8 @@ public:
|
||||
| Qt::NoDropShadowWindowHint
|
||||
| Qt::WindowDoesNotAcceptFocus);
|
||||
|
||||
connect(m_waylandInterface, &WindowSystem::AbstractWindowInterface::latteWindowAdded, this, &GhostWindow::identifyWinId);
|
||||
|
||||
setupWaylandIntegration();
|
||||
show();
|
||||
}
|
||||
@ -78,10 +80,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_winId.isNull()) {
|
||||
m_winId = m_waylandInterface->winIdFor("latte-dock", geometry());
|
||||
m_waylandInterface->registerIgnoredWindow(m_winId);
|
||||
}
|
||||
m_validGeometry = rect;
|
||||
|
||||
setMinimumSize(rect.size());
|
||||
setMaximumSize(rect.size());
|
||||
@ -112,6 +111,17 @@ public:
|
||||
|
||||
KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr};
|
||||
WindowSystem::WaylandInterface *m_waylandInterface{nullptr};
|
||||
|
||||
//! geometry() function under wayland does not return nice results
|
||||
QRect m_validGeometry;
|
||||
|
||||
public slots:
|
||||
void identifyWinId() {
|
||||
if (m_winId.isNull()) {
|
||||
m_winId = m_waylandInterface->winIdFor("latte-dock", m_validGeometry);
|
||||
m_waylandInterface->registerIgnoredWindow(m_winId);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
namespace WindowSystem {
|
||||
@ -453,7 +463,7 @@ AppData WaylandInterface::appDataFor(WindowId wid) const
|
||||
auto window = windowFor(wid);
|
||||
|
||||
const AppData &data = appDataFromUrl(windowUrlFromMetadata(window->appId(),
|
||||
window->pid(), rulesConfig));
|
||||
window->pid(), rulesConfig));
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -584,14 +594,14 @@ void WaylandInterface::requestToggleMaximized(WindowId wid) const
|
||||
{
|
||||
auto w = windowFor(wid);
|
||||
|
||||
if (w && isValidWindow(w)) {
|
||||
if (w && isValidWindow(w)) {
|
||||
#if KF5_VERSION_MINOR >= 52
|
||||
if (!m_currentDesktop.isEmpty()) {
|
||||
w->requestEnterVirtualDesktop(m_currentDesktop);
|
||||
}
|
||||
#endif
|
||||
w->requestToggleMaximized();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool WaylandInterface::isPlasmaDesktop(const KWayland::Client::PlasmaWindow *w) const
|
||||
@ -671,6 +681,10 @@ void WaylandInterface::windowCreatedProxy(KWayland::Client::PlasmaWindow *w)
|
||||
});
|
||||
|
||||
emit windowAdded(w->internalId());
|
||||
|
||||
if (w->appId() == "latte-dock") {
|
||||
emit latteWindowAdded();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user