Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
4#ifndef QDIRECTFBCONVENIENCE_H
5#define QDIRECTFBCONVENIENCE_H
6
7#include <QtGui/qimage.h>
8#include <QtCore/QHash>
9#include <QtCore/QEvent>
10#include <QtGui/QPixmap>
11
12#include <directfb.h>
13
15
16class QDirectFbScreen;
17class QPlatformScreen;
18
19class QDirectFbKeyMap: public QHash<DFBInputDeviceKeySymbol, Qt::Key>
20{
21public:
23};
24
25
27{
28public:
29 static QImage::Format imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps);
30 static bool pixelFomatHasAlpha(const DFBSurfacePixelFormat format) { return (1 << 16) & format; }
31 static int colorDepthForSurface(const DFBSurfacePixelFormat format);
32
33 //This is set by the graphicssystem constructor
34 static IDirectFB *dfbInterface();
35 static IDirectFBDisplayLayer *dfbDisplayLayer(int display = DLID_PRIMARY);
36
37 static IDirectFBSurface *dfbSurfaceForPlatformPixmap(QPlatformPixmap *);
38
39 static Qt::MouseButton mouseButton(DFBInputDeviceButtonIdentifier identifier);
40 static Qt::MouseButtons mouseButtons(DFBInputDeviceButtonMask mask);
41 static Qt::KeyboardModifiers keyboardModifiers(DFBInputDeviceModifierMask mask);
42 static QEvent::Type eventType(DFBWindowEventType type);
43
44 static QDirectFbKeyMap *keyMap();
45
46private:
47 static QDirectFbKeyMap *dfbKeymap;
49};
50
51template <typename T> struct QDirectFBInterfaceCleanupHandler
52{
53 static void cleanup(T *t)
54 {
55 if (!t)
56 return;
57 t->Release(t);
58 }
59};
60
61template <typename T>
62class QDirectFBPointer : public QScopedPointer<T, QDirectFBInterfaceCleanupHandler<T> >
63{
64public:
68
69 T** outPtr()
70 {
71 this->reset(nullptr);
72 return &this->d;
73 }
74};
75
76// Helper conversions from internal to DFB types
78IDirectFBDisplayLayer *toDfbLayer(QPlatformScreen *screen);
79
80#define QDFB_STRINGIFY(x) #x
81#define QDFB_TOSTRING(x) QDFB_STRINGIFY(x)
82#define QDFB_PRETTY \
83 (__FILE__ ":" QDFB_TOSTRING(__LINE__))
84
86
87
88#endif // QDIRECTFBCONVENIENCE_H
Q_NODISCARD_CTOR QDirectFBPointer(T *t=nullptr)
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)
Type
This enum type defines the valid event types in Qt.
Definition qcoreevent.h:51
\inmodule QtCore
Definition qhash.h:820
Format
The following image formats are available in Qt.
Definition qimage.h:41
The QPlatformPixmap class provides an abstraction for native pixmaps.
The QPlatformScreen class provides an abstraction for visual displays.
\inmodule QtCore
\inmodule QtGui
Definition qwindow.h:63
struct wl_display * display
Definition linuxdmabuf.h:41
Combined button and popup list for selecting options.
MouseButton
Definition qnamespace.h:56
#define Q_NODISCARD_CTOR
IDirectFBDisplayLayer * toDfbLayer(QPlatformScreen *screen)
QDirectFbScreen * toDfbScreen(QWindow *window)
GLenum type
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLint GLsizei GLsizei GLenum format
GLboolean reset
GLdouble GLdouble t
Definition qopenglext.h:243
QScreen * screen
[1]
Definition main.cpp:29
aWidget window() -> setWindowTitle("New Window Title")
[2]