From f89f099c55576992b39a8021aace64ff32747624 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 13 Sep 2013 13:02:20 +0200 Subject: eglfs: Support multiple raster windows Allow widget apps with popups and multiple top-level widgets to function on the eglfs platform. GL and Quick2 apps are not affected. Instead of trying to create a native window and EGL surface for each window, do it only for the window that is created first. This first window is forced to fullscreen as usual. Later windows however are treated differently: These will not have a native window, surface or context, and keep their normal size. All the textures belonging to the raster windows are then rendered in one step, using a stacking order maintained based on visibility changes and window activation. Note that this will only help apps that create a main window first and have everything else inside that window or on top of it as menus, dialogs, popups, etc. Change-Id: Ia435458ba81bf3c35cc8f61bcb2d2a50cf17f0e3 Reviewed-by: Gunnar Sletta Reviewed-by: Andy Nichols --- src/plugins/platforms/eglfs/qeglfscursor.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/plugins/platforms/eglfs/qeglfscursor.cpp') diff --git a/src/plugins/platforms/eglfs/qeglfscursor.cpp b/src/plugins/platforms/eglfs/qeglfscursor.cpp index f54e077311..c00e86de35 100644 --- a/src/plugins/platforms/eglfs/qeglfscursor.cpp +++ b/src/plugins/platforms/eglfs/qeglfscursor.cpp @@ -62,12 +62,21 @@ QEglFSCursor::QEglFSCursor(QEglFSScreen *screen) } QEglFSCursor::~QEglFSCursor() +{ + resetResources(); +} + +void QEglFSCursor::resetResources() { if (QOpenGLContext::currentContext()) { glDeleteProgram(m_program); glDeleteTextures(1, &m_cursor.customCursorTexture); glDeleteTextures(1, &m_cursorAtlas.texture); } + m_program = 0; + m_cursor.customCursorTexture = 0; + m_cursor.customCursorPending = !m_cursor.customCursorImage.isNull(); + m_cursorAtlas.texture = 0; } static GLuint createShader(GLenum shaderType, const char *program) @@ -201,9 +210,9 @@ bool QEglFSCursor::setCurrentCursor(QCursor *cursor) return false; if (m_cursor.shape == Qt::BitmapCursor) { - m_cursor.customCursorImage = QImage(); // in case render() never uploaded it + m_cursor.customCursorImage = QImage(); + m_cursor.customCursorPending = false; } - m_cursor.shape = newShape; if (newShape != Qt::BitmapCursor) { // standard cursor const float ws = (float)m_cursorAtlas.cursorWidth / m_cursorAtlas.width, @@ -221,6 +230,7 @@ bool QEglFSCursor::setCurrentCursor(QCursor *cursor) m_cursor.texture = 0; // will get updated in the next render() m_cursor.size = image.size(); m_cursor.customCursorImage = image; + m_cursor.customCursorPending = true; } return true; @@ -255,7 +265,7 @@ void QEglFSCursor::pointerEvent(const QMouseEvent &event) if (event.type() != QEvent::MouseMove) return; const QRect oldCursorRect = cursorRect(); - m_cursor.pos = event.pos(); + m_cursor.pos = event.screenPos().toPoint(); update(oldCursorRect | cursorRect()); } @@ -280,18 +290,17 @@ void QEglFSCursor::draw(const QRectF &r) if (!m_cursorAtlas.texture) { createCursorTexture(&m_cursorAtlas.texture, m_cursorAtlas.image); - m_cursorAtlas.image = QImage(); if (m_cursor.shape != Qt::BitmapCursor) m_cursor.texture = m_cursorAtlas.texture; } } - if (m_cursor.shape == Qt::BitmapCursor && !m_cursor.customCursorImage.isNull()) { + if (m_cursor.shape == Qt::BitmapCursor && m_cursor.customCursorPending) { // upload the custom cursor createCursorTexture(&m_cursor.customCursorTexture, m_cursor.customCursorImage); m_cursor.texture = m_cursor.customCursorTexture; - m_cursor.customCursorImage = QImage(); + m_cursor.customCursorPending = false; } Q_ASSERT(m_cursor.texture); -- cgit v1.2.3