mirror of https://github.com/cutefishos/settings
fix(settings): port settings to Qt6
parent
1bc91aabd4
commit
11ae39e242
@ -0,0 +1,43 @@
|
|||||||
|
/* Qt 6 compatibility layer for the legacy QX11Info API. */
|
||||||
|
#ifndef CUTEFISH_QX11INFO_COMPAT
|
||||||
|
#define CUTEFISH_QX11INFO_COMPAT
|
||||||
|
|
||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QScreen>
|
||||||
|
#include <QtGui/qguiapplication_platform.h>
|
||||||
|
#include <xcb/xcb.h>
|
||||||
|
|
||||||
|
class QX11Info
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static bool isPlatformX11()
|
||||||
|
{
|
||||||
|
return nativeInterface() != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static xcb_connection_t *connection()
|
||||||
|
{
|
||||||
|
const auto native = nativeInterface();
|
||||||
|
return native ? native->connection() : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Display *display()
|
||||||
|
{
|
||||||
|
const auto native = nativeInterface();
|
||||||
|
return native ? native->display() : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int appDpiY()
|
||||||
|
{
|
||||||
|
QScreen *screen = qGuiApp ? qGuiApp->primaryScreen() : nullptr;
|
||||||
|
return screen ? qRound(screen->logicalDotsPerInchY()) : 96;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static QNativeInterface::QX11Application *nativeInterface()
|
||||||
|
{
|
||||||
|
return qGuiApp ? qGuiApp->nativeInterface<QNativeInterface::QX11Application>() : nullptr;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue