Make Nheko compile on Qt6

This commit is contained in:
Nicolas Werner 2023-06-02 00:24:26 +02:00
parent 0ac46ea209
commit b518f6902e
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
39 changed files with 108 additions and 361 deletions

View file

@ -5,16 +5,12 @@
#include "NhekoGlobalObject.h"
#include <QApplication>
#include <QGuiApplication>
#include <QDesktopServices>
#include <QStyle>
#include <QUrl>
#include <QWindow>
// for some reason that is not installed in our macOS env...
#ifndef Q_OS_MAC
#include <QtPlatformHeaders/QXcbWindowFunctions>
#endif
#include "Cache_p.h"
#include "ChatPage.h"
#include "Logging.h"
@ -22,6 +18,8 @@
#include "Utils.h"
#include "voip/WebRTCSession.h"
#include <xcb/xproto.h>
Nheko::Nheko()
{
connect(
@ -186,7 +184,21 @@ Nheko::createRoom(bool space,
void
Nheko::setWindowRole([[maybe_unused]] QWindow *win, [[maybe_unused]] QString newRole) const
{
#ifndef Q_OS_MAC
QXcbWindowFunctions::setWmWindowRole(win, newRole.toUtf8());
#endif
const QNativeInterface::QX11Application *x11Interface = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
if (!x11Interface) return;
auto connection = x11Interface->connection();
auto role = newRole.toStdString();
char WM_WINDOW_ROLE[] = "WM_WINDOW_ROLE";
auto cookie = xcb_intern_atom(connection, false, std::size(WM_WINDOW_ROLE) - 1, WM_WINDOW_ROLE);
xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(connection, cookie, nullptr);
auto atom = reply ->atom;
free(reply);
xcb_change_property(connection, XCB_PROP_MODE_REPLACE, win->winId(),
atom, XCB_ATOM_STRING, 8,
role.size(), role.data());
}