Advance KWin Wayland port for Red Bear desktop session

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-04-18 17:58:57 +01:00
parent 5451f25a7a
commit 85a5ceaa3c
59 changed files with 726 additions and 509 deletions
@@ -11,10 +11,7 @@
#include "appmenu.h"
#include "window.h"
#include "workspace.h"
#include <appmenu_interface.h>
#include <QDBusObjectPath>
#include <QDBusServiceWatcher>
#include "decorations/decorationbridge.h"
#include <KDecoration3/DecorationSettings>
@@ -22,28 +19,8 @@
namespace KWin
{
static const QString s_viewService(QStringLiteral("org.kde.kappmenuview"));
ApplicationMenu::ApplicationMenu()
: m_appmenuInterface(new OrgKdeKappmenuInterface(QStringLiteral("org.kde.kappmenu"), QStringLiteral("/KAppMenu"), QDBusConnection::sessionBus(), this))
{
connect(m_appmenuInterface, &OrgKdeKappmenuInterface::showRequest, this, &ApplicationMenu::slotShowRequest);
connect(m_appmenuInterface, &OrgKdeKappmenuInterface::menuShown, this, &ApplicationMenu::slotMenuShown);
connect(m_appmenuInterface, &OrgKdeKappmenuInterface::menuHidden, this, &ApplicationMenu::slotMenuHidden);
m_kappMenuWatcher = new QDBusServiceWatcher(QStringLiteral("org.kde.kappmenu"), QDBusConnection::sessionBus(),
QDBusServiceWatcher::WatchForRegistration | QDBusServiceWatcher::WatchForUnregistration, this);
connect(m_kappMenuWatcher, &QDBusServiceWatcher::serviceRegistered, this, [this]() {
m_applicationMenuEnabled = true;
Q_EMIT applicationMenuEnabledChanged(true);
});
connect(m_kappMenuWatcher, &QDBusServiceWatcher::serviceUnregistered, this, [this]() {
m_applicationMenuEnabled = false;
Q_EMIT applicationMenuEnabledChanged(false);
});
m_applicationMenuEnabled = QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.kappmenu"));
}
bool ApplicationMenu::applicationMenuEnabled() const
@@ -53,13 +30,7 @@ bool ApplicationMenu::applicationMenuEnabled() const
void ApplicationMenu::setViewEnabled(bool enabled)
{
if (enabled) {
QDBusConnection::sessionBus().interface()->registerService(s_viewService,
QDBusConnectionInterface::QueueService,
QDBusConnectionInterface::DontAllowReplacement);
} else {
QDBusConnection::sessionBus().interface()->unregisterService(s_viewService);
}
Q_UNUSED(enabled)
}
void ApplicationMenu::slotShowRequest(const QString &serviceName, const QDBusObjectPath &menuObjectPath, int actionId)
@@ -92,10 +63,9 @@ void ApplicationMenu::slotMenuHidden(const QString &serviceName, const QDBusObje
void ApplicationMenu::showApplicationMenu(const QPoint &p, Window *c, int actionId)
{
if (!c->hasApplicationMenu()) {
return;
}
m_appmenuInterface->showMenu(p.x(), p.y(), c->applicationMenuServiceName(), QDBusObjectPath(c->applicationMenuObjectPath()), actionId);
Q_UNUSED(p)
Q_UNUSED(c)
Q_UNUSED(actionId)
}
Window *ApplicationMenu::findWindowWithApplicationMenu(const QString &serviceName, const QDBusObjectPath &menuObjectPath)