directfb: Pass the IDirectFBWindow to the QDirectFbInput methods

No need to go from IDirectFBWindow -> WindowID -> IDirectFBWindow
to attach the event buffer for the event system.

Change-Id: Ia5f7c20d06e8e1da5142f1bd99ca69906107adba
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
This commit is contained in:
Holger Hans Peter Freyther 2011-11-21 14:07:11 +01:00 committed by Qt by Nokia
parent 7da24c14fd
commit a0e0359567
3 changed files with 26 additions and 16 deletions

View File

@ -75,22 +75,34 @@ void QDirectFbInput::stopInputEventLoop()
m_eventBuffer->WakeUp(m_eventBuffer.data());
}
void QDirectFbInput::addWindow(DFBWindowID id, QWindow *qt_window)
void QDirectFbInput::addWindow(IDirectFBWindow *window, QWindow *platformWindow)
{
m_tlwMap.insert(id,qt_window);
QDirectFBPointer<IDirectFBWindow> window;
m_dfbDisplayLayer->GetWindow(m_dfbDisplayLayer.data(), id, window.outPtr());
DFBResult res;
DFBWindowID id;
window->AttachEventBuffer(window.data(), m_eventBuffer.data());
res = window->GetID(window, &id);
if (res != DFB_OK) {
DirectFBError("QDirectFbInput::addWindow", res);
return;
}
m_tlwMap.insert(id, platformWindow);
window->AttachEventBuffer(window, m_eventBuffer.data());
}
void QDirectFbInput::removeWindow(WId wId)
void QDirectFbInput::removeWindow(IDirectFBWindow *window)
{
QDirectFBPointer<IDirectFBWindow> window;
m_dfbDisplayLayer->GetWindow(m_dfbDisplayLayer.data(), wId, window.outPtr());
DFBResult res;
DFBWindowID id;
window->DetachEventBuffer(window.data(), m_eventBuffer.data());
m_tlwMap.remove(wId);
res = window->GetID(window, &id);
if (res != DFB_OK) {
DirectFBError("QDirectFbInput::removeWindow", res);
return;
}
window->DetachEventBuffer(window, m_eventBuffer.data());
m_tlwMap.remove(id);
}
void QDirectFbInput::handleEvents()

View File

@ -56,8 +56,8 @@ class QDirectFbInput : public QThread
Q_OBJECT
public:
QDirectFbInput();
void addWindow(DFBWindowID id, QWindow *window);
void removeWindow(WId wId);
void addWindow(IDirectFBWindow *window, QWindow *platformWindow);
void removeWindow(IDirectFBWindow *window);
void stopInputEventLoop();

View File

@ -87,14 +87,12 @@ QDirectFbWindow::QDirectFbWindow(QWindow *tlw, QDirectFbInput *inputhandler)
setVisible(window()->visible());
DFBWindowID id;
m_dfbWindow->GetID(m_dfbWindow.data(), &id);
m_inputHandler->addWindow(id,tlw);
m_inputHandler->addWindow(m_dfbWindow.data(), tlw);
}
QDirectFbWindow::~QDirectFbWindow()
{
m_inputHandler->removeWindow(winId());
m_inputHandler->removeWindow(m_dfbWindow.data());
m_dfbWindow->Destroy(m_dfbWindow.data());
}