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

wm:support ignored windows

--x11 implementation is in place and wayland
case must be updated accordingly
This commit is contained in:
Michail Vourlakos 2019-07-13 14:51:26 +03:00
parent 30c5a00835
commit 79f392723e
6 changed files with 54 additions and 5 deletions

View File

@ -62,6 +62,10 @@ PrimaryConfigView::PrimaryConfigView(Plasma::Containment *containment, Latte::Vi
setupWaylandIntegration();
if (KWindowSystem::isPlatformX11()) {
m_corona->wm()->registerIgnoredWindow(winId());
}
setScreen(m_latteView->screen());
if (containment) {
@ -121,6 +125,10 @@ PrimaryConfigView::~PrimaryConfigView()
{
qDebug() << "ConfigView deleting ...";
if (KWindowSystem::isPlatformX11()) {
m_corona->wm()->unregisterIgnoredWindow(winId());
}
deleteSecondaryWindow();
for (const auto &var : connections) {

View File

@ -56,6 +56,10 @@ SecondaryConfigView::SecondaryConfigView(Latte::View *view, QWindow *parent)
setupWaylandIntegration();
if (KWindowSystem::isPlatformX11()) {
m_corona->wm()->registerIgnoredWindow(winId());
}
setResizeMode(QQuickView::SizeViewToRootObject);
setScreen(m_latteView->screen());
@ -102,6 +106,10 @@ SecondaryConfigView::~SecondaryConfigView()
{
qDebug() << "SecDockConfigView deleting ...";
if (KWindowSystem::isPlatformX11()) {
m_corona->wm()->unregisterIgnoredWindow(winId());
}
for (const auto &var : connections) {
QObject::disconnect(var);
}

View File

@ -69,7 +69,7 @@ View::View(Plasma::Corona *corona, QScreen *targetScreen, bool byPassWM)
m_contextMenu(new ViewPart::ContextMenu(this)),
m_effects(new ViewPart::Effects(this)),
m_positioner(new ViewPart::Positioner(this)) //needs to be created after Effects because it catches some of its signals
{
{
setTitle(corona->kPackage().metadata().name());
setIcon(qGuiApp->windowIcon());
setResizeMode(QuickViewSharedEngine::SizeRootObjectToView);
@ -139,6 +139,10 @@ View::View(Plasma::Corona *corona, QScreen *targetScreen, bool byPassWM)
m_corona = qobject_cast<Latte::Corona *>(this->corona());
if (m_corona) {
if (KWindowSystem::isPlatformX11()) {
m_corona->wm()->registerIgnoredWindow(winId());
}
connect(m_corona, &Latte::Corona::viewLocationChanged, this, &View::dockLocationChanged);
}
}
@ -147,6 +151,10 @@ View::~View()
{
m_inDelete = true;
if (KWindowSystem::isPlatformX11()) {
m_corona->wm()->unregisterIgnoredWindow(winId());
}
//! clear Layout connections
m_visibleHackTimer1.stop();
m_visibleHackTimer2.stop();

View File

@ -96,6 +96,24 @@ Tracker::Windows *AbstractWindowInterface::windowsTracker() const
return m_windowsTracker;
}
//! Register Latte Normal Windows in order to be tracked
void AbstractWindowInterface::registerIgnoredWindow(WindowId wid)
{
if (!m_ignoredWindows.contains(wid)) {
m_ignoredWindows.append(wid);
emit windowChanged(wid);
}
}
void AbstractWindowInterface::unregisterIgnoredWindow(WindowId wid)
{
if (!m_ignoredWindows.contains(wid)) {
m_ignoredWindows.removeAll(wid);
emit windowRemoved(wid);
}
}
//! Activities switching
void AbstractWindowInterface::switchToNextActivity()
{

View File

@ -117,6 +117,9 @@ public:
QString currentDesktop() const;
QString currentActivity() const;
void registerIgnoredWindow(WindowId wid);
void unregisterIgnoredWindow(WindowId wid);
void switchToNextActivity();
void switchToPreviousActivity();
@ -139,6 +142,10 @@ protected:
QString m_currentDesktop;
QString m_currentActivity;
//! windows that must be ignored from tracking, a good example are Latte::Views and
//! their Configuration windows
QList<WindowId> m_ignoredWindows;
QPointer<KActivities::Consumer> m_activities;
//! Sending too fast plenty of signals for the same window

View File

@ -574,8 +574,8 @@ bool XWindowInterface::isValidWindow(const KWindowInfo &winfo) const
NET::WindowType winType = winfo.windowType(types);
const auto winClass = KWindowInfo(winfo.win(), 0, NET::WM2WindowClass).windowClassName();
//! ignore latte related windows from tracking
if (winClass == "latte-dock") {
//! ignored windows from tracking
if (m_ignoredWindows.contains(winfo.win())) {
return false;
}
@ -625,8 +625,8 @@ void XWindowInterface::windowChangedProxy(WId wid, NET::Properties prop1, NET::P
const auto winClass = info.windowClassName();
//! ignore latte related windows from tracking
if (winClass == "latte-dock") {
//! ignored windows do not trackd
if (m_ignoredWindows.contains(wid)) {
return;
}