From 3a8b3299d7c956e3a9f4733bc7d459757081bdc2 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 12 Apr 2010 16:55:56 +0200 Subject: Make LinuxFb work --- src/gui/kernel/qapplication_lite.cpp | 11 +++++++++++ src/plugins/platforms/linuxfb/linuxfb.pro | 4 ++-- src/plugins/platforms/linuxfb/main.cpp | 8 ++++---- .../platforms/linuxfb/qgraphicssystem_linuxfb.cpp | 16 ++++++++++++++-- src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h | 11 ++++++----- 5 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 87fa933..867c2dc 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -422,6 +422,15 @@ static void init_platform(const QString &name) } + +static void cleanup_platform() +{ + delete QApplicationPrivate::platform_integration; + QApplicationPrivate::platform_integration = 0; + delete QApplicationPrivate::graphics_system; + QApplicationPrivate::graphics_system = 0; +} + static void init_plugins(const QList pluginList) { for (int i = 0; i < pluginList.count(); ++i) { @@ -520,6 +529,8 @@ void qt_init(QApplicationPrivate *priv, int type) void qt_cleanup() { + cleanup_platform(); + QPixmapCache::clear(); #ifndef QT_NO_CURSOR QCursorData::cleanup(); diff --git a/src/plugins/platforms/linuxfb/linuxfb.pro b/src/plugins/platforms/linuxfb/linuxfb.pro index 031b843..2633a10 100644 --- a/src/plugins/platforms/linuxfb/linuxfb.pro +++ b/src/plugins/platforms/linuxfb/linuxfb.pro @@ -1,12 +1,12 @@ TARGET = qlinuxfbgraphicssystem include(../../qpluginbase.pri) -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms SOURCES = main.cpp qgraphicssystem_linuxfb.cpp HEADERS = qgraphicssystem_linuxfb.h include(../fb_base/fb_base.pri) -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/linuxfb/main.cpp b/src/plugins/platforms/linuxfb/main.cpp index 4d03fe5..15305ed 100644 --- a/src/plugins/platforms/linuxfb/main.cpp +++ b/src/plugins/platforms/linuxfb/main.cpp @@ -39,16 +39,16 @@ ** ****************************************************************************/ -#include +#include #include "qgraphicssystem_linuxfb.h" QT_BEGIN_NAMESPACE -class QLinuxFbGraphicsSystemPlugin : public QGraphicsSystemPlugin +class QLinuxFbGraphicsSystemPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QGraphicsSystem *create(const QString&); + QPlatformIntegration *create(const QString&); }; QStringList QLinuxFbGraphicsSystemPlugin::keys() const @@ -58,7 +58,7 @@ QStringList QLinuxFbGraphicsSystemPlugin::keys() const return list; } -QGraphicsSystem* QLinuxFbGraphicsSystemPlugin::create(const QString& system) +QPlatformIntegration* QLinuxFbGraphicsSystemPlugin::create(const QString& system) { if (system.toLower() == "linuxfb") return new QLinuxFbGraphicsSystem; diff --git a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp index 44960bb..cca567c 100644 --- a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp +++ b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp @@ -786,16 +786,28 @@ QPixmapData *QLinuxFbGraphicsSystem::createPixmapData(QPixmapData::PixelType typ return new QRasterPixmapData(type); } -QWindowSurface *QLinuxFbGraphicsSystem::createWindowSurface(QWidget *widget) const +QWindowSurface *QLinuxFbGraphicsSystem::createWindowSurfaceForWindow(QWidget *widget, WId) const { if (widget->windowType() == Qt::Desktop) return 0; // Don't create an explicit window surface for the destkop. QGraphicsSystemFbWindowSurface * surface = new QGraphicsSystemFbWindowSurface(mPrimaryScreen, widget); - mPrimaryScreen->addWindowSurface(surface); return surface; } + + +QPlatformWindow *QLinuxFbGraphicsSystem::createPlatformWindow(QWidget *widget, WId /*winId*/) const +{ + QFbWindow *w = new QFbWindow(mPrimaryScreen, widget); + mPrimaryScreen->addWindow(w); + return w; +} + + + + + QLinuxFbGraphicsSystemScreen::QLinuxFbGraphicsSystemScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat) : compositePainter(0) { diff --git a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h index cc8ce7e..873b463 100644 --- a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h +++ b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h @@ -42,7 +42,7 @@ #ifndef QGRAPHICSSYSTEM_LINUXFB_H #define QGRAPHICSSYSTEM_LINUXFB_H -#include +#include #include "../fb_base/fb_base.h" QT_BEGIN_NAMESPACE @@ -70,20 +70,21 @@ struct fb_cmap; struct fb_var_screeninfo; struct fb_fix_screeninfo; -class QLinuxFbGraphicsSystem : public QGraphicsSystem +class QLinuxFbGraphicsSystem : public QPlatformIntegration { public: QLinuxFbGraphicsSystem(); ~QLinuxFbGraphicsSystem(); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId WinId) const; + QWindowSurface *createWindowSurfaceForWindow(QWidget *widget, WId WinId) const; - QList screens() const { return mScreens; } + QList screens() const { return mScreens; } private: QLinuxFbGraphicsSystemScreen *mPrimaryScreen; - QList mScreens; + QList mScreens; QLinuxFbGraphicsSystemPrivate *d_ptr; enum PixelType { NormalPixel, BGRPixel }; -- cgit v0.12