diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2010-01-06 13:41:53 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2010-01-06 13:41:53 (GMT) |
commit | c489e061817d0880ac3f1492d8decf749a502e6f (patch) | |
tree | 3eb726e583ca0119f1088a50830cd8d2cdcf4ca4 /src/plugins | |
parent | 743c1e4800ff6f6a7d0b8c5bd5ac6be9d5027255 (diff) | |
download | Qt-c489e061817d0880ac3f1492d8decf749a502e6f.zip Qt-c489e061817d0880ac3f1492d8decf749a502e6f.tar.gz Qt-c489e061817d0880ac3f1492d8decf749a502e6f.tar.bz2 |
fixed minimaldfb input when mouse events that did not get delivered
and refactorede a bit stuff out. DirectFB handles the singelton pattern
for the dfbInterface itself
Diffstat (limited to 'src/plugins')
5 files changed, 34 insertions, 18 deletions
diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp index 03fa18f..25d6258 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp @@ -3,7 +3,27 @@ #include <private/qpixmap_blitter_p.h> -IDirectFB *QDirectFbConvenience::dfb = 0; +IDirectFB *QDirectFbConvenience::dfbInterface() +{ + IDirectFB *dfb; + DFBResult result = DirectFBCreate(&dfb); + if (result != DFB_OK) { + DirectFBError("QDirectFBConvenience: error creating DirectFB interface",result); + return 0; + } + return dfb; +} + +IDirectFBDisplayLayer *QDirectFbConvenience::dfbDisplayLayer(int display) +{ + IDirectFBDisplayLayer *layer; + DFBResult result = QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),display,&layer); + if (result != DFB_OK) { + DirectFBError("QDirectFbConvenience: " + "Unable to get primary display layer!", result); + } + return layer; +} QImage::Format QDirectFbConvenience::imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps) { diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h index 81524dd..c086828 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h @@ -21,7 +21,8 @@ public: static QImage::Format imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps); //This is set by the graphicssystem constructor - static IDirectFB *dfbInterface() { return dfb; } + static IDirectFB *dfbInterface(); + static IDirectFBDisplayLayer *dfbDisplayLayer(int display = DLID_PRIMARY); static IDirectFBSurface *dfbSurfaceForPixmapData(QPixmapData *); @@ -33,8 +34,6 @@ public: static QDirectFbKeyMap *keyMap(); private: - static void setDfbInterface(IDirectFB *dfbInterface) {dfb = dfbInterface;} - static IDirectFB *dfb; static QDirectFbKeyMap *dfbKeymap; friend class QDirectFbGraphicsSystem; }; diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index de50229..00c2310 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -102,6 +102,9 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event) Qt::MouseButtons buttons = QDirectFbConvenience::mouseButtons(event.window.buttons); QWidget *tlw = tlwMap.value(event.window.window_id); + IDirectFBWindow *window; + QDirectFbConvenience::dfbDisplayLayer()->GetWindow(layer,event.window.window_id,&window); + if (event.window.type == DWET_BUTTONDOWN) { static long prevTime = 0; static QWidget *prevWindow; @@ -120,6 +123,10 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event) prevWindow = tlw; prevX = event.window.cx; prevY = event.window.cy; + + window->GrabPointer(window); + } else if (event.window.type == DWET_BUTTONUP) { + window->UngrabPointer(window); } //DFB doesn't give keyboardmodifiers on mouseevents diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index c767c7c..2d471e4 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -54,14 +54,10 @@ QT_BEGIN_NAMESPACE -QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(IDirectFB *dfb, int display) +QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(int display) :QGraphicsSystemScreen() , m_input(this) { - DFBResult result = dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &m_layer); - if (result != DFB_OK) { - DirectFBError("QDirectFbGraphicsSystemScreen " - "Unable to get primary display layer!", result); - } + IDirectFBDisplayLayer *m_layer = QDirectFbConvenience::dfbDisplayLayer(display); m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); DFBDisplayLayerConfig config; @@ -134,14 +130,8 @@ QDirectFbGraphicsSystem::QDirectFbGraphicsSystem() } delete[] argv; - result = DirectFBCreate(&dfb); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen: error creating DirectFB interface", - result); - } - QDirectFbConvenience::setDfbInterface(dfb); - mPrimaryScreen = new QDirectFbGraphicsSystemScreen(dfb,0); + mPrimaryScreen = new QDirectFbGraphicsSystemScreen(0); mScreens.append(mPrimaryScreen); } diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h index f6ce011..892bc58 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h @@ -55,7 +55,7 @@ class QDirectFBCursor; class QDirectFbGraphicsSystemScreen : public QGraphicsSystemScreen { public: - QDirectFbGraphicsSystemScreen(IDirectFB *dfb, int display); + QDirectFbGraphicsSystemScreen(int display); ~QDirectFbGraphicsSystemScreen(); QRect geometry() const { return m_geometry; } |