summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/openkode
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/openkode')
-rw-r--r--src/plugins/platforms/openkode/openkode.pro6
-rw-r--r--src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp29
-rw-r--r--src/plugins/platforms/openkode/qopenkodeeventloopintegration.h17
-rw-r--r--src/plugins/platforms/openkode/qopenkodeintegration.cpp42
-rw-r--r--src/plugins/platforms/openkode/qopenkodeintegration.h4
-rw-r--r--src/plugins/platforms/openkode/qopenkodewindow.cpp1
-rw-r--r--src/plugins/platforms/openkode/qopenkodewindowsurface.cpp6
7 files changed, 63 insertions, 42 deletions
diff --git a/src/plugins/platforms/openkode/openkode.pro b/src/plugins/platforms/openkode/openkode.pro
index c039131..2d90b15 100644
--- a/src/plugins/platforms/openkode/openkode.pro
+++ b/src/plugins/platforms/openkode/openkode.pro
@@ -10,13 +10,15 @@ SOURCES = main.cpp \
qopenkodewindowsurface.cpp \
qopenkodewindow.cpp \
../eglconvenience/qeglplatformcontext.cpp \
- ../eglconvenience/qeglconvenience.cpp
+ ../eglconvenience/qeglconvenience.cpp \
+ qopenkodeeventloopintegration.cpp
HEADERS = qopenkodeintegration.h \
qopenkodewindowsurface.h \
qopenkodewindow.h \
../eglconvenience/qeglplatformcontext.h \
- ../eglconvenience/qeglconvenience.h
+ ../eglconvenience/qeglconvenience.h \
+ qopenkodeeventloopintegration.h
RESOURCES = resources.qrc
diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp
new file mode 100644
index 0000000..467b5b5
--- /dev/null
+++ b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp
@@ -0,0 +1,29 @@
+#include "qopenkodeeventloopintegration.h"
+
+#include <KD/kd.h>
+
+#include <QtCore/QDebug>
+
+QOpenKODEEventLoopIntegration::QOpenKODEEventLoopIntegration()
+{
+ m_kdThread = kdThreadSelf();
+}
+
+void QOpenKODEEventLoopIntegration::processEvents(qint64 msec)
+{
+ if (msec == 0)
+ msec = -1;
+ const KDEvent *event = kdWaitEvent(msec*1000);
+ if (event) {
+ kdDefaultEvent(event);
+ while ((event = kdWaitEvent(0)) != 0) {
+ kdDefaultEvent(event);
+ }
+ }
+}
+
+void QOpenKODEEventLoopIntegration::wakeup()
+{
+ KDEvent *event = kdCreateEvent();
+ kdPostThreadEvent(event,m_kdThread);
+}
diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h
new file mode 100644
index 0000000..ef04640
--- /dev/null
+++ b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h
@@ -0,0 +1,17 @@
+#ifndef QOPENKODEEVENTLOOPINTEGRATION_H
+#define QOPENKODEEVENTLOOPINTEGRATION_H
+
+#include <QtGui/QPlatformEventLoopIntegration>
+
+class KDThread;
+class QOpenKODEEventLoopIntegration : public QPlatformEventLoopIntegration
+{
+public:
+ QOpenKODEEventLoopIntegration();
+ void processEvents(qint64 msec);
+ void wakeup();
+private:
+ KDThread *m_kdThread;
+};
+
+#endif // QOPENKODEEVENTLOOPINTEGRATION_H
diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp
index 270763b..5dada28 100644
--- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp
+++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp
@@ -42,6 +42,7 @@
#include "qopenkodeintegration.h"
#include "qopenkodewindowsurface.h"
#include "qopenkodewindow.h"
+#include "qopenkodeeventloopintegration.h"
#include <QtOpenGL/private/qpixmapdata_gl_p.h>
#include <QtOpenGL/private/qwindowsurface_gl_p.h>
@@ -184,41 +185,11 @@ static GLuint loadShaders(const QString &vertexShader, const QString &fragmentSh
return prog;
}
-class QOpenKODEEventLoopHelper : public QThread
-{
-public:
- QOpenKODEEventLoopHelper(QSemaphore *m)
- : eventMutex(m)
- {
- m->acquire();
- }
-
-protected:
- void run()
- {
- if (kdInitializeNV() == KD_ENOTINITIALIZED) {
- qFatal("Did not manage to initialize openkode");
- }
- eventMutex->release();
-
- const KDEvent *event;
- while ((event = kdWaitEvent(-1)) != 0) {
- qDebug() << "!!! received event!";
- kdDefaultEvent(event);
- }
- }
-
-private:
- QSemaphore *eventMutex;
-};
-
QOpenKODEIntegration::QOpenKODEIntegration()
- : eventMutex(1)
{
- QOpenKODEEventLoopHelper *loop = new QOpenKODEEventLoopHelper(&eventMutex);
- loop->start();
- eventMutex.acquire(); // block until initialization done
-
+ if (kdInitializeNV() == KD_ENOTINITIALIZED) {
+ qFatal("Did not manage to initialize openkode");
+ }
QOpenKODEScreen *mPrimaryScreen = new QOpenKODEScreen();
mScreens.append(mPrimaryScreen);
@@ -265,6 +236,11 @@ bool QOpenKODEIntegration::hasOpenGL() const
return true;
}
+QPlatformEventLoopIntegration *QOpenKODEIntegration::createEventLoopIntegration() const
+{
+ return new QOpenKODEEventLoopIntegration;
+}
+
GLuint QOpenKODEIntegration::blitterProgram()
{
static GLuint shaderProgram = 0;
diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h
index 9029086..0eaf127 100644
--- a/src/plugins/platforms/openkode/qopenkodeintegration.h
+++ b/src/plugins/platforms/openkode/qopenkodeintegration.h
@@ -86,7 +86,8 @@ public:
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
bool hasOpenGL() const;
- QPlatformGLContext * createGLContext();
+
+ QPlatformEventLoopIntegration *createEventLoopIntegration() const;
virtual QList<QPlatformScreen *> screens() const { return mScreens; }
@@ -94,7 +95,6 @@ public:
private:
QList<QPlatformScreen *> mScreens;
- QSemaphore eventMutex;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp
index 2213a8f..faba2fb 100644
--- a/src/plugins/platforms/openkode/qopenkodewindow.cpp
+++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp
@@ -60,7 +60,6 @@
QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw)
: QPlatformWindow(tlw)
{
-
if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenVG) {
m_eglApi = EGL_OPENVG_API;
} else {
diff --git a/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp b/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp
index a349031..84e27f5 100644
--- a/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp
+++ b/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp
@@ -93,8 +93,6 @@ void QOpenKODEWindowSurface::flush(QWidget *widget, const QRegion &region, const
y = boundingRect.y();
}
- qDebug() << "flush" << widget << offset << region.boundingRect() << mImage.format() << blitImage.format();
-
GLuint shaderProgram = QOpenKODEIntegration::blitterProgram();
glUseProgram(shaderProgram);
@@ -125,7 +123,7 @@ void QOpenKODEWindowSurface::flush(QWidget *widget, const QRegion &region, const
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, mImage.bits());
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, mImage.bits());
// Enable vertex attribute associated with vertex position
glEnableVertexAttribArray(posId);
@@ -166,7 +164,7 @@ void QOpenKODEWindowSurface::beginPaint(const QRegion &region)
Q_UNUSED(region);
if (mImage.isNull()) {
m_platformGLContext = window()->platformWindow()->glContext();
- mImage = QImage(size(),QImage::Format_RGB32);
+ mImage = QImage(size(),QImage::Format_RGB888);
}
}