15#if QT_CONFIG(draganddrop)
20#ifndef QT_NO_SESSIONMANAGER
27#include <QtGui/private/qgenericunixfontdatabase_p.h>
28#include <QtGui/private/qgenericunixservices_p.h>
32#include <QtGui/private/qguiapplication_p.h>
34#if QT_CONFIG(xcb_xlib)
39#if QT_CONFIG(xcb_native_painting)
45#include <qpa/qplatforminputcontextfactory_p.h>
46#include <private/qgenericunixthemes_p.h>
47#include <qpa/qplatforminputcontext.h>
49#include <QtGui/QOpenGLContext>
50#include <QtGui/QScreen>
51#include <QtGui/QOffscreenSurface>
52#if QT_CONFIG(accessibility)
53#include <qpa/qplatformaccessibility.h>
54#if QT_CONFIG(accessibility_atspi_bridge)
55#include <QtGui/private/qspiaccessiblebridge_p.h>
59#include <QtCore/QFileInfo>
74#if defined(QT_DEBUG) && defined(Q_OS_LINUX)
76 const QFileInfo parentProcExe(parentProc +
"/exe"_L1);
77 if (parentProcExe.isSymLink())
78 return parentProcExe.symLinkTarget().endsWith(
"/gdb"_L1);
79 QFile f(parentProc +
"/cmdline"_L1);
84 while (
f.getChar(&
c) &&
c) {
109 , m_defaultVisualId(UINT_MAX)
116 qRegisterMetaType<QXcbWindow*>();
117#if QT_CONFIG(xcb_xlib)
124 bool noGrabArg =
false;
125 bool doGrabArg =
false;
128 for (
int i = 1;
i < argc;
i++) {
130 if (
arg.startsWith(
"--"))
132 if (
arg ==
"-display" &&
i < argc - 1)
134 else if (
arg ==
"-name" &&
i < argc - 1)
135 m_instanceName = argv[++
i];
136 else if (
arg ==
"-nograb")
138 else if (
arg ==
"-dograb")
140 else if (
arg ==
"-visual" &&
i < argc - 1) {
144 m_defaultVisualId = UINT_MAX;
153 if (noGrabArg && doGrabArg && underDebugger) {
154 qWarning(
"Both -nograb and -dograb command line arguments specified. Please pick one. -nograb takes precedence");
159 if (!noGrabArg && !doGrabArg && underDebugger) {
160 qCDebug(lcQpaXcb,
"Qt: gdb: -nograb added to command-line options.\n"
161 "\t Use the -dograb option to enforce grabbing.");
164 m_canGrab = (!underDebugger && !noGrabArg) || (underDebugger && doGrabArg);
173 m_connection =
nullptr;
179#if QT_CONFIG(xcb_native_painting)
181 qCDebug(lcQpaXcb,
"QXCB USING NATIVE PAINTING");
190 m_connection =
nullptr;
191 m_instance =
nullptr;
196#if QT_CONFIG(xcb_native_painting)
209 if (
window->supportsOpenGL()) {
241 if (!glIntegration) {
242 qWarning(
"QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled");
248# if QT_CONFIG(xcb_glx_plugin)
252 if (
auto *glxIntegration =
dynamic_cast<QGLXIntegration*
>(m_connection->
glIntegration()))
253 return glxIntegration->createOpenGLContext(
context, visualInfo, shareContext);
263 if (
auto *eglIntegration =
dynamic_cast<QEGLIntegration*
>(m_connection->
glIntegration()))
264 return eglIntegration->createOpenGLContext(
context,
display, shareContext);
277 if (isTrayIconWindow) {
279#if QT_CONFIG(xcb_native_painting)
294 if (!glIntegration) {
295 qWarning(
"QXcbIntegration: Cannot create platform offscreen surface, neither GLX nor EGL are enabled");
307 if (
const auto *integration =
connection()->glIntegration())
344 const auto defaultInputContext =
"compose"_L1;
348 if (icStrs.isEmpty())
349 icStrs = { defaultInputContext };
351 if (!m_inputContext && !icStrs.contains(defaultInputContext)
377 return m_fontDatabase.
data();
382 return m_nativeInterface.
data();
385#ifndef QT_NO_CLIPBOARD
392#if QT_CONFIG(draganddrop)
393#include <private/qsimpledrag_p.h>
404 return m_connection->drag();
410 return m_inputContext.
data();
413#if QT_CONFIG(accessibility)
414QPlatformAccessibility *QXcbIntegration::accessibility()
const
416#if !defined(QT_NO_ACCESSIBILITY_ATSPI_BRIDGE)
417 if (!m_accessibility) {
419 "Initializing accessibility without event-dispatcher!");
424 return m_accessibility.data();
430 return m_services.
data();
448#define RETURN_VALID_XSETTINGS(key) { \
449 auto value = connection()->primaryScreen()->xSettings()->setting(key); \
450 if (value.isValid()) return value; \
489 if (
screen->logicalDpi().first > dpi)
490 dpi =
screen->logicalDpi().first;
491 if (
screen->logicalDpi().second > dpi)
492 dpi =
screen->logicalDpi().second;
514 const int lastSlashPos =
result.lastIndexOf(u
'/');
515 if (lastSlashPos != -1)
516 result.remove(0, lastSlashPos + 1);
545 m_wmClass = std::move(
name).toLocal8Bit() +
'\0' + std::move(
className).toLocal8Bit() +
'\0';
559 m_connection->
sync();
578#if QT_CONFIG(xcb_native_painting)
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
static QAbstractEventDispatcher * eventDispatcher()
Returns a pointer to the event dispatcher object for the main thread.
static QStringList arguments()
QString applicationName
the name of this application
void setApplicationBadge(qint64 number)
static QPlatformTheme * createUnixTheme(const QString &name)
Creates a UNIX theme according to the detected desktop environment.
static QStringList themeNames()
QScreen * primaryScreen
the primary (or default) screen of the application.
bool isEmpty() const noexcept
QScreen * screen() const
Returns the screen to which the offscreen surface is connected.
static QPlatformInputContext * create()
static QStringList requested()
The QPlatformInputContext class abstracts the input method dependent data and composing state.
The QPlatformOpenGLContext class provides an abstraction for native GL contexts.
T * data() const noexcept
Returns the value of the pointer referenced by this object.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
The QScreen class is used to query screen properties. \inmodule QtGui.
QPlatformScreen * handle() const
Get the platform screen handle.
QSimpleDrag implements QBasicDrag for Drag and Drop operations within the Qt Application itself.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLocal8Bit(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QVulkanInstance class represents a native Vulkan instance, enabling Vulkan rendering onto a QSurf...
static void handleThemeChange(QWindow *window=nullptr)
QXcbKeyboard * keyboard() const
QXcbGlIntegration * glIntegration() const
QXcbScreen * primaryScreen() const
QXcbClipboard * clipboard() const
static QAbstractEventDispatcher * createEventDispatcher(QXcbConnection *connection)
virtual bool supportsSwitchableWidgetComposition() const
virtual QPlatformOpenGLContext * createPlatformOpenGLContext(QOpenGLContext *context) const =0
virtual QXcbWindow * createWindow(QWindow *window) const =0
virtual QPlatformOffscreenSurface * createPlatformOffscreenSurface(QOffscreenSurface *surface) const =0
QPlatformServices * services() const override
bool hasCapability(Capability cap) const override
QByteArray wmClass() const
QPlatformKeyMapper * keyMapper() const override
Accessor for the platform integration's key mapper.
QPlatformWindow * createForeignWindow(QWindow *window, WId nativeHandle) const override
void initialize() override
Performs initialization steps that depend on having an event dispatcher available.
QPlatformNativeInterface * nativeInterface() const override
bool nativePaintingEnabled() const
QPlatformOpenGLContext * createPlatformOpenGLContext(QOpenGLContext *context) const override
Factory function for QPlatformOpenGLContext.
QPlatformTheme * createPlatformTheme(const QString &name) const override
void beep() const override
QPlatformFontDatabase * fontDatabase() const override
Accessor for the platform integration's fontdatabase.
void setApplicationBadge(qint64 number) override
QPlatformPixmap * createPlatformPixmap(QPlatformPixmap::PixelType type) const override
Factory function for QPlatformPixmap.
QStringList themeNames() const override
QPlatformWindow * createPlatformWindow(QWindow *window) const override
Factory function for QPlatformWindow.
QVariant styleHint(StyleHint hint) const override
QPlatformBackingStore * createPlatformBackingStore(QWindow *window) const override
Factory function for QPlatformBackingStore.
static QXcbIntegration * instance()
QPlatformClipboard * clipboard() const override
Accessor for the platform integration's clipboard.
QXcbIntegration(const QStringList ¶meters, int &argc, char **argv)
QXcbConnection * connection() const
QAbstractEventDispatcher * createEventDispatcher() const override
Factory function for the GUI event dispatcher.
QPlatformOffscreenSurface * createPlatformOffscreenSurface(QOffscreenSurface *surface) const override
Factory function for QOffscreenSurface.
void moveToScreen(QWindow *window, int screen)
QPlatformInputContext * inputContext() const override
Returns the platforms input context.
QXcbXSettings * xSettings() const
QString portalWindowIdentifier(QWindow *window) override
static bool isTrayIconWindow(QWindow *window)
void registerCallbackForProperty(const QByteArray &property, PropertyChangeFunc func, void *handle)
QList< QVariant > arguments
struct wl_display * display
Combined button and popup list for selecting options.
@ AA_CompressHighFrequencyEvents
static QString displayName(CGDirectDisplayID displayID)
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
typedef EGLDisplay(EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform
QPlatformFontDatabase QGenericUnixFontDatabase
#define qCDebug(category,...)
GLenum GLenum GLsizei const GLuint GLboolean enabled
#define Q_ASSERT_X(cond, x, msg)
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept
static int toInt(const QChar &qc, int R)
const char className[16]
[1]
static const auto xsNetCursorBlink
static const auto xsNetDndDragThreshold
static QString argv0BaseName()
static const auto xsNetDoubleClickTime
static const auto xsNetCursorBlinkTime
static bool runningUnderDebugger()
static const auto xsNetDoubleClickDistance
#define RETURN_VALID_XSETTINGS(key)
static const char resourceNameVar[]
void qt_xcb_native_x11_info_init(QXcbConnection *conn)