mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-02-03 02:47:36 +01:00
globalshortcut-x11: Use private header for accessing app root window
QX11Application Currently lacks a method for this. Fixes #893
This commit is contained in:
parent
01d4d404c0
commit
1b8966b3a4
@ -373,17 +373,13 @@ optional_component(GLOBALSHORTCUTS ON "Global shortcuts"
|
|||||||
DEPENDS "D-Bus, X11, Windows or macOS" HAVE_GLOBALSHORTCUTS_SUPPORT
|
DEPENDS "D-Bus, X11, Windows or macOS" HAVE_GLOBALSHORTCUTS_SUPPORT
|
||||||
)
|
)
|
||||||
|
|
||||||
if(BUILD_WITH_QT6 AND (Qt6Core_VERSION VERSION_EQUAL 6.2.0 OR Qt6Core_VERSION VERSION_GREATER 6.2.0))
|
if(HAVE_X11EXTRAS OR HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
|
||||||
optional_component(X11_GLOBALSHORTCUTS ON "X11 global shortcuts" DEPENDS "X11" X11_FOUND)
|
|
||||||
else()
|
|
||||||
if(HAVE_X11EXTRAS OR HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
|
|
||||||
set(HAVE_X11EXTRAS_OR_QPA_QPLATFORMNATIVEINTERFACE_H ON)
|
set(HAVE_X11EXTRAS_OR_QPA_QPLATFORMNATIVEINTERFACE_H ON)
|
||||||
endif()
|
|
||||||
optional_component(X11_GLOBALSHORTCUTS ON "X11 global shortcuts"
|
|
||||||
DEPENDS "X11" X11_FOUND
|
|
||||||
DEPENDS "Qt >= 6.2, X11Extras or qpa/qplatformnativeinterface.h header" HAVE_X11EXTRAS_OR_QPA_QPLATFORMNATIVEINTERFACE_H
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
optional_component(X11_GLOBALSHORTCUTS ON "X11 global shortcuts"
|
||||||
|
DEPENDS "X11" X11_FOUND
|
||||||
|
DEPENDS "X11Extras or qpa/qplatformnativeinterface.h header" HAVE_X11EXTRAS_OR_QPA_QPLATFORMNATIVEINTERFACE_H
|
||||||
|
)
|
||||||
|
|
||||||
optional_component(AUDIOCD ON "Devices: Audio CD support"
|
optional_component(AUDIOCD ON "Devices: Audio CD support"
|
||||||
DEPENDS "libcdio" LIBCDIO_FOUND
|
DEPENDS "libcdio" LIBCDIO_FOUND
|
||||||
|
@ -37,14 +37,14 @@
|
|||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#include <xcb/xproto.h>
|
#include <xcb/xproto.h>
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
|
#include <QGuiApplication>
|
||||||
# include <QGuiApplication>
|
|
||||||
#elif defined(HAVE_X11EXTRAS)
|
#if defined(HAVE_X11EXTRAS)
|
||||||
# include <QX11Info>
|
# include <QX11Info>
|
||||||
#elif defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
|
#elif defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
|
||||||
# include <qpa/qplatformnativeinterface.h>
|
# include <qpa/qplatformnativeinterface.h>
|
||||||
#else
|
#else
|
||||||
# error "Missing Qt >= 6.2, X11Extras or qpa/qplatformnativeinterface.h header."
|
# error "Missing X11Extras or qpa/qplatformnativeinterface.h header."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const QVector<quint32> GlobalShortcut::mask_modifiers_ = QVector<quint32>() << 0 << Mod2Mask << LockMask << (Mod2Mask | LockMask);
|
const QVector<quint32> GlobalShortcut::mask_modifiers_ = QVector<quint32>() << 0 << Mod2Mask << LockMask << (Mod2Mask | LockMask);
|
||||||
@ -87,10 +87,10 @@ Display *X11Display() {
|
|||||||
|
|
||||||
quint32 AppRootWindow() {
|
quint32 AppRootWindow() {
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0) // 6.2: Use the new native interface.
|
#if 0 // 6.2: There currently isn't a way to access rootWindow through QX11Application.
|
||||||
|
|
||||||
if (QNativeInterface::QX11Application *x11_app = qApp->nativeInterface<QNativeInterface::QX11Application>()) {
|
if (QNativeInterface::QX11Application *x11_app = qApp->nativeInterface<QNativeInterface::QX11Application>()) {
|
||||||
return static_cast<xcb_window_t>(reinterpret_cast<quintptr>(x11_app->connection()));
|
return static_cast<xcb_window_t>(reinterpret_cast<quintptr>(x11_app->rootWindow()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user