diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2010-11-26 15:01:29 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2010-11-26 15:06:09 (GMT) |
commit | f7d66442963e1380a4f2db3d24cb24aa9d5c63ad (patch) | |
tree | 3dd40149263a2f8b5a842205a4545b61f2d31f9c /src | |
parent | 71abe300263d9f6bcd6e061e889a58111c48f92a (diff) | |
download | Qt-f7d66442963e1380a4f2db3d24cb24aa9d5c63ad.zip Qt-f7d66442963e1380a4f2db3d24cb24aa9d5c63ad.tar.gz Qt-f7d66442963e1380a4f2db3d24cb24aa9d5c63ad.tar.bz2 |
Make the openKODE use the new eventloopintegration api.
And also make it work with the new GL functionality in Lighthouse
Diffstat (limited to 'src')
4 files changed, 24 insertions, 14 deletions
diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp index 73d874c..aefabf0 100644 --- a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp @@ -79,7 +79,7 @@ void kdprocessevent( const KDEvent *event) qDebug() << "KD_EVENT_INPUT_KEY_ATX"; break; case QT_EVENT_WAKEUP_EVENTLOOP: -// qDebug() << "QT_EVENT_WAKEUP_EVENTLOOP"; + QPlatformEventLoopIntegration::processEvents(); break; default: break; @@ -90,25 +90,34 @@ void kdprocessevent( const KDEvent *event) } QOpenKODEEventLoopIntegration::QOpenKODEEventLoopIntegration() + : m_quit(false) { m_kdThread = kdThreadSelf(); kdInstallCallback(&kdprocessevent,QT_EVENT_WAKEUP_EVENTLOOP,this); } -void QOpenKODEEventLoopIntegration::processEvents(qint64 msec) +void QOpenKODEEventLoopIntegration::startEventLoop() { - if (msec == 0) - msec = -1; - const KDEvent *event = kdWaitEvent(msec*1000); - if (event) { - kdDefaultEvent(event); - while ((event = kdWaitEvent(0)) != 0) { + + while(!m_quit) { + qint64 msec = nextTimerEvent(); + const KDEvent *event = kdWaitEvent(msec); + if (event) { kdDefaultEvent(event); + while ((event = kdWaitEvent(0)) != 0) { + kdDefaultEvent(event); + } } + QPlatformEventLoopIntegration::processEvents(); } } -void QOpenKODEEventLoopIntegration::wakeup() +void QOpenKODEEventLoopIntegration::quitEventLoop() +{ + m_quit = true; +} + +void QOpenKODEEventLoopIntegration::qtNeedsToProcessEvents() { KDEvent *event = kdCreateEvent(); event->type = QT_EVENT_WAKEUP_EVENTLOOP; diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h index 61bd444..73b287f 100644 --- a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h @@ -54,12 +54,14 @@ class QOpenKODEEventLoopIntegration : public QPlatformEventLoopIntegration { public: QOpenKODEEventLoopIntegration(); - void processEvents(qint64 msec); - void wakeup(); + void startEventLoop(); + void quitEventLoop(); + void qtNeedsToProcessEvents(); void processInputEvent(const KDEvent *event); private: + bool m_quit; KDThread *m_kdThread; }; diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp index 60be897..763e69e 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -207,7 +207,7 @@ QWindowSurface *QOpenKODEIntegration::createWindowSurface(QWidget *widget, WId) case QPlatformWindowFormat::OpenVG: // returnSurface = new QVGWindowSurface(widget); - break; +// break; default: returnSurface = new QGLWindowSurface(widget); diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index 32517c6..91c6473 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -160,7 +160,7 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) m_eglContextAttrs.data(), surface, m_eglApi); m_platformGlContext->makeDefaultSaredContext(); } else { - m_platformGlContext = static_cast<QEGLPlatformContext *>(QPlatformGLContext::defaultSharedContext()); + m_platformGlContext = const_cast<QEGLPlatformContext *>(static_cast<const QEGLPlatformContext *>(QPlatformGLContext::defaultSharedContext())); kdDestroyWindow(m_kdWindow); m_kdWindow = 0; } @@ -209,7 +209,6 @@ void QOpenKODEWindow::setGeometry(const QRect &rect) //need to recreate context if (needToDeleteContext) { - qDebug() << "deleting context"; delete m_platformGlContext; QList<QPlatformScreen *> screens = QApplicationPrivate::platformIntegration()->screens(); |