mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-07 18:15:15 +00:00
Revert "Use QMenuBar instead of own global menu implementation on Linux"
This reverts commit 79f96480c2
.
This commit is contained in:
@@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include <surface.h>
|
||||
#include <xdgforeign.h>
|
||||
#include <plasmashell.h>
|
||||
#include <appmenu.h>
|
||||
|
||||
using namespace KWayland::Client;
|
||||
|
||||
@@ -36,6 +37,10 @@ public:
|
||||
return _plasmaShell.get();
|
||||
}
|
||||
|
||||
[[nodiscard]] AppMenuManager *appMenuManager() {
|
||||
return _appMenuManager.get();
|
||||
}
|
||||
|
||||
[[nodiscard]] QEventLoop &interfacesLoop() {
|
||||
return _interfacesLoop;
|
||||
}
|
||||
@@ -51,6 +56,7 @@ private:
|
||||
Registry _applicationRegistry;
|
||||
std::unique_ptr<XdgExporter> _xdgExporter;
|
||||
std::unique_ptr<PlasmaShell> _plasmaShell;
|
||||
std::unique_ptr<AppMenuManager> _appMenuManager;
|
||||
QEventLoop _interfacesLoop;
|
||||
bool _interfacesAnnounced = false;
|
||||
};
|
||||
@@ -117,6 +123,21 @@ WaylandIntegration::Private::Private()
|
||||
&PlasmaShell::destroy);
|
||||
});
|
||||
|
||||
connect(
|
||||
&_applicationRegistry,
|
||||
&Registry::appMenuAnnounced,
|
||||
[=](uint name, uint version) {
|
||||
_appMenuManager = std::unique_ptr<AppMenuManager>{
|
||||
_applicationRegistry.createAppMenuManager(name, version),
|
||||
};
|
||||
|
||||
connect(
|
||||
_applicationConnection,
|
||||
&ConnectionThread::connectionDied,
|
||||
_appMenuManager.get(),
|
||||
&AppMenuManager::destroy);
|
||||
});
|
||||
|
||||
_connection.initConnection();
|
||||
}
|
||||
|
||||
@@ -187,5 +208,27 @@ void WaylandIntegration::skipTaskbar(QWindow *window, bool skip) {
|
||||
plasmaSurface->setSkipTaskbar(skip);
|
||||
}
|
||||
|
||||
void WaylandIntegration::registerAppMenu(
|
||||
QWindow *window,
|
||||
const QString &serviceName,
|
||||
const QString &objectPath) {
|
||||
const auto manager = _private->appMenuManager();
|
||||
if (!manager) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto surface = Surface::fromWindow(window);
|
||||
if (!surface) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto appMenu = manager->create(surface, surface);
|
||||
if (!appMenu) {
|
||||
return;
|
||||
}
|
||||
|
||||
appMenu->setAddress(serviceName, objectPath);
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace Platform
|
||||
|
Reference in New Issue
Block a user