-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Qt6 Removes X11Info from Qt5::X11Extras #60
Comments
I think I can help answer how to fix this the "correct" way without having to access private headers that could go away at any time. These places you mention all need access to the
To get the
|
There's a Here's how
xcb_connection_t *QX11Info::connection()
{
if (!qApp)
return nullptr;
QPlatformNativeInterface *native = qApp->platformNativeInterface();
if (!native)
return nullptr;
void *connection = native->nativeResourceForIntegration(QByteArray("connection"));
return reinterpret_cast<xcb_connection_t *>(connection);
} The new Qt6 API: Note, this is not backwards compatible, as Looks like I'll need to have separate logic for Qt5 + Qt6.
QXcbBasicConnection::QXcbBasicConnection(const char *displayName)
: m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY"))
{
#if QT_CONFIG(xcb_xlib)
Display *dpy = XOpenDisplay(m_displayName.constData());
if (dpy) {
m_primaryScreenNumber = DefaultScreen(dpy);
m_xcbConnection = XGetXCBConnection(dpy);
XSetEventQueueOwner(dpy, XCBOwnsEventQueue);
XSetErrorHandler(nullErrorHandler);
XSetIOErrorHandler(ioErrorHandler);
m_xlibDisplay = dpy;
}
#else
m_xcbConnection = xcb_connect(m_displayName.constData(), &m_primaryScreenNumber);
#endif |
Hmm Not sure where I had in my head that there was no connection method... I see now that it's there... You're definitely right that in Qt5 QGuiApplication::platformNativeInterface() is severely undocumented (but at least they show it exists in the docs!). Here is the header for it: And here's the XCB implementation. in a You'll need to have separate Qt5 and Qt6 implementations for this to work, as far as I understand - but it'll be using stable APIs that won't change on you. I think there's a good chance that the QX11Info private APIs will be removed at some point in the near future. |
TODO: I need to add #if BREEZE_HAVE_QTX11EXTRAS
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#endif
#endif |
Eg: https://invent.kde.org/plasma/breeze/-/commit/59142d5b800703986c1f4f71ab150bf4b4b23f3a#0f8721806070aa2f5fd1a8c2d4f6c865f35f96ab_27_27 Also added check for HAVE_X11 in Decoration's usage of QX11Info.
You can do this, but it is kicking the can down the road. In Qt 7, |
Are there any instructions for compiling it with Qt6? |
i tried to build with Qt6 but i receive this error:
|
We use this class in:
Decoration::sendMoveEvent()
andDecoration::windowPos()
to get the global cursor pos for a dragAppMenuModel::onWinIdChanged()
to get the x11 window properties to know the dbus interfaceAppMenuButtonGroup
The text was updated successfully, but these errors were encountered: