summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-08-25 00:55:51 +0800
committerLars Knoll <lars.knoll@nokia.com>2011-08-26 13:35:11 +0200
commit688d9f6ec0a0da5539a3d11fa1dc6e1ae0558cda (patch)
treeff8a99d6ee44d194699eb6abcf66bf17441c1245 /src
parent0d7ef7993dc18a69d0bffd78666ee6ae7fb83e34 (diff)
directfb: Convert the directfb plugin, disable the OpenGL support
OpenGL was never tested and the platform integration has changed, remove it from the build and re-enable it once one can test it. Change-Id: I70d5b5b11de06e6e999d3aae44660f11d2dbc719 Reviewed-on: http://codereview.qt.nokia.com/3666 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/directfb/directfb.pro8
-rw-r--r--src/plugins/platforms/directfb/qdirectfbcursor.cpp3
-rw-r--r--src/plugins/platforms/directfb/qdirectfbcursor.h2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbinput.cpp13
-rw-r--r--src/plugins/platforms/directfb/qdirectfbinput.h4
-rw-r--r--src/plugins/platforms/directfb/qdirectfbintegration.cpp24
-rw-r--r--src/plugins/platforms/directfb/qdirectfbintegration.h11
-rw-r--r--src/plugins/platforms/directfb/qdirectfbwindow.cpp45
-rw-r--r--src/plugins/platforms/directfb/qdirectfbwindow.h6
-rw-r--r--src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp15
-rw-r--r--src/plugins/platforms/directfb/qdirectfbwindowsurface.h10
11 files changed, 57 insertions, 84 deletions
diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro
index fb446f6166..e516fb11f3 100644
--- a/src/plugins/platforms/directfb/directfb.pro
+++ b/src/plugins/platforms/directfb/directfb.pro
@@ -21,16 +21,16 @@ SOURCES = main.cpp \
qdirectfbconvenience.cpp \
qdirectfbinput.cpp \
qdirectfbcursor.cpp \
- qdirectfbwindow.cpp \
- qdirectfbglcontext.cpp
+ qdirectfbwindow.cpp
HEADERS = qdirectfbintegration.h \
qdirectfbwindowsurface.h \
qdirectfbblitter.h \
qdirectfbconvenience.h \
qdirectfbinput.h \
qdirectfbcursor.h \
- qdirectfbwindow.h \
- qdirectfbglcontext.h
+ qdirectfbwindow.h
+
+# ### port the GL context
include(../fontdatabases/genericunix/genericunix.pri)
target.path += $$[QT_INSTALL_PLUGINS]/platforms
diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.cpp b/src/plugins/platforms/directfb/qdirectfbcursor.cpp
index 0a2a872b0a..cd4130b18e 100644
--- a/src/plugins/platforms/directfb/qdirectfbcursor.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbcursor.cpp
@@ -50,9 +50,8 @@ QDirectFBCursor::QDirectFBCursor(QPlatformScreen* screen) :
image = new QPlatformCursorImage(0, 0, 0, 0, 0, 0);
}
-void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget)
+void QDirectFBCursor::changeCursor(QCursor * cursor, QWindow * window)
{
- Q_UNUSED(widget);
int xSpot;
int ySpot;
QPixmap map;
diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.h b/src/plugins/platforms/directfb/qdirectfbcursor.h
index b148de5589..ab94d72153 100644
--- a/src/plugins/platforms/directfb/qdirectfbcursor.h
+++ b/src/plugins/platforms/directfb/qdirectfbcursor.h
@@ -51,7 +51,7 @@ class QDirectFBCursor : public QPlatformCursor
{
public:
QDirectFBCursor(QPlatformScreen *screem);
- void changeCursor(QCursor * cursor, QWidget * widget);
+ void changeCursor(QCursor * cursor, QWindow * window);
private:
IDirectFBDisplayLayer * m_layer;
diff --git a/src/plugins/platforms/directfb/qdirectfbinput.cpp b/src/plugins/platforms/directfb/qdirectfbinput.cpp
index d35cea5ee9..d05729b992 100644
--- a/src/plugins/platforms/directfb/qdirectfbinput.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbinput.cpp
@@ -47,7 +47,6 @@
#include <QWindowSystemInterface>
#include <QMouseEvent>
#include <QEvent>
-#include <QApplication>
#include <directfb.h>
@@ -82,9 +81,9 @@ void QDirectFbInput::stopInputEventLoop()
m_waitStop.acquire();
}
-void QDirectFbInput::addWindow(DFBWindowID id, QWidget *tlw)
+void QDirectFbInput::addWindow(DFBWindowID id, QWindow *qt_window)
{
- m_tlwMap.insert(id,tlw);
+ m_tlwMap.insert(id,qt_window);
IDirectFBWindow *window;
m_dfbDisplayLayer->GetWindow(m_dfbDisplayLayer,id,&window);
@@ -152,7 +151,7 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event)
} else if (event.window.type == DWET_BUTTONUP) {
window->UngrabPointer(window);
}
- QWidget *tlw = m_tlwMap.value(event.window.window_id);
+ QWindow *tlw = m_tlwMap.value(event.window.window_id);
QWindowSystemInterface::handleMouseEvent(tlw, timestamp, p, globalPos, buttons);
}
@@ -161,7 +160,7 @@ void QDirectFbInput::handleWheelEvent(const DFBEvent &event)
QPoint p(event.window.cx, event.window.cy);
QPoint globalPos = globalPoint(event);
long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000);
- QWidget *tlw = m_tlwMap.value(event.window.window_id);
+ QWindow *tlw = m_tlwMap.value(event.window.window_id);
QWindowSystemInterface::handleWheelEvent(tlw, timestamp, p, globalPos,
event.window.step*120,
Qt::Vertical);
@@ -178,13 +177,13 @@ void QDirectFbInput::handleKeyEvents(const DFBEvent &event)
QChar character;
if (DFB_KEY_TYPE(event.window.key_symbol) == DIKT_UNICODE)
character = QChar(event.window.key_symbol);
- QWidget *tlw = m_tlwMap.value(event.window.window_id);
+ QWindow *tlw = m_tlwMap.value(event.window.window_id);
QWindowSystemInterface::handleKeyEvent(tlw, timestamp, type, key, modifiers, character);
}
void QDirectFbInput::handleEnterLeaveEvents(const DFBEvent &event)
{
- QWidget *tlw = m_tlwMap.value(event.window.window_id);
+ QWindow *tlw = m_tlwMap.value(event.window.window_id);
switch (event.window.type) {
case DWET_ENTER:
QWindowSystemInterface::handleEnterEvent(tlw);
diff --git a/src/plugins/platforms/directfb/qdirectfbinput.h b/src/plugins/platforms/directfb/qdirectfbinput.h
index 3b8008f1fe..b0fe0c79eb 100644
--- a/src/plugins/platforms/directfb/qdirectfbinput.h
+++ b/src/plugins/platforms/directfb/qdirectfbinput.h
@@ -57,7 +57,7 @@ class QDirectFbInput : public QObject
Q_OBJECT
public:
QDirectFbInput(QObject *parent);
- void addWindow(DFBWindowID id, QWidget *tlw);
+ void addWindow(DFBWindowID id, QWindow *window);
void removeWindow(WId wId);
public slots:
@@ -80,7 +80,7 @@ private:
bool m_shouldStop;
QSemaphore m_waitStop;
- QHash<DFBWindowID,QWidget *>m_tlwMap;
+ QHash<DFBWindowID,QWindow *>m_tlwMap;
};
#endif // QDIRECTFBINPUT_H
diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp
index ed8e42faf4..28b0979df7 100644
--- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp
@@ -49,10 +49,9 @@
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
-#include <private/qwindowsurface_raster_p.h>
-#include <private/qpixmap_raster_p.h>
-
#include <QtGui/private/qpixmap_blitter_p.h>
+#include <QtGui/private/qpixmap_raster_p.h>
+#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qplatformpixmap_qpa.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QThread>
@@ -85,7 +84,10 @@ QDirectFbScreen::~QDirectFbScreen()
QDirectFbIntegration::QDirectFbIntegration()
: mFontDb(new QGenericUnixFontDatabase())
+ , mEventDispatcher(createUnixEventDispatcher())
{
+ QGuiApplicationPrivate::instance()->setEventDispatcher(mEventDispatcher);
+
const QStringList args = QCoreApplication::arguments();
int argc = args.size();
char **argv = new char*[argc];
@@ -101,8 +103,9 @@ QDirectFbIntegration::QDirectFbIntegration()
delete[] argv;
+
QDirectFbScreen *primaryScreen = new QDirectFbScreen(0);
- mScreens.append(primaryScreen);
+ screenAdded(primaryScreen);
mInputRunner = new QThread;
mInput = new QDirectFbInput(0);
@@ -126,21 +129,20 @@ QPlatformPixmap *QDirectFbIntegration::createPlatformPixmap(QPlatformPixmap::Pix
return new QDirectFbBlitterPlatformPixmap;
}
-QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWidget *widget, WId winId) const
+QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWindow *window) const
{
- Q_UNUSED(winId);
QDirectFbInput *input = const_cast<QDirectFbInput *>(mInput);//gah
- return new QDirectFbWindow(widget,input);
+ return new QDirectFbWindow(window,input);
}
-QAbstractEventDispatcher *QDirectFbIntegration::createEventDispatcher() const
+QAbstractEventDispatcher *QDirectFbIntegration::guiThreadEventDispatcher() const
{
- return createUnixEventDispatcher();
+ return mEventDispatcher;
}
-QWindowSurface *QDirectFbIntegration::createWindowSurface(QWidget *widget, WId winId) const
+QPlatformBackingStore *QDirectFbIntegration::createPlatformBackingStore(QWindow *window) const
{
- return new QDirectFbWindowSurface(widget,winId);
+ return new QDirectFbWindowSurface(window);
}
QPlatformFontDatabase *QDirectFbIntegration::fontDatabase() const
diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.h b/src/plugins/platforms/directfb/qdirectfbintegration.h
index c3030031e1..67eed38c41 100644
--- a/src/plugins/platforms/directfb/qdirectfbintegration.h
+++ b/src/plugins/platforms/directfb/qdirectfbintegration.h
@@ -56,7 +56,6 @@ class QDirectFBCursor;
class QDirectFbScreen : public QPlatformScreen
{
-Q_OBJECT
public:
QDirectFbScreen(int display);
~QDirectFbScreen();
@@ -86,19 +85,17 @@ public:
~QDirectFbIntegration();
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
- QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const;
- QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
- QAbstractEventDispatcher *createEventDispatcher() const;
-
- QList<QPlatformScreen *> screens() const { return mScreens; }
+ QPlatformWindow *createPlatformWindow(QWindow *window) const;
+ QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
+ QAbstractEventDispatcher *guiThreadEventDispatcher() const;
QPlatformFontDatabase *fontDatabase() const;
private:
- QList<QPlatformScreen *> mScreens;
QDirectFbInput *mInput;
QThread *mInputRunner;
QPlatformFontDatabase *mFontDb;
+ QAbstractEventDispatcher *mEventDispatcher;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.cpp b/src/plugins/platforms/directfb/qdirectfbwindow.cpp
index d2c411eaeb..94cd63b997 100644
--- a/src/plugins/platforms/directfb/qdirectfbwindow.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbwindow.cpp
@@ -41,15 +41,12 @@
#include "qdirectfbwindow.h"
#include "qdirectfbinput.h"
-#include "qdirectfbglcontext.h"
-
-#include <QWidget>
#include "qdirectfbwindowsurface.h"
#include <directfb.h>
-QDirectFbWindow::QDirectFbWindow(QWidget *tlw, QDirectFbInput *inputhandler)
+QDirectFbWindow::QDirectFbWindow(QWindow *tlw, QDirectFbInput *inputhandler)
: QPlatformWindow(tlw), m_inputHandler(inputhandler), m_context(0)
{
IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer();
@@ -63,10 +60,10 @@ QDirectFbWindow::QDirectFbWindow(QWidget *tlw, QDirectFbInput *inputhandler)
|DWDESC_OPTIONS
#endif
|DWDESC_CAPS);
- description.width = tlw->rect().width();
- description.height = tlw->rect().height();
- description.posx = tlw->rect().x();
- description.posy = tlw->rect().y();
+ description.width = tlw->width();
+ description.height = tlw->height();
+ description.posx = tlw->x();
+ description.posy = tlw->y();
if (layerConfig.surface_caps & DSCAPS_PREMULTIPLIED)
description.surface_caps = DSCAPS_PREMULTIPLIED;
@@ -85,7 +82,7 @@ QDirectFbWindow::QDirectFbWindow(QWidget *tlw, QDirectFbInput *inputhandler)
m_dfbWindow->SetOpacity(m_dfbWindow,0xff);
- setVisible(widget()->isVisible());
+ setVisible(window()->visible());
DFBWindowID id;
m_dfbWindow->GetID(m_dfbWindow, &id);
@@ -100,17 +97,20 @@ QDirectFbWindow::~QDirectFbWindow()
void QDirectFbWindow::setGeometry(const QRect &rect)
{
- bool isMoveOnly = (rect.topLeft() != geometry().topLeft()) && (rect.size() == geometry().size());
+// bool isMoveOnly = (rect.topLeft() != geometry().topLeft()) && (rect.size() == geometry().size());
+
QPlatformWindow::setGeometry(rect);
- if (widget()->isVisible() && !(widget()->testAttribute(Qt::WA_DontShowOnScreen))) {
+ if (window()->visible()) {
m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(),
rect.width(), rect.height());
-
+// ### TODO port, verify if this is needed
+#if 0
//Hack. When moving since the WindowSurface of a window becomes invalid when moved
if (isMoveOnly) { //if resize then windowsurface is updated.
widget()->windowSurface()->resize(rect.size());
- widget()->update();
+ window()->update();
}
+#endif
}
}
@@ -170,22 +170,3 @@ WId QDirectFbWindow::winId() const
return WId(id);
}
-QPlatformGLContext *QDirectFbWindow::glContext() const
-{
- if (!m_context) {
- IDirectFBSurface *surface;
- DFBResult result = m_dfbWindow->GetSurface(m_dfbWindow,&surface);
- if (result != DFB_OK) {
- qWarning("could not retrieve surface in QDirectFbWindow::glContext()");
- return 0;
- }
- IDirectFBGL *gl;
- result = surface->GetGL(surface,&gl);
- if (result != DFB_OK) {
- qWarning("could not retrieve IDirectFBGL in QDirectFbWindow::glContext()");
- return 0;
- }
- const_cast<QDirectFbWindow *>(this)->m_context = new QDirectFbGLContext(gl);
- }
- return m_context;
-}
diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.h b/src/plugins/platforms/directfb/qdirectfbwindow.h
index 4f839a05fa..4c9bbaaab5 100644
--- a/src/plugins/platforms/directfb/qdirectfbwindow.h
+++ b/src/plugins/platforms/directfb/qdirectfbwindow.h
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
class QDirectFbWindow : public QPlatformWindow
{
public:
- QDirectFbWindow(QWidget *tlw, QDirectFbInput *inputhandler);
+ QDirectFbWindow(QWindow *tlw, QDirectFbInput *inputhandler);
~QDirectFbWindow();
void setGeometry(const QRect &rect);
@@ -65,13 +65,9 @@ public:
void lower();
WId winId() const;
- QPlatformGLContext *glContext() const;
-
private:
IDirectFBWindow *m_dfbWindow;
QDirectFbInput *m_inputHandler;
-
- QPlatformGLContext *m_context;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp
index 0cb3261eb1..ab355c48f4 100644
--- a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp
@@ -49,20 +49,20 @@
QT_BEGIN_NAMESPACE
-QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window, WId wId)
- : QWindowSurface(window), m_pixmap(0), m_pmdata(0), m_dfbSurface(0)
+QDirectFbWindowSurface::QDirectFbWindowSurface(QWindow *window)
+ : QPlatformBackingStore(window), m_pixmap(0), m_pmdata(0), m_dfbSurface(0)
{
IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer();
- DFBWindowID id(wId);
+ DFBWindowID id(window->winId());
IDirectFBWindow *dfbWindow;
layer->GetWindow(layer,id,&dfbWindow);
dfbWindow->GetSurface(dfbWindow,&m_dfbSurface);
//WRONGSIZE
- QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect().size(), m_dfbSurface);
+ QDirectFbBlitter *blitter = new QDirectFbBlitter(window->size(), m_dfbSurface);
m_pmdata = new QDirectFbBlitterPlatformPixmap;
m_pmdata->setBlittable(blitter);
m_pixmap = new QPixmap(m_pmdata);
@@ -78,9 +78,8 @@ QPaintDevice *QDirectFbWindowSurface::paintDevice()
return m_pixmap;
}
-void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)
+void QDirectFbWindowSurface::flush(QWindow *, const QRegion &region, const QPoint &offset)
{
- Q_UNUSED(widget);
m_pmdata->blittable()->unlock();
QVector<QRect> rects = region.rects();
@@ -91,9 +90,9 @@ void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion &region, const
}
}
-void QDirectFbWindowSurface::resize(const QSize &size)
+void QDirectFbWindowSurface::resize(const QSize &size, const QRegion& reg)
{
- QWindowSurface::resize(size);
+ QPlatformBackingStore::resize(size, reg);
//Have to add 1 ref ass it will be removed by deleting the old blitter in setBlittable
m_dfbSurface->AddRef(m_dfbSurface);
diff --git a/src/plugins/platforms/directfb/qdirectfbwindowsurface.h b/src/plugins/platforms/directfb/qdirectfbwindowsurface.h
index 5a631ca8fa..2b6cb58aef 100644
--- a/src/plugins/platforms/directfb/qdirectfbwindowsurface.h
+++ b/src/plugins/platforms/directfb/qdirectfbwindowsurface.h
@@ -42,22 +42,22 @@
#ifndef QWINDOWSURFACE_DIRECTFB_H
#define QWINDOWSURFACE_DIRECTFB_H
-#include <QtGui/private/qwindowsurface_p.h>
+#include <qplatformbackingstore_qpa.h>
#include <private/qpixmap_blitter_p.h>
#include <directfb.h>
QT_BEGIN_NAMESPACE
-class QDirectFbWindowSurface : public QWindowSurface
+class QDirectFbWindowSurface : public QPlatformBackingStore
{
public:
- QDirectFbWindowSurface(QWidget *window, WId wid);
+ QDirectFbWindowSurface(QWindow *window);
~QDirectFbWindowSurface();
QPaintDevice *paintDevice();
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
- void resize (const QSize &size);
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset);
+ void resize (const QSize &size, const QRegion &staticContents);
bool scroll(const QRegion &area, int dx, int dy);
void beginPaint(const QRegion &region);