Remove remaining X11Extras stuff

This commit is contained in:
Jonas Kvinge
2024-09-13 00:30:37 +02:00
parent 877c9ca41a
commit 23fb4651be
6 changed files with 13 additions and 88 deletions

View File

@@ -35,22 +35,12 @@
#include <xcb/xcb.h>
#include <xcb/xproto.h>
#ifndef HAVE_QX11APPLICATION
# if defined(HAVE_X11EXTRAS)
# include <QX11Info>
# elif defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
# include <qpa/qplatformnativeinterface.h>
# endif
#endif
const QVector<quint32> GlobalShortcut::mask_modifiers_ = QVector<quint32>() << 0 << Mod2Mask << LockMask << (Mod2Mask | LockMask);
namespace {
Display *X11Display() {
#ifdef HAVE_QX11APPLICATION // Qt 6.2: Use the new native interface.
if (!qApp) return nullptr;
if (QNativeInterface::QX11Application *x11_app = qApp->nativeInterface<QNativeInterface::QX11Application>()) {
@@ -58,31 +48,10 @@ Display *X11Display() {
}
return nullptr;
#elif defined(HAVE_X11EXTRAS) // Qt 5: Use X11Extras
return QX11Info::display();
#elif defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H) // Use private headers.
if (!qApp) return nullptr;
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
if (!native) return nullptr;
return reinterpret_cast<Display*>(native->nativeResourceForIntegration("display"));
#else
# error "Missing QX11Application, X11Extras or qpa/qplatformnativeinterface.h header."
#endif
}
quint32 AppRootWindow() {
#ifdef HAVE_QX11APPLICATION // Qt 6.2: Use the new native interface.
if (QNativeInterface::QX11Application *x11_app = qApp->nativeInterface<QNativeInterface::QX11Application>()) {
if (x11_app->display()) {
return XDefaultRootWindow(x11_app->display());
@@ -90,28 +59,6 @@ quint32 AppRootWindow() {
}
return 0;
#elif defined(HAVE_X11EXTRAS) // Qt 5: Use X11Extras
return QX11Info::appRootWindow();
#elif defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H) // Use private headers.
if (!qApp) return 0;
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
if (!native) return 0;
QScreen *screen = QGuiApplication::primaryScreen();
if (!screen) return 0;
return static_cast<xcb_window_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen("rootwindow", screen)));
#else
# error "Missing QX11Application, X11Extras or qpa/qplatformnativeinterface.h header."
#endif
}
} // namespace