summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2009-12-09 09:41:08 +0100
committerJørgen Lind <jorgen.lind@nokia.com>2009-12-09 09:41:44 +0100
commitd8d65804ed67ff58fe8679d3a1831c9dfad3624a (patch)
tree0abe1279e52e33b8d83725509c7682ea02a36c2f
parent6dc5eb70382fb7f1741142b6919e1754e365029c (diff)
Added basic mouseinput support for minimaldfb
-rw-r--r--src/plugins/graphicssystems/minimaldfb/minimaldfb.pro6
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp2
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp232
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h15
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp104
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h49
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp7
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h7
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp3
9 files changed, 418 insertions, 7 deletions
diff --git a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro
index c3f20ff5ac..8b20c45b20 100644
--- a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro
+++ b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro
@@ -11,10 +11,12 @@ SOURCES = main.cpp \
qgraphicssystem_minimaldfb.cpp \
qwindowsurface_minimaldfb.cpp \
qblitter_directfb.cpp \
- qdirectfbconvenience.cpp
+ qdirectfbconvenience.cpp \
+ qdirectfbinput.cpp
HEADERS = qgraphicssystem_minimaldfb.h \
qwindowsurface_minimaldfb.h \
qblitter_directfb.h \
- qdirectfbconvenience.h
+ qdirectfbconvenience.h \
+ qdirectfbinput.h
target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems
INSTALLS += target
diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp
index 71be88203d..8d54c21e52 100644
--- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp
+++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp
@@ -29,7 +29,7 @@ QDirectFbBlitter::QDirectFbBlitter(const QRect &rect, IDirectFBSurface *surface)
QDirectFbBlitter::~QDirectFbBlitter()
{
- delete m_surface;
+ m_surface->Release(m_surface);
}
void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color)
diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp
index d958482081..f0293bda79 100644
--- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp
+++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp
@@ -41,3 +41,235 @@ QImage::Format QDirectFbConvenience::imageFormatFromSurface(IDirectFBSurface *su
return QImage::Format_Invalid;
}
+
+Qt::MouseButton QDirectFbConvenience::mouseButton(DFBInputDeviceButtonIdentifier identifier)
+{
+ switch (identifier){
+ case DIBI_LEFT:
+ return Qt::LeftButton;
+ case DIBI_MIDDLE:
+ return Qt::MidButton;
+ case DIBI_RIGHT:
+ return Qt::RightButton;
+ default:
+ return Qt::NoButton;
+ }
+}
+
+Qt::MouseButtons QDirectFbConvenience::mouseButtons(DFBInputDeviceButtonMask mask)
+{
+ Qt::MouseButtons buttons = Qt::NoButton;
+
+ if (mask & DIBM_LEFT) {
+ buttons |= Qt::LeftButton;
+ }
+ if (mask & DIBM_MIDDLE) {
+ buttons |= Qt::MidButton;
+ }
+ if (mask & DIBM_RIGHT) {
+ buttons |= Qt::RightButton;
+ }
+ return buttons;
+}
+
+QEvent::Type QDirectFbConvenience::eventType(DFBWindowEventType type)
+{
+ switch(type) {
+ case DWET_BUTTONDOWN:
+ return QEvent::MouseButtonPress;
+ case DWET_BUTTONUP:
+ return QEvent::MouseButtonRelease;
+ case DWET_MOTION:
+ return QEvent::MouseMove;
+ case DWET_WHEEL:
+ return QEvent::Wheel;
+ default:
+ return QEvent::None;
+ }
+}
+QDirectFbKeyMap *QDirectFbConvenience::dfbKeymap = 0;
+QDirectFbKeyMap *QDirectFbConvenience::keyMap()
+{
+ if (!dfbKeymap)
+ dfbKeymap = new QDirectFbKeyMap();
+ return dfbKeymap;
+}
+
+QDirectFbKeyMap::QDirectFbKeyMap()
+{
+ insert(DIKS_BACKSPACE , Qt::Key_Backspace);
+ insert(DIKS_TAB , Qt::Key_Tab);
+ insert(DIKS_RETURN , Qt::Key_Return);
+ insert(DIKS_ESCAPE , Qt::Key_Escape);
+ insert(DIKS_DELETE , Qt::Key_Delete);
+
+ insert(DIKS_CURSOR_LEFT , Qt::Key_Left);
+ insert(DIKS_CURSOR_RIGHT , Qt::Key_Right);
+ insert(DIKS_CURSOR_UP , Qt::Key_Up);
+ insert(DIKS_CURSOR_DOWN , Qt::Key_Down);
+ insert(DIKS_INSERT , Qt::Key_Insert);
+ insert(DIKS_HOME , Qt::Key_Home);
+ insert(DIKS_END , Qt::Key_End);
+ insert(DIKS_PAGE_UP , Qt::Key_PageUp);
+ insert(DIKS_PAGE_DOWN , Qt::Key_PageDown);
+ insert(DIKS_PRINT , Qt::Key_Print);
+ insert(DIKS_PAUSE , Qt::Key_Pause);
+ insert(DIKS_SELECT , Qt::Key_Select);
+ insert(DIKS_GOTO , Qt::Key_OpenUrl);
+ insert(DIKS_CLEAR , Qt::Key_Clear);
+ insert(DIKS_MENU , Qt::Key_Menu);
+ insert(DIKS_HELP , Qt::Key_Help);
+
+ insert(DIKS_INTERNET , Qt::Key_HomePage);
+ insert(DIKS_MAIL , Qt::Key_LaunchMail);
+ insert(DIKS_FAVORITES , Qt::Key_Favorites);
+
+ insert(DIKS_BACK , Qt::Key_Back);
+ insert(DIKS_FORWARD , Qt::Key_Forward);
+ insert(DIKS_VOLUME_UP , Qt::Key_VolumeUp);
+ insert(DIKS_VOLUME_DOWN , Qt::Key_VolumeDown);
+ insert(DIKS_MUTE , Qt::Key_VolumeMute);
+ insert(DIKS_PLAYPAUSE , Qt::Key_Pause);
+ insert(DIKS_PLAY , Qt::Key_MediaPlay);
+ insert(DIKS_STOP , Qt::Key_MediaStop);
+ insert(DIKS_RECORD , Qt::Key_MediaRecord);
+ insert(DIKS_PREVIOUS , Qt::Key_MediaPrevious);
+ insert(DIKS_NEXT , Qt::Key_MediaNext);
+
+ insert(DIKS_F1 , Qt::Key_F1);
+ insert(DIKS_F2 , Qt::Key_F2);
+ insert(DIKS_F3 , Qt::Key_F3);
+ insert(DIKS_F4 , Qt::Key_F4);
+ insert(DIKS_F5 , Qt::Key_F5);
+ insert(DIKS_F6 , Qt::Key_F6);
+ insert(DIKS_F7 , Qt::Key_F7);
+ insert(DIKS_F8 , Qt::Key_F8);
+ insert(DIKS_F9 , Qt::Key_F9);
+ insert(DIKS_F10 , Qt::Key_F10);
+ insert(DIKS_F11 , Qt::Key_F11);
+ insert(DIKS_F12 , Qt::Key_F12);
+
+ insert(DIKS_SHIFT , Qt::Key_Shift);
+ insert(DIKS_CONTROL , Qt::Key_Control);
+ insert(DIKS_ALT , Qt::Key_Alt);
+ insert(DIKS_ALTGR , Qt::Key_AltGr);
+
+ insert(DIKS_META , Qt::Key_Meta);
+ insert(DIKS_SUPER , Qt::Key_Super_L); // ???
+ insert(DIKS_HYPER , Qt::Key_Hyper_L); // ???
+
+ insert(DIKS_CAPS_LOCK , Qt::Key_CapsLock);
+ insert(DIKS_NUM_LOCK , Qt::Key_NumLock);
+ insert(DIKS_SCROLL_LOCK , Qt::Key_ScrollLock);
+
+ insert(DIKS_DEAD_ABOVEDOT , Qt::Key_Dead_Abovedot);
+ insert(DIKS_DEAD_ABOVERING , Qt::Key_Dead_Abovering);
+ insert(DIKS_DEAD_ACUTE , Qt::Key_Dead_Acute);
+ insert(DIKS_DEAD_BREVE , Qt::Key_Dead_Breve);
+ insert(DIKS_DEAD_CARON , Qt::Key_Dead_Caron);
+ insert(DIKS_DEAD_CEDILLA , Qt::Key_Dead_Cedilla);
+ insert(DIKS_DEAD_CIRCUMFLEX , Qt::Key_Dead_Circumflex);
+ insert(DIKS_DEAD_DIAERESIS , Qt::Key_Dead_Diaeresis);
+ insert(DIKS_DEAD_DOUBLEACUTE , Qt::Key_Dead_Doubleacute);
+ insert(DIKS_DEAD_GRAVE , Qt::Key_Dead_Grave);
+ insert(DIKS_DEAD_IOTA , Qt::Key_Dead_Iota);
+ insert(DIKS_DEAD_MACRON , Qt::Key_Dead_Macron);
+ insert(DIKS_DEAD_OGONEK , Qt::Key_Dead_Ogonek);
+ insert(DIKS_DEAD_SEMIVOICED_SOUND , Qt::Key_Dead_Semivoiced_Sound);
+ insert(DIKS_DEAD_TILDE , Qt::Key_Dead_Tilde);
+ insert(DIKS_DEAD_VOICED_SOUND , Qt::Key_Dead_Voiced_Sound);
+ insert(DIKS_SPACE , Qt::Key_Space);
+ insert(DIKS_EXCLAMATION_MARK , Qt::Key_Exclam);
+ insert(DIKS_QUOTATION , Qt::Key_QuoteDbl);
+ insert(DIKS_NUMBER_SIGN , Qt::Key_NumberSign);
+ insert(DIKS_DOLLAR_SIGN , Qt::Key_Dollar);
+ insert(DIKS_PERCENT_SIGN , Qt::Key_Percent);
+ insert(DIKS_AMPERSAND , Qt::Key_Ampersand);
+ insert(DIKS_APOSTROPHE , Qt::Key_Apostrophe);
+ insert(DIKS_PARENTHESIS_LEFT , Qt::Key_ParenLeft);
+ insert(DIKS_PARENTHESIS_RIGHT , Qt::Key_ParenRight);
+ insert(DIKS_ASTERISK , Qt::Key_Asterisk);
+ insert(DIKS_PLUS_SIGN , Qt::Key_Plus);
+ insert(DIKS_COMMA , Qt::Key_Comma);
+ insert(DIKS_MINUS_SIGN , Qt::Key_Minus);
+ insert(DIKS_PERIOD , Qt::Key_Period);
+ insert(DIKS_SLASH , Qt::Key_Slash);
+ insert(DIKS_0 , Qt::Key_0);
+ insert(DIKS_1 , Qt::Key_1);
+ insert(DIKS_2 , Qt::Key_2);
+ insert(DIKS_3 , Qt::Key_3);
+ insert(DIKS_4 , Qt::Key_4);
+ insert(DIKS_5 , Qt::Key_5);
+ insert(DIKS_6 , Qt::Key_6);
+ insert(DIKS_7 , Qt::Key_7);
+ insert(DIKS_8 , Qt::Key_8);
+ insert(DIKS_9 , Qt::Key_9);
+ insert(DIKS_COLON , Qt::Key_Colon);
+ insert(DIKS_SEMICOLON , Qt::Key_Semicolon);
+ insert(DIKS_LESS_THAN_SIGN , Qt::Key_Less);
+ insert(DIKS_EQUALS_SIGN , Qt::Key_Equal);
+ insert(DIKS_GREATER_THAN_SIGN , Qt::Key_Greater);
+ insert(DIKS_QUESTION_MARK , Qt::Key_Question);
+ insert(DIKS_AT , Qt::Key_At);
+ insert(DIKS_CAPITAL_A , Qt::Key_A);
+ insert(DIKS_CAPITAL_B , Qt::Key_B);
+ insert(DIKS_CAPITAL_C , Qt::Key_C);
+ insert(DIKS_CAPITAL_D , Qt::Key_D);
+ insert(DIKS_CAPITAL_E , Qt::Key_E);
+ insert(DIKS_CAPITAL_F , Qt::Key_F);
+ insert(DIKS_CAPITAL_G , Qt::Key_G);
+ insert(DIKS_CAPITAL_H , Qt::Key_H);
+ insert(DIKS_CAPITAL_I , Qt::Key_I);
+ insert(DIKS_CAPITAL_J , Qt::Key_J);
+ insert(DIKS_CAPITAL_K , Qt::Key_K);
+ insert(DIKS_CAPITAL_L , Qt::Key_L);
+ insert(DIKS_CAPITAL_M , Qt::Key_M);
+ insert(DIKS_CAPITAL_N , Qt::Key_N);
+ insert(DIKS_CAPITAL_O , Qt::Key_O);
+ insert(DIKS_CAPITAL_P , Qt::Key_P);
+ insert(DIKS_CAPITAL_Q , Qt::Key_Q);
+ insert(DIKS_CAPITAL_R , Qt::Key_R);
+ insert(DIKS_CAPITAL_S , Qt::Key_S);
+ insert(DIKS_CAPITAL_T , Qt::Key_T);
+ insert(DIKS_CAPITAL_U , Qt::Key_U);
+ insert(DIKS_CAPITAL_V , Qt::Key_V);
+ insert(DIKS_CAPITAL_W , Qt::Key_W);
+ insert(DIKS_CAPITAL_X , Qt::Key_X);
+ insert(DIKS_CAPITAL_Y , Qt::Key_Y);
+ insert(DIKS_CAPITAL_Z , Qt::Key_Z);
+ insert(DIKS_SQUARE_BRACKET_LEFT , Qt::Key_BracketLeft);
+ insert(DIKS_BACKSLASH , Qt::Key_Backslash);
+ insert(DIKS_SQUARE_BRACKET_RIGHT , Qt::Key_BracketRight);
+ insert(DIKS_CIRCUMFLEX_ACCENT , Qt::Key_AsciiCircum);
+ insert(DIKS_UNDERSCORE , Qt::Key_Underscore);
+ insert(DIKS_SMALL_A , Qt::Key_A);
+ insert(DIKS_SMALL_B , Qt::Key_B);
+ insert(DIKS_SMALL_C , Qt::Key_C);
+ insert(DIKS_SMALL_D , Qt::Key_D);
+ insert(DIKS_SMALL_E , Qt::Key_E);
+ insert(DIKS_SMALL_F , Qt::Key_F);
+ insert(DIKS_SMALL_G , Qt::Key_G);
+ insert(DIKS_SMALL_H , Qt::Key_H);
+ insert(DIKS_SMALL_I , Qt::Key_I);
+ insert(DIKS_SMALL_J , Qt::Key_J);
+ insert(DIKS_SMALL_K , Qt::Key_K);
+ insert(DIKS_SMALL_L , Qt::Key_L);
+ insert(DIKS_SMALL_M , Qt::Key_M);
+ insert(DIKS_SMALL_N , Qt::Key_N);
+ insert(DIKS_SMALL_O , Qt::Key_O);
+ insert(DIKS_SMALL_P , Qt::Key_P);
+ insert(DIKS_SMALL_Q , Qt::Key_Q);
+ insert(DIKS_SMALL_R , Qt::Key_R);
+ insert(DIKS_SMALL_S , Qt::Key_S);
+ insert(DIKS_SMALL_T , Qt::Key_T);
+ insert(DIKS_SMALL_U , Qt::Key_U);
+ insert(DIKS_SMALL_V , Qt::Key_V);
+ insert(DIKS_SMALL_W , Qt::Key_W);
+ insert(DIKS_SMALL_X , Qt::Key_X);
+ insert(DIKS_SMALL_Y , Qt::Key_Y);
+ insert(DIKS_SMALL_Z , Qt::Key_Z);
+ insert(DIKS_CURLY_BRACKET_LEFT , Qt::Key_BraceLeft);
+ insert(DIKS_VERTICAL_BAR , Qt::Key_Bar);
+ insert(DIKS_CURLY_BRACKET_RIGHT , Qt::Key_BraceRight);
+ insert(DIKS_TILDE , Qt::Key_AsciiTilde);
+}
diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h
index 7e426db106..0ae141000d 100644
--- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h
+++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h
@@ -2,9 +2,18 @@
#define QDIRECTFBCONVENIENCE_H
#include <QtGui/qimage.h>
+#include <QtCore/QHash>
+#include <QtCore/QEvent>
#include <directfb/directfb.h>
+class QDirectFbKeyMap: public QHash<DFBInputDeviceKeySymbol, Qt::Key>
+{
+public:
+ QDirectFbKeyMap();
+};
+
+
class QDirectFbConvenience
{
public:
@@ -12,10 +21,16 @@ public:
//This is set by the graphicssystem constructor
static IDirectFB *dfbInterface() { return dfb; }
+ static Qt::MouseButton mouseButton(DFBInputDeviceButtonIdentifier identifier);
+ static Qt::MouseButtons mouseButtons(DFBInputDeviceButtonMask mask);
+ static QEvent::Type eventType(DFBWindowEventType type);
+
+ 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
new file mode 100644
index 0000000000..4ba4ff8178
--- /dev/null
+++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp
@@ -0,0 +1,104 @@
+#include "qdirectfbinput.h"
+#include "qdirectfbconvenience.h"
+
+#include <QThread>
+#include <QDebug>
+#include <private/qapplication_p.h>
+#include <QMouseEvent>
+#include <QEvent>
+
+#include <directfb/directfb.h>
+
+InputSocketWaiter::InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent)
+ : QThread(parent), eventBuffer(eventBuffer)
+ {
+ this->start();
+ }
+
+void InputSocketWaiter::run()
+{
+ while (1) {
+ eventBuffer->WaitForEvent(eventBuffer);
+ emit newEvent();
+ }
+}
+
+QDirectFbInput::QDirectFbInput(QObject *parent)
+ : QObject(parent)
+{
+ DFBResult ok = DirectFBCreate(&dfbInterface);
+ if (ok != DFB_OK)
+ DirectFBError("Failed to initialise QDirectFBInput", ok);
+
+ ok = dfbInterface->CreateEventBuffer(dfbInterface,&eventBuffer);
+ if (ok != DFB_OK)
+ DirectFBError("Failed to initialise eventbuffer", ok);
+
+ dfbInterface->GetDisplayLayer(dfbInterface,DLID_PRIMARY, &dfbDisplayLayer);
+
+ InputSocketWaiter *inputHandler = new InputSocketWaiter(eventBuffer,this);
+ connect(inputHandler,SIGNAL(newEvent()),this,SLOT(handleEvents()));
+}
+
+void QDirectFbInput::addWindow(DFBWindowID id, QWidget *tlw)
+{
+ tlwMap.insert(id,tlw);
+ IDirectFBWindow *window;
+ dfbDisplayLayer->GetWindow(dfbDisplayLayer,id,&window);
+
+// window->DisableEvents(window,DWET_ALL);
+ window->EnableEvents(window,DFBWindowEventType(DWET_ALL));
+ window->SetKeySelection(window,DWKS_ALL,NULL,0);
+ window->AttachEventBuffer(window,eventBuffer);
+}
+
+void QDirectFbInput::handleEvents()
+{
+ DFBResult hasEvent = eventBuffer->HasEvent(eventBuffer);
+ while(hasEvent == DFB_OK){
+ DFBEvent event;
+ DFBResult ok = eventBuffer->GetEvent(eventBuffer,&event);
+ if (ok != DFB_OK)
+ DirectFBError("Failed to get event",ok);
+ if (event.clazz == DFEC_WINDOW) {
+ switch (event.window.type) {
+ case DWET_BUTTONDOWN:
+ case DWET_BUTTONUP:
+// case DWET_MOTION:
+ case DWET_WHEEL:
+ handleMouseEvents(event);
+ break;
+ case DWET_KEYDOWN:
+ qDebug() << "FOOOOBAR!";
+ }
+
+ } else
+ qDebug() << "WHAT!";
+
+ hasEvent = eventBuffer->HasEvent(eventBuffer);
+ }
+}
+
+void QDirectFbInput::handleMouseEvents(const DFBEvent &event)
+{
+ QEvent::Type type = QDirectFbConvenience::eventType(event.window.type);
+ QPoint p(event.window.cx, event.window.cy);
+ QPoint globalPos = globalPoint(event);
+ Qt::MouseButton button = QDirectFbConvenience::mouseButton(event.window.button);
+ Qt::MouseButtons buttons = QDirectFbConvenience::mouseButtons(event.window.buttons);
+
+ qDebug() << QDirectFbConvenience::keyMap()->value(event.window.key_symbol);
+ QMouseEvent mouseEvent(type,p,globalPos,button, buttons,(Qt::KeyboardModifiers)0);
+ QWidget *tlw = tlwMap.value(event.window.window_id);
+ QApplicationPrivate::handleMouseEvent(tlw,mouseEvent);
+}
+
+inline QPoint QDirectFbInput::globalPoint(const DFBEvent &event) const
+{
+ IDirectFBWindow *window;
+ dfbDisplayLayer->GetWindow(dfbDisplayLayer,event.window.window_id,&window);
+ int x,y;
+ window->GetPosition(window,&x,&y);
+ return QPoint(event.window.cx +x, event.window.cy + y);
+}
+
diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h
new file mode 100644
index 0000000000..529d51ad0a
--- /dev/null
+++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h
@@ -0,0 +1,49 @@
+#ifndef QDIRECTFBINPUT_H
+#define QDIRECTFBINPUT_H
+
+#include <QThread>
+#include <QObject>
+#include <QHash>
+#include <QPoint>
+#include <QEvent>
+
+#include <directfb/directfb.h>
+
+class InputSocketWaiter : public QThread
+{
+ Q_OBJECT
+public:
+ InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent);
+protected:
+ void run();
+signals:
+ void newEvent();
+private:
+ IDirectFBEventBuffer *eventBuffer;
+};
+
+class QDirectFbInput : public QObject
+{
+ Q_OBJECT
+public:
+ QDirectFbInput(QObject *parent = 0);
+
+ void addWindow(DFBWindowID id, QWidget *tlw);
+
+public slots:
+ void handleEvents();
+
+private:
+
+ void handleMouseEvents(const DFBEvent & event);
+ IDirectFB *dfbInterface;
+ IDirectFBDisplayLayer *dfbDisplayLayer;
+ IDirectFBEventBuffer *eventBuffer;
+
+ QHash<DFBWindowID,QWidget *>tlwMap;
+
+ inline QPoint globalPoint(const DFBEvent &event) const;
+
+};
+
+#endif // QDIRECTFBINPUT_H
diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp
index 117e4b5cd2..3f10aecf4d 100644
--- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp
+++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp
@@ -55,6 +55,7 @@
QT_BEGIN_NAMESPACE
QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(IDirectFB *dfb, int display)
+ :QGraphicsSystemScreen() , m_input(this)
{
DFBResult result = dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &m_layer);
if (result != DFB_OK) {
@@ -90,7 +91,7 @@ QDirectFbGraphicsSystemScreen::~QDirectFbGraphicsSystemScreen()
{
}
-IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect)
+IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect, QWidget *tlw)
{
IDirectFBWindow *window;
@@ -110,6 +111,10 @@ IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect)
if (result != DFB_OK) {
DirectFBError("QDirectFbGraphicsSystemScreen: failed to create window",result);
}
+
+ DFBWindowID id;
+ window->GetID(window, &id);
+ m_input.addWindow(id,tlw);
return window;
}
diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h
index 462e963ae3..6068495f3c 100644
--- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h
+++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h
@@ -42,6 +42,8 @@
#ifndef QGRAPHICSSYSTEM_MINIMAL_H
#define QGRAPHICSSYSTEM_MINIMAL_H
+#include "qdirectfbinput.h"
+
#include <QtGui/private/qgraphicssystem_p.h>
#include <directfb.h>
@@ -58,7 +60,7 @@ public:
QImage::Format format() const { return m_format; }
QSize physicalSize() const { return m_physicalSize; }
- IDirectFBWindow *createWindow(const QRect &);
+ IDirectFBWindow *createWindow(const QRect &,QWidget *tlw);
public:
QRect m_geometry;
@@ -66,8 +68,11 @@ public:
QImage::Format m_format;
QSize m_physicalSize;
+ QDirectFbInput m_input;
+
IDirectFBScreen *m_screen;
IDirectFBDisplayLayer *m_layer;
+
};
class QDirectFbGraphicsSystem : public QGraphicsSystem
diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp
index 43bfd9b11c..6c8b2b4fe9 100644
--- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp
+++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp
@@ -53,7 +53,7 @@ QDirectFbWindowSurface::QDirectFbWindowSurface
: QWindowSurface(window), m_screen(screen), m_lock(false)
{
window->setWindowSurface(this);
- m_dfbWindow = m_screen->createWindow(window->rect());
+ m_dfbWindow = m_screen->createWindow(window->rect(),window);
DFBResult result = m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface);
if (result != DFB_OK) {
DirectFBError("QDirectFbWindowSurface::QDirectFbWindowSurface: unable to get windows surface",result);
@@ -66,7 +66,6 @@ QDirectFbWindowSurface::QDirectFbWindowSurface
pmdata->setBlittable(blitter);
m_pixmap = new QPixmap(pmdata);
-
}
QDirectFbWindowSurface::~QDirectFbWindowSurface()