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
qdirectfbconvenience.h
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
5#ifndef QDIRECTFBCONVENIENCE_H
6#define QDIRECTFBCONVENIENCE_H
7
8#include <QtGui/qimage.h>
9#include <QtCore/QHash>
10#include <QtCore/QEvent>
11#include <QtGui/QPixmap>
12
13#include <directfb.h>
14
15QT_BEGIN_NAMESPACE
16
17class QDirectFbScreen;
18class QPlatformScreen;
19
21{
22public:
24};
25
26
28{
29public:
30 static QImage::Format imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps);
31 static bool pixelFomatHasAlpha(const DFBSurfacePixelFormat format) { return (1 << 16) & format; }
32 static int colorDepthForSurface(const DFBSurfacePixelFormat format);
33
34 //This is set by the graphicssystem constructor
35 static IDirectFB *dfbInterface();
37
38 static IDirectFBSurface *dfbSurfaceForPlatformPixmap(QPlatformPixmap *);
39
40 static Qt::MouseButton mouseButton(DFBInputDeviceButtonIdentifier identifier);
41 static Qt::MouseButtons mouseButtons(DFBInputDeviceButtonMask mask);
42 static Qt::KeyboardModifiers keyboardModifiers(DFBInputDeviceModifierMask mask);
43 static QEvent::Type eventType(DFBWindowEventType type);
44
45 static QDirectFbKeyMap *keyMap();
46
47private:
48 static QDirectFbKeyMap *dfbKeymap;
50};
51
52template <typename T> struct QDirectFBInterfaceCleanupHandler
53{
54 static void cleanup(T *t)
55 {
56 if (!t)
57 return;
58 t->Release(t);
59 }
60};
61
62template <typename T>
64{
65public:
69
70 T** outPtr()
71 {
72 this->reset(nullptr);
73 return &this->d;
74 }
75};
76
77// Helper conversions from internal to DFB types
78QDirectFbScreen *toDfbScreen(QWindow *window);
79IDirectFBDisplayLayer *toDfbLayer(QPlatformScreen *screen);
80
81#define QDFB_STRINGIFY(x) #x
82#define QDFB_TOSTRING(x) QDFB_STRINGIFY(x)
83#define QDFB_PRETTY
84 (__FILE__ ":" QDFB_TOSTRING(__LINE__))
85
86QT_END_NAMESPACE
87
88
89#endif // QDIRECTFBCONVENIENCE_H
static bool pixelFomatHasAlpha(const DFBSurfacePixelFormat format)
static QEvent::Type eventType(DFBWindowEventType type)
static IDirectFBSurface * dfbSurfaceForPlatformPixmap(QPlatformPixmap *)
static QImage::Format imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps)
static Qt::MouseButtons mouseButtons(DFBInputDeviceButtonMask mask)
static Qt::KeyboardModifiers keyboardModifiers(DFBInputDeviceModifierMask mask)
static IDirectFB * dfbInterface()
static QDirectFbKeyMap * keyMap()
static IDirectFBDisplayLayer * dfbDisplayLayer(int display=DLID_PRIMARY)
static int colorDepthForSurface(const DFBSurfacePixelFormat format)
static Qt::MouseButton mouseButton(DFBInputDeviceButtonIdentifier identifier)
void removeWindow(IDirectFBWindow *window)
void run() override
void addWindow(IDirectFBWindow *window, QWindow *platformWindow)
QScopedPointer< QDirectFbInput > m_input
bool hasCapability(Capability cap) const override
QPlatformInputContext * inputContext() const override
Returns the platforms input context.
QScopedPointer< QDirectFbScreen > m_primaryScreen
QAbstractEventDispatcher * createEventDispatcher() const override
Factory function for the GUI event dispatcher.
QPlatformInputContext * m_inputContext
QPlatformServices * services() const override
QScopedPointer< QThread > m_inputRunner
QPlatformPixmap * createPlatformPixmap(QPlatformPixmap::PixelType type) const override
Factory function for QPlatformPixmap.
QPlatformFontDatabase * fontDatabase() const override
Accessor for the platform integration's fontdatabase.
QPlatformWindow * createPlatformWindow(QWindow *window) const override
Factory function for QPlatformWindow.
QPlatformBackingStore * createPlatformBackingStore(QWindow *window) const override
Factory function for QPlatformBackingStore.
QScopedPointer< QPlatformFontDatabase > m_fontDb
QDirectFBPointer< IDirectFB > m_dfb
QPlatformNativeInterface * nativeInterface() const override
QScopedPointer< QPlatformServices > m_services
IDirectFBDisplayLayer * toDfbLayer(QPlatformScreen *screen)
QDirectFbScreen * toDfbScreen(QWindow *window)
#define QDFB_STRINGIFY(x)
#define QDFB_TOSTRING(x)
#define QT_EGL_BACKEND_CREATE(system, out)
Definition main.cpp:20