summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp22
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h5
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp7
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp16
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h2
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; }