Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qminimaleglintegration.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
6
8#ifndef QT_NO_OPENGL
10#endif
11#include <QtGui/private/qgenericunixfontdatabase_p.h>
12
13#if defined(Q_OS_UNIX)
14# include <QtGui/private/qgenericunixeventdispatcher_p.h>
15#elif defined(Q_OS_WIN)
16# include <QtGui/private/qwindowsguieventdispatcher_p.h>
17#endif
18
19#include <qpa/qplatformwindow.h>
20#include <QtGui/QSurfaceFormat>
21#include <QtGui/QOpenGLContext>
22#include <QtGui/QScreen>
23#include <qpa/qwindowsysteminterface.h>
24
25// this is where EGL headers are pulled in, make sure it is last
27
29
30QMinimalEglIntegration::QMinimalEglIntegration()
31 : mFontDb(new QGenericUnixFontDatabase()), mScreen(new QMinimalEglScreen(EGL_DEFAULT_DISPLAY))
32{
33 QWindowSystemInterface::handleScreenAdded(mScreen);
34
35#ifdef QEGL_EXTRA_DEBUG
36 qWarning("QMinimalEglIntegration\n");
37#endif
38}
39
40QMinimalEglIntegration::~QMinimalEglIntegration()
41{
42 QWindowSystemInterface::handleScreenRemoved(mScreen);
43 delete mFontDb;
44}
45
46bool QMinimalEglIntegration::hasCapability(QPlatformIntegration::Capability cap) const
47{
48 switch (cap) {
49 case ThreadedPixmaps: return true;
50 case OpenGL: return true;
51 case ThreadedOpenGL: return true;
52 default: return QPlatformIntegration::hasCapability(cap);
53 }
54}
55
56QPlatformWindow *QMinimalEglIntegration::createPlatformWindow(QWindow *window) const
57{
58#ifdef QEGL_EXTRA_DEBUG
59 qWarning("QMinimalEglIntegration::createPlatformWindow %p\n",window);
60#endif
61 QPlatformWindow *w = new QMinimalEglWindow(window);
62 w->requestActivateWindow();
63 return w;
64}
65
66
67QPlatformBackingStore *QMinimalEglIntegration::createPlatformBackingStore(QWindow *window) const
68{
69#ifdef QEGL_EXTRA_DEBUG
70 qWarning("QMinimalEglIntegration::createWindowSurface %p\n", window);
71#endif
72#ifndef QT_NO_OPENGL
73 return new QMinimalEglBackingStore(window);
74#else
75 Q_UNUSED(window);
76 return nullptr;
77#endif
78}
79#ifndef QT_NO_OPENGL
80QPlatformOpenGLContext *QMinimalEglIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
81{
82 return static_cast<QMinimalEglScreen *>(context->screen()->handle())->platformContext();
83}
84#endif
85
86QPlatformFontDatabase *QMinimalEglIntegration::fontDatabase() const
87{
88 return mFontDb;
89}
90
91QAbstractEventDispatcher *QMinimalEglIntegration::createEventDispatcher() const
92{
93#if defined(Q_OS_UNIX)
94 return createUnixEventDispatcher();
95#elif defined(Q_OS_WIN)
96 return new QWindowsGuiEventDispatcher;
97#else
98 return nullptr;
99#endif
100}
101
102QVariant QMinimalEglIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
103{
104 if (hint == QPlatformIntegration::ShowIsFullScreen)
105 return true;
106
107 return QPlatformIntegration::styleHint(hint);
108}
109
110QT_END_NAMESPACE
QPlatformOpenGLContext * platformContext() const
Combined button and popup list for selecting options.