diff options
Diffstat (limited to 'src/plugins/platforms/directfb/qdirectfbconvenience.h')
-rw-r--r-- | src/plugins/platforms/directfb/qdirectfbconvenience.h | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.h b/src/plugins/platforms/directfb/qdirectfbconvenience.h index c82bea8..d009393 100644 --- a/src/plugins/platforms/directfb/qdirectfbconvenience.h +++ b/src/plugins/platforms/directfb/qdirectfbconvenience.h @@ -49,6 +49,11 @@ #include <directfb.h> +QT_BEGIN_NAMESPACE + +class QDirectFbScreen; +class QPlatformScreen; + class QDirectFbKeyMap: public QHash<DFBInputDeviceKeySymbol, Qt::Key> { public: @@ -67,7 +72,7 @@ public: static IDirectFB *dfbInterface(); static IDirectFBDisplayLayer *dfbDisplayLayer(int display = DLID_PRIMARY); - static IDirectFBSurface *dfbSurfaceForPixmapData(QPixmapData *); + static IDirectFBSurface *dfbSurfaceForPlatformPixmap(QPixmapData *); static Qt::MouseButton mouseButton(DFBInputDeviceButtonIdentifier identifier); static Qt::MouseButtons mouseButtons(DFBInputDeviceButtonMask mask); @@ -81,4 +86,41 @@ private: friend class QDirectFbIntegration; }; +template <typename T> struct QDirectFBInterfaceCleanupHandler +{ + static void cleanup(T *t) + { + if (!t) + return; + t->Release(t); + } +}; + +template <typename T> +class QDirectFBPointer : public QScopedPointer<T, QDirectFBInterfaceCleanupHandler<T> > +{ +public: + QDirectFBPointer(T *t = 0) + : QScopedPointer<T, QDirectFBInterfaceCleanupHandler<T> >(t) + {} + + T** outPtr() + { + this->reset(0); + return &this->d; + } +}; + +// Helper conversions from internal to DFB types +QDirectFbScreen *toDfbScreen(QWidget *window); +IDirectFBDisplayLayer *toDfbLayer(QPlatformScreen *screen); + +#define QDFB_STRINGIFY(x) #x +#define QDFB_TOSTRING(x) QDFB_STRINGIFY(x) +#define QDFB_PRETTY \ + (__FILE__ ":" QDFB_TOSTRING(__LINE__)) + +QT_END_NAMESPACE + + #endif // QDIRECTFBCONVENIENCE_H |