EGLFS: Do not assume all hooks will want to create a QEGLPlatformCursor

Change-Id: I05502c27d697524fb4c4d4ccc3aec0e59589fe24
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
This commit is contained in:
Louai Al-Khanji 2014-09-16 09:52:00 +03:00
parent e22fcc8c06
commit fb44d3838a
7 changed files with 7 additions and 8 deletions

View File

@ -89,6 +89,7 @@ private:
class QEGLPlatformCursor : public QPlatformCursor, protected QOpenGLFunctions
{
Q_OBJECT
public:
QEGLPlatformCursor(QPlatformScreen *screen);
~QEGLPlatformCursor();

View File

@ -70,7 +70,7 @@ void QEglFSContext::swapBuffers(QPlatformSurface *surface)
// draw the cursor
if (surface->surface()->surfaceClass() == QSurface::Window) {
QPlatformWindow *window = static_cast<QPlatformWindow *>(surface);
if (QEGLPlatformCursor *cursor = static_cast<QEGLPlatformCursor *>(window->screen()->cursor()))
if (QEGLPlatformCursor *cursor = qobject_cast<QEGLPlatformCursor *>(window->screen()->cursor()))
cursor->paintOnScreen();
}

View File

@ -50,7 +50,6 @@
QT_BEGIN_NAMESPACE
class QEGLPlatformCursor;
class QEglFSScreen;
class QEglFSHooks
@ -73,7 +72,7 @@ public:
const QSurfaceFormat &format);
virtual void destroyNativeWindow(EGLNativeWindowType window);
virtual bool hasCapability(QPlatformIntegration::Capability cap) const;
virtual QEGLPlatformCursor *createCursor(QPlatformScreen *screen) const;
virtual QPlatformCursor *createCursor(QPlatformScreen *screen) const;
virtual bool filterConfig(EGLDisplay display, EGLConfig config) const;
virtual void waitForVSync() const;
virtual void presentBuffer();

View File

@ -181,7 +181,7 @@ bool QEglFSHooks::hasCapability(QPlatformIntegration::Capability cap) const
return false;
}
QEGLPlatformCursor *QEglFSHooks::createCursor(QPlatformScreen *screen) const
QPlatformCursor *QEglFSHooks::createCursor(QPlatformScreen *screen) const
{
return new QEGLPlatformCursor(screen);
}

View File

@ -42,7 +42,7 @@
#include "qeglfsscreen.h"
#include "qeglfswindow.h"
#include "qeglfshooks.h"
#include <QtPlatformSupport/private/qeglplatformcursor_p.h>
#include <QtGui/qpa/qplatformcursor.h>
QT_BEGIN_NAMESPACE

View File

@ -50,7 +50,6 @@
QT_BEGIN_NAMESPACE
class QEGLPlatformCursor;
class QEglFSWindow;
class QOpenGLContext;
@ -87,7 +86,7 @@ private:
EGLDisplay m_dpy;
EGLSurface m_surface;
QEGLPlatformCursor *m_cursor;
QPlatformCursor *m_cursor;
QEGLPlatformWindow *m_rootWindow;
QOpenGLContext *m_rootContext;
};

View File

@ -124,7 +124,7 @@ void QEglFSWindow::destroy()
{
QEglFSScreen *screen = this->screen();
if (m_flags.testFlag(HasNativeWindow)) {
QEGLPlatformCursor *cursor = static_cast<QEGLPlatformCursor *>(screen->cursor());
QEGLPlatformCursor *cursor = qobject_cast<QEGLPlatformCursor *>(screen->cursor());
if (cursor)
cursor->resetResources();